Skip to content

Commit

Permalink
Some cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Error323 committed Apr 16, 2012
1 parent a554a91 commit e1d8f5d
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/asearch/asearch.cpp
Expand Up @@ -98,20 +98,6 @@ Score ASearch::AlphaBetaValue(State *inState, int inPly, int inDepth, Score inAl

mStatesVisited++;

/*
TTable::Flag flag = inState->Get(inDepth, inPly, pair);
switch (flag)
{
case TTable::EXACT: return pair.first;
// case TTable::UPPERBOUND: inBeta = std::min<int>(inBeta, pair.first); break;
case TTable::LOWERBOUND: inAlpha = std::max<int>(inAlpha, pair.first); break;
default: break;
}
if (inAlpha >= inBeta)
return inAlpha;
*/

std::vector<Move> moves = inState->GetLegalMoves();
for (int i = 0, n = moves.size(); i < n; i++)
{
Expand All @@ -125,8 +111,6 @@ Score ASearch::AlphaBetaValue(State *inState, int inPly, int inDepth, Score inAl
break;
}

// inState->Put(inDepth, inPly, inAlpha, inBeta, pair);

return inAlpha;
}

Expand All @@ -146,7 +130,7 @@ Move ASearch::Negascout(State *inState, int inMaxDepth)
mStatesVisited++;
inState->MakeMove(moves[i]);
Score val = -NegascoutValue(inState, 2, inMaxDepth - 1, -beta, -best_score);
if (i > 0 && best_score < val && val < INF)
if (i > 0 && best_score < val)
val = -NegascoutValue(inState, 2, inMaxDepth - 1, -INF, -best_score);
inState->UndoMove(moves[i]);

Expand All @@ -162,6 +146,7 @@ Move ASearch::Negascout(State *inState, int inMaxDepth)
return best_move;
}

/// As defined at: http://en.wikipedia.org/wiki/Negascout
Score ASearch::NegascoutValue(State *inState, int inPly, int inDepth, Score inAlpha,
Score inBeta)
{
Expand Down Expand Up @@ -194,7 +179,7 @@ Score ASearch::NegascoutValue(State *inState, int inPly, int inDepth, Score inAl
std::swap<Move>(*i, moves[0]);
}

// Apply other moves
// Apply moves
for (int i = 0, n = moves.size(); i < n; i++)
{
inState->MakeMove(moves[i]);
Expand Down

0 comments on commit e1d8f5d

Please sign in to comment.