Skip to content

Commit

Permalink
debugging minimax error
Browse files Browse the repository at this point in the history
  • Loading branch information
dmj12004 committed Apr 20, 2017
1 parent ccee1bc commit 3f88e96
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion include/MinimaxSearch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef MINIMAX_SEARCH_H
#define MINIMAX_SEARCH_H

#include <queue>
#include <string>
#include "Move.h"
#include "BitBoard.h"
Expand All @@ -13,9 +14,11 @@ class MinimaxSearch
double minValue(const BitBoard &board, int currentDepth) const;
double maxValue(const BitBoard &board, int currentDepth) const;


public:
Move minimaxDecision(const BitBoard &board) const;

Move minimaxDecisionStack(const BitBoard &board) const;
};

#endif

4 changes: 3 additions & 1 deletion src/BitBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ std::vector<Move> BitBoard::actions() const

BitBoard BitBoard::result(Move move) const
{
BitBoard currBoard = *this;
BitBoard currBoard(*this);
int start{-1};

for (int x : move.getMoves()) {
if (start == -1) {
start = x;
Expand All @@ -219,6 +220,7 @@ BitBoard BitBoard::result(Move move) const
start = x;
}
}


currBoard.m_isBlacksTurn = !m_isBlacksTurn;
return currBoard;
Expand Down
8 changes: 8 additions & 0 deletions src/MinimaxSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Move MinimaxSearch::minimaxDecision(const BitBoard &board) const
Move bestMove;
double bestMoveValue{0.0};

std::cout << board.actions().size() << std::endl;

for (Move move : board.actions()) {
if (bestMove.isEmpty()) {
bestMove = move;
Expand All @@ -47,6 +49,12 @@ Move MinimaxSearch::minimaxDecision(const BitBoard &board) const
}
}
}

return bestMove;
}

/*Move MinimaxSearch::minimaxDecision(const BitBoard &board) const
{
return nullptr;
}*/

0 comments on commit 3f88e96

Please sign in to comment.