20-add-negamax-eval-function #31

Merged
Josh merged 9 commits from 20-add-negamax-eval-function into main 2025-08-26 00:28:03 +00:00
Showing only changes of commit d7d6263cc1 - Show all commits

View File

@@ -1,10 +1,12 @@
import random import random
import ctypes as C
from binding.python_c_ffi import ChessFFI from binding.python_c_ffi import ChessFFI
from binding.python_c_ffi import Move from binding.python_c_ffi import Move
class BaseEvaluation: class BaseEvaluation:
NAME = ""
def __init__(self, chess_ffi=None): def __init__(self, chess_ffi=None):
if chess_ffi is None: if chess_ffi is None:
chess_ffi = ChessFFI() chess_ffi = ChessFFI()
@@ -27,6 +29,9 @@ class BaseEvaluation:
a simplistic approach. a simplistic approach.
""" """
class RandomEval(BaseEvaluation): class RandomEval(BaseEvaluation):
NAME = "random"
def __init__(self, chess_ffi=None): def __init__(self, chess_ffi=None):
super().__init__(chess_ffi) super().__init__(chess_ffi)
@@ -36,6 +41,9 @@ class RandomEval(BaseEvaluation):
class NegaMaxEval(BaseEvaluation): class NegaMaxEval(BaseEvaluation):
NAME = "negamax"
def __init__(self, depth=6, cp_window=20, chess_ffi=None): def __init__(self, depth=6, cp_window=20, chess_ffi=None):
super().__init__(chess_ffi) super().__init__(chess_ffi)
self.depth = depth self.depth = depth
@@ -57,4 +65,7 @@ class NegaMaxEval(BaseEvaluation):
def get_params(self): def get_params(self):
return [self.depth, self.window] return {
"depth": self.depth,
"window": self.window,
}