include/init.h
Classes
Name | |
---|---|
struct | cell cell of the board |
struct | board board containing the number of cells for each player, and a pointer to the middle cell |
Types
Name | |
---|---|
enum | state { EMPTY, WHITE, BLACK}state of a cell on the board |
enum | selection { UNSELECT, SELECT, MOUSE}state of selection of a cell on the board |
typedef enum state | state_e state of a cell on the board |
typedef enum selection | selection_e state of selection of a cell on the board |
typedef struct cell | cell_t cell of the board |
typedef struct board | board_t board containing the number of cells for each player, and a pointer to the middle cell |
Functions
Name | |
---|---|
cell_t * | create_cell(int id)creates a cell of the board |
board_t * | create_clean_board()creates an empty board |
board_t * | start_config(board_t * b)puts balls on the board into a start configuration |
board_t * | start_config_2(board_t * b)puts balls on the board into another start configuration |
cell_t ** | create_table(board_t b)creates an array with all the cells of the board |
Defines
Name | |
---|---|
CELL_NUMBER | |
MAX_DEPTH |
Types Documentation
enum state
Enumerator | Value | Description |
---|---|---|
EMPTY | ||
WHITE | ||
BLACK |
state of a cell on the board
enum selection
Enumerator | Value | Description |
---|---|---|
UNSELECT | ||
SELECT | ||
MOUSE |
state of selection of a cell on the board
typedef state_e
typedef enum state state_e;
state of a cell on the board
typedef selection_e
typedef enum selection selection_e;
state of selection of a cell on the board
typedef cell_t
typedef struct cell cell_t;
cell of the board
typedef board_t
typedef struct board board_t;
board containing the number of cells for each player, and a pointer to the middle cell
Functions Documentation
function create_cell
cell_t * create_cell(
int id
)
creates a cell of the board
function create_clean_board
board_t * create_clean_board()
creates an empty board
function start_config
board_t * start_config(
board_t * b
)
puts balls on the board into a start configuration
function start_config_2
board_t * start_config_2(
board_t * b
)
puts balls on the board into another start configuration
function create_table
cell_t ** create_table(
board_t b
)
creates an array with all the cells of the board
Macros Documentation
define CELL_NUMBER
#define CELL_NUMBER 61
define MAX_DEPTH
#define MAX_DEPTH 2
Source code
/* name : init.h
* authors : eloi petit, matheo thomas, domitille vale
* date : 18-06-24
*/
#ifndef init_h
#define init_h
#define CELL_NUMBER 61
#define MAX_DEPTH 2
/* Struct definitions */
typedef enum state {
EMPTY,
WHITE,
BLACK,
} state_e;
typedef enum selection {
UNSELECT,
SELECT,
MOUSE,
} selection_e;
typedef struct cell {
int id;
state_e state;
selection_e selection;
struct cell *neighbor[6];
} cell_t;
typedef struct board {
cell_t *cell; // pointer to the first cell of the board, the one in the middle
int n_white;
int n_black;
} board_t;
/* Functions definitions */
cell_t *create_cell(int id);
board_t *create_clean_board();
board_t *start_config(board_t* b);
board_t* start_config_2(board_t* b);
cell_t ** create_table(board_t b);
#endif