Moved the base priority calculation to the BestMoveSearcher class
parent
da28e94c01
commit
0469760f30
|
|
@ -98,6 +98,11 @@ class BestMoveSearcher {
|
|||
return value;
|
||||
}
|
||||
|
||||
static int getPositionBasePriority(Position position, int value, Iterable<(String, Position)> legalMoves, int depth) =>
|
||||
legalMoves.isEmpty
|
||||
? Numbers.maxInteger
|
||||
: 0;
|
||||
|
||||
Future<String?> search(Position position, int? moveTime) async {
|
||||
_isRunning = true;
|
||||
PositionTreeNode positionTree = PositionTreeNode.fromPosition(position);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class PositionTreeNode {
|
|||
final int value = BestMoveSearcher.getPositionBaseValue(position);
|
||||
final Iterable<(String, Position)> legalMoves = LegalMoves.getLegalMoves(position);
|
||||
return PositionTreeNode(
|
||||
priority: getPositionBasePriority(position, value, legalMoves, 0),
|
||||
priority: BestMoveSearcher.getPositionBasePriority(position, value, legalMoves, 0),
|
||||
value: value,
|
||||
move: move,
|
||||
position: position,
|
||||
|
|
@ -88,9 +88,4 @@ class PositionTreeNode {
|
|||
value = childrenByValue.first.value;
|
||||
}
|
||||
|
||||
static int getPositionBasePriority(Position position, int value, Iterable<(String, Position)> legalMoves, int depth) =>
|
||||
legalMoves.isEmpty
|
||||
? Numbers.maxInteger
|
||||
: 0;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue