#include #include "board.h" #include "game.h" #include "input.h" #include "move.h" #include "print.h" /* * Return 1 if the received player is checkmated. Returns 0 otherwise. * TODO */ int game_is_checkmate(Board b, Color p) { return 0; } /* * Check if a move is valid in the received board for the received player. * TODO. */ int game_is_move_valid(Board b, Color p, Move m) { return 1; } Board game_loop(Board board) { Board b = board; Color current_player = WHITE; Move m; int move_valid; while (!game_is_checkmate(b, current_player)) { print_board(b, current_player); putchar('\n'); if (current_player == WHITE) puts("White's turn."); else puts("Black's turn"); move_valid = 0; while (!move_valid) { m = input_move(); if (game_is_move_valid(b, current_player, m)) move_valid = 1; else printf("Invalid move. Please, try again. "); } b = board_make_move(b, m); current_player = current_player == WHITE ? BLACK : WHITE; } return 0; }