-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp4.h
More file actions
79 lines (45 loc) · 1.46 KB
/
p4.h
File metadata and controls
79 lines (45 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#define VRAI 1
#define FAUX 0
#define P1_JETON 'X'
#define P2_JETON 'O'
// players jeton amount
#define NB_JETON 21
// power 4 game default dimension
#define DEFAULT_H 6
#define DEFAULT_W 7
// error message
#define ALLOCATION_ERROR "Null pointer ! Allocation have failed."
#define COLUMN_FILLED "This column is filled ! Just Try again ^^."
// PLayer
#define PLAYER_ONE "player one turn"
#define PLAYER_TWO "player two turn"
#define PLAY_MSG "which column do you want to play "
#define MATCH_NULL "match Null !!"
struct player_s
{
char name[250];
int tokens;
};
typedef unsigned char uc;
/* main function P4_GAME used to launch the game */
int p4_game();
/*insertion function */
int insert(uc* grid, int column, uc token);
// play the game => select the player
int turn (int player, uc* grid);
/*create tab*/
uc* create_tab(int w, int h);
/* check if the case is empty ' '*/
int is_empty(uc value);
/*turn select the player and call thge insert function */
/*check if a column is not filled of token */
int is_filled(uc* grid, int column);
/* check horizontaly if the token that have been put finished the game */
int check_horizontal();
/* check verticaly if the token that have been put finished the game */
int check_vertical();
/* check right diagonal if the token that have been put finished the game */
int check_rdiagonal();
/* check left diagonal if the token that have been put finished the game */
int check_ldiagonal();