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