simple-go.h
| 1 | #ifndef SIMPLE_GO_H |
| 2 | #define SIMPLE_GO_H |
| 3 | #include <stdlib.h> |
| 4 | #include <stdint.h> |
| 5 | #include <stdbool.h> |
| 6 | #include <stdio.h> |
| 7 | #include <assert.h> |
| 8 | #include <string.h> |
| 9 | |
| 10 | #define BLACK 'b' |
| 11 | #define WHITE 'w' |
| 12 | #define EMPTY '.' |
| 13 | #define GROUP '#' |
| 14 | #define INVALID_FIELD '\0' |
| 15 | #define COUNTED '+' |
| 16 | |
| 17 | typedef struct go_board |
| 18 | { |
| 19 | char* field_array; |
| 20 | size_t size; |
| 21 | } go_board; |
| 22 | |
| 23 | typedef struct game_state |
| 24 | { |
| 25 | go_board* board; |
| 26 | bool black_turn; |
| 27 | } game_state; |
| 28 | |
| 29 | |
| 30 | go_board* create_board(size_t size); |
| 31 | bool play_at(game_state* game, size_t y, size_t x); |
| 32 | bool check_bounds(go_board* board, size_t y, size_t x); |
| 33 | void delete_board(go_board* board); |
| 34 | char get_board_at(go_board* board, size_t y, size_t x); |
| 35 | void set_board_at(go_board* board, size_t y, size_t x, char item); |
| 36 | void print_board(go_board* board); |
| 37 | void find_group(go_board* board, go_board* overlay, size_t y, size_t x); |
| 38 | size_t count_liberties(go_board* board, go_board* overlay); |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | #endif //SIMPLE_GO_H |
| 45 |