Added command-line option for setting size of board
This commit is contained in:
parent
e47d63b430
commit
72b6290798
6 changed files with 101 additions and 74 deletions
27
types.h
27
types.h
|
|
@ -1,6 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -10,19 +11,21 @@ typedef enum {
|
|||
|
||||
typedef struct {
|
||||
int player;
|
||||
int height [ BOARD_WIDTH ];
|
||||
int column [ BOARD_WIDTH ];
|
||||
int *height;
|
||||
int *column;
|
||||
uint8_t rows;
|
||||
uint8_t columns;
|
||||
} 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 ];
|
||||
int *vertical2;
|
||||
int *horizontal2;
|
||||
int *diagonalUp2;
|
||||
int *diagonalDown2;
|
||||
int *vertical4;
|
||||
int *horizontal4;
|
||||
int *diagonalUp4;
|
||||
int *diagonalDown4;
|
||||
} directions_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -36,7 +39,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
wincount_t count0;
|
||||
wincount_t count1;
|
||||
int win0 [ BOARD_WIDTH ];
|
||||
int win1 [ BOARD_WIDTH ];
|
||||
int *win0;
|
||||
int *win1;
|
||||
directions_t same;
|
||||
} wins_t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue