-
remi.greub authoredremi.greub authored
puissance4.h 1.60 KiB
#ifndef _PUIS4_
#define _PUIS4_
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
typedef enum{
CIRCLE, //signifie le symbole du cercle
CROSS, //signifie le symbole de la croix
EMPTY, //signifie une cellule vide
EQUAL //signifie un état d'égalité entre la croix et le cercle
}symbol_t;
struct cell{
symbol_t symbol;
int i_pos;
int j_pos;
};
struct player{
symbol_t symbol;
int score;
int check_win;
};
struct game{
int height;
int width;
int gamePlayed;
struct cell** cells;
struct player players[2];
int curr_player;
};
struct cell **Create_grid2D(); //on pourrait peut être créer une autre librairie CELL.h pour gérer les cellules maybe ?
void print_cells(struct cell **cell, int height, int width);
void print_gameCells(struct game game);
int init_puissance4(struct game *game, int height, int width);
//void Show_grid(struct cell** cell); //partie graphique a venir
void cell_destroy(struct cell **cells, int width);
int kill_game(struct game **game);
int put_free_cell(struct game *game, int j_p, symbol_t symbol);
int is_cell_free(struct game *game, int j_p, int i, symbol_t symbol);
int Launch_puissance4(struct game *game);
int Launch_puissance4_randBot(struct game *game, int seed);
int Launch_puissance4_smartBot(struct game *game, int seed);
int SmartBot(struct game *game);
bool Is_Grid_full(struct game game);
void print_game(struct game game);
symbol_t Find_winner(struct game *game, struct cell **grid, struct cell cellPlayed);
symbol_t CheckWin_in_a_direction(struct game *game, int dir[2], struct cell **grid, struct cell cell);
#endif