Added cli parameters for simulation test
This commit is contained in:
committed by
DarkCider
parent
b9761e1e2b
commit
86da09abcf
@@ -43,8 +43,9 @@ class Evaluation:
|
||||
self.strategy_b = strategy_b
|
||||
self.limit = limit
|
||||
|
||||
def run(self, n_games=100) -> List[EvaluationResult]:
|
||||
with mp.Pool(mp.cpu_count()) as pool:
|
||||
def run(self, n_games=100, proc=mp.cpu_count()) -> List[EvaluationResult]:
|
||||
proc = min(proc, mp.cpu_count())
|
||||
with mp.Pool(proc) as pool:
|
||||
args = [(self.engine_a, self.strategy_a, self.engine_b, self.strategy_b, self.limit) for i in range(n_games)]
|
||||
return pool.map(Evaluation._test_simulate, args)
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ _DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
class StockFishStrategy(IStrategy):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, path="../stockfish/stockfish-windows-x86-64-avx2"):
|
||||
self._stockfish = None
|
||||
self.path = path
|
||||
|
||||
def __del__(self):
|
||||
if self._stockfish is not None:
|
||||
@@ -20,7 +21,7 @@ class StockFishStrategy(IStrategy):
|
||||
def stockfish(self) -> chess.engine.SimpleEngine:
|
||||
if self._stockfish is None:
|
||||
self._stockfish = self.stockfish = chess.engine.SimpleEngine.popen_uci(
|
||||
os.path.join(_DIR, "../stockfish/stockfish-ubuntu-x86-64-avx2"))
|
||||
os.path.join(_DIR, self.path))
|
||||
return self._stockfish
|
||||
|
||||
@stockfish.setter
|
||||
|
||||
Reference in New Issue
Block a user