init board
This commit is contained in:
+6
-2
@@ -3,7 +3,11 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
bool init_board(board_t *board) {
|
bool init_board(board_t *board) {
|
||||||
|
for (int i = 0; i < BOARD_VERTICAL; i++) {
|
||||||
|
for (int j = 0; j < BOARD_HORIZONTAL; j++) {
|
||||||
|
*board[i][j] = BOARD_DEFAULT_CONFIG[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void select_player(player_e *player, unsigned int round_count) {
|
void select_player(player_e *player, unsigned int round_count) {
|
||||||
@@ -48,7 +52,7 @@ bool is_move_in_bounds(move_t move) {
|
|||||||
|
|
||||||
bool get_move(move_t *move) {
|
bool get_move(move_t *move) {
|
||||||
clear_stdin();
|
clear_stdin();
|
||||||
|
|
||||||
char _x_from, _x_to;
|
char _x_from, _x_to;
|
||||||
int _y_from, _y_to;
|
int _y_from, _y_to;
|
||||||
scanf("%c%d %c%d",
|
scanf("%c%d %c%d",
|
||||||
|
|||||||
+7
-7
@@ -49,13 +49,13 @@ typedef struct {
|
|||||||
|
|
||||||
// the default arrangment of pieces on the board
|
// the default arrangment of pieces on the board
|
||||||
#define BOARD_DEFAULT_CONFIG \
|
#define BOARD_DEFAULT_CONFIG \
|
||||||
{\
|
(board_t){\
|
||||||
{2,3,4,5,6,4,3,2}\
|
{2,3,4,5,6,4,3,2},\
|
||||||
{1,1,1,1,1,1,1,1}\
|
{1,1,1,1,1,1,1,1},\
|
||||||
{0,0,0,0,0,0,0,0}\
|
{0,0,0,0,0,0,0,0},\
|
||||||
{0,0,0,0,0,0,0,0}\
|
{0,0,0,0,0,0,0,0},\
|
||||||
{0,0,0,0,0,0,0,0}\
|
{0,0,0,0,0,0,0,0},\
|
||||||
{1,1,1,1,1,1,1,1}\
|
{1,1,1,1,1,1,1,1},\
|
||||||
{2,3,4,5,6,4,3,2}\
|
{2,3,4,5,6,4,3,2}\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user