Rafs-an09002 commited on
Commit
db00797
·
verified ·
1 Parent(s): 1d5f3ea

Create engine/endgame.py

Browse files
Files changed (1) hide show
  1. engine/endgame.py +23 -0
engine/endgame.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Endgame Detection for Nexus-Nano
3
+ Minimal overhead detection
4
+ """
5
+
6
+ import chess
7
+
8
+
9
+ class EndgameDetector:
10
+ """Basic endgame detection"""
11
+
12
+ def is_known_draw(self, board: chess.Board) -> bool:
13
+ """Quick draw detection"""
14
+ return (
15
+ board.is_insufficient_material() or
16
+ board.halfmove_clock >= 100
17
+ )
18
+
19
+ def adjust_evaluation(self, board: chess.Board, eval_score: float) -> float:
20
+ """Minimal adjustment"""
21
+ if self.is_known_draw(board):
22
+ return 0.0
23
+ return eval_score