Refactored a bit
This commit is contained in:
parent
99f5c6cd6e
commit
5379f50802
8 changed files with 534 additions and 449 deletions
41
types.h
Normal file
41
types.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#pragma once
|
||||
#include "config.h"
|
||||
|
||||
typedef enum {
|
||||
PUT,
|
||||
POP
|
||||
} move_t;
|
||||
|
||||
typedef struct {
|
||||
int player;
|
||||
int heigth [ BOARD_WIDTH ];
|
||||
int column [ BOARD_WIDTH ];
|
||||
} board_t;
|
||||
|
||||
typedef struct {
|
||||
int vertical2 [ BOARD_WIDTH ];
|
||||
int horizontal2 [ BOARD_WIDTH - 1 ];
|
||||
int diagonalUp2 [ BOARD_WIDTH - 1 ];
|
||||
int diagonalDown2 [ BOARD_WIDTH - 1 ];
|
||||
int vertical4 [ BOARD_WIDTH ];
|
||||
int horizontal4 [ BOARD_WIDTH - 3 ];
|
||||
int diagonalUp4 [ BOARD_WIDTH - 3 ];
|
||||
int diagonalDown4 [ BOARD_WIDTH - 3 ];
|
||||
} directions_t;
|
||||
|
||||
typedef struct {
|
||||
int total;
|
||||
int horizontal;
|
||||
int vertical;
|
||||
int diagonalUp;
|
||||
int diagonalDown;
|
||||
} wincount_t;
|
||||
|
||||
typedef struct {
|
||||
wincount_t count0;
|
||||
wincount_t count1;
|
||||
int win0 [ BOARD_WIDTH ];
|
||||
int win1 [ BOARD_WIDTH ];
|
||||
directions_t same;
|
||||
} wins_t;
|
||||
Loading…
Add table
Add a link
Reference in a new issue