summaryrefslogtreecommitdiff
path: root/src/valid_moves.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/valid_moves.c')
-rw-r--r--src/valid_moves.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/valid_moves.c b/src/valid_moves.c
deleted file mode 100644
index 11f5926..0000000
--- a/src/valid_moves.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* This file is a part of othello-ai-guile-c
- *
- * Copyright (C) 2021 Robby Zambito
- *
- * othello-ai-guile-c is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * othello-ai-guile-c is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-#define _GNU_SOURCE
-
-#include <stdbool.h>
-
-#include "othello.h"
-#include "othello_board.h"
-#include "othello_move.h"
-
-bool is_valid_move(enum player_color **board,
- const enum player_color current_player,
- const struct move move) {
- if (current_player == EMPTY) {
- return false;
- }
-
- // Make a copy of the input board. This is done because we lean on the logic
- // that exists in apply_move to check if a move is valid. We don't want to
- // necessarily mutate the board yet though.
- enum player_color **b = copy_board(board);
- // Apply the move to the copy of the board.
- bool res = apply_move(b, current_player, move);
-
- free_board(b);
-
- return res;
-}
-
-bool has_valid_moves(enum player_color **board,
- const enum player_color current_player) {
- bool result = false;
- struct move move;
- for (move.row = 0; move.row < 8 && !result; move.row++) {
- for (move.col = 0; move.col < 8 && !result; move.col++) {
- result = is_valid_move(board, current_player, move);
- }
- }
-
- return result;
-}