Update evaluation classes
This commit is contained in:
@@ -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,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user