おまいら最強の将棋プログラムしてみろよ part2
■ このスレッドは過去ログ倉庫に格納されています
0606デフォルトの名無しさん
NGNG探索部分は簡単に書くと下のプログラムみたいになると思いますが、
読んだ中で双方の最善手順はどのように得られるのでしょうか?
Move AlphaBetaPlayer::GetNextMove()
{
m_MaxDepth = 3;
AlphaBetaSearch(-1000000, +1000000, 0, m_teban);
return m_BestMove;
}
int AlphaBetaPlayer::AlphaBetaSearch(int alpha, int beta, int depth, int teban)
{
if (depth == m_MaxDepth)
return m_pBoard->Evaluation(teban);
vector< Move > movelist;
m_pBoard->GetMoves(&movelist);
int best_score = alpha;
for(int i=0; i < movelist.size(); i++){
m_pBoard->ApplyMove(movelist[i]);
int score = - AlphaBetaSearch( -beta, -best_score, depth + 1, teban^1);
if (score > best_score){
best_score = score;
if (depth == 0) m_BestMove = movelist[i];
}
m_pBoard->UndoMove(movelist[i]);
if (best_score >= beta) break;
}
return best_score;
}
■ このスレッドは過去ログ倉庫に格納されています