Skip to content

Commit

Permalink
Fixing range loops
Browse files Browse the repository at this point in the history
  • Loading branch information
JanEricNitschke committed Oct 21, 2023
1 parent 2e29787 commit 00b316f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tictactoe_cpp/src/tictactoe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Move getWinningMove(char player, const GameBoard &board) {
checkWinconditions(player, board, &win_conditions);
// Check if any line requires exactly one more
// position from the player to be fulfilled
for (auto const &x : win_conditions) {
for (const auto &x : win_conditions) {
if (x.second.size() == 1) {
std::tuple<size_t, size_t> firstWin{*x.second.begin()};
Move winMove = {
Expand Down Expand Up @@ -344,7 +344,7 @@ Move minmax(char player, GameBoard *board) {
return randomMove(*board);
}
// Recursively apply minmax algorithm
for (const std::array<size_t, 2> &cell : empty_cells) {
for (const auto &cell : empty_cells) {
(*board)[cell[0]][cell[1]] = player;
Move currentMove{minmax(swapPlayer(player), board)};
if (-currentMove.state > best_move.state) {
Expand Down

0 comments on commit 00b316f

Please sign in to comment.