From 6fa2552c17781ac298ebf38f45efb22dd9d0baa1 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 11 Jul 2020 22:22:00 +0800 Subject: [PATCH] =?UTF-8?q?position:=20=E5=8E=BB=E9=99=A4=20Position=20?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E5=86=97=E4=BD=99=E6=88=90=E5=91=98=E5=8F=98?= =?UTF-8?q?=E9=87=8F=20position=20=E8=80=8C=E5=8F=AA=E4=BF=9D=E7=95=99=20p?= =?UTF-8?q?os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/search.cpp | 13 ++++++------- src/search.h | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 89571f2a..be1d704a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -56,7 +56,6 @@ vector moveHistory; AIAlgorithm::AIAlgorithm() { - position = new Position(); pos = new Position(); //movePicker = new MovePicker(); } @@ -177,7 +176,7 @@ void AIAlgorithm::setPosition(Position *p) //position = p; pos = p; - position = pos; + // position = pos; requiredQuit = false; } @@ -204,8 +203,8 @@ int AIAlgorithm::search() #ifdef THREEFOLD_REPETITION static int nRepetition = 0; - if (position->get_phase() == PHASE_MOVING) { - Key key = position->key(); + if (pos->get_phase() == PHASE_MOVING) { + Key key = pos->key(); if (std::find(moveHistory.begin(), moveHistory.end(), key) != moveHistory.end()) { nRepetition++; @@ -218,7 +217,7 @@ int AIAlgorithm::search() } } - if (position->get_phase() == PHASE_PLACING) { + if (pos->get_phase() == PHASE_PLACING) { moveHistory.clear(); } #endif // THREEFOLD_REPETITION @@ -403,10 +402,10 @@ Value AIAlgorithm::search(Depth depth, Value alpha, Value beta) } #endif - if (unlikely(position->phase == PHASE_GAMEOVER) || // TODO: Deal with hash + if (unlikely(pos->phase == PHASE_GAMEOVER) || // TODO: Deal with hash depth <= 0 || unlikely(requiredQuit)) { - bestValue = Eval::evaluate(position); + bestValue = Eval::evaluate(pos); // For win quickly if (bestValue > 0) { diff --git a/src/search.h b/src/search.h index 9e5027a9..2c0c87b5 100644 --- a/src/search.h +++ b/src/search.h @@ -227,7 +227,6 @@ public: private: Position *pos { nullptr }; - Position *position { nullptr }; Stack positionStack;