From 69aa9ce2d901cab9baa3605efa5397a94f16d6c1 Mon Sep 17 00:00:00 2001 From: dreistein Date: Sat, 27 Jan 2024 21:08:37 +0100 Subject: [PATCH] Move files into `chesspp` module --- chesspp/__init__.py | 0 classic_mcts.py => chesspp/classic_mcts.py | 0 engine.py => chesspp/engine.py | 0 eval.py => chesspp/eval.py | 0 i_mcts.py => chesspp/i_mcts.py | 0 i_strategy.py => chesspp/i_strategy.py | 0 lichess-engine.py => chesspp/lichess-engine.py | 0 simulation.py => chesspp/simulation.py | 0 util.py => chesspp/util.py | 0 main.py | 18 +++++++++--------- 10 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 chesspp/__init__.py rename classic_mcts.py => chesspp/classic_mcts.py (100%) rename engine.py => chesspp/engine.py (100%) rename eval.py => chesspp/eval.py (100%) rename i_mcts.py => chesspp/i_mcts.py (100%) rename i_strategy.py => chesspp/i_strategy.py (100%) rename lichess-engine.py => chesspp/lichess-engine.py (100%) rename simulation.py => chesspp/simulation.py (100%) rename util.py => chesspp/util.py (100%) diff --git a/chesspp/__init__.py b/chesspp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/classic_mcts.py b/chesspp/classic_mcts.py similarity index 100% rename from classic_mcts.py rename to chesspp/classic_mcts.py diff --git a/engine.py b/chesspp/engine.py similarity index 100% rename from engine.py rename to chesspp/engine.py diff --git a/eval.py b/chesspp/eval.py similarity index 100% rename from eval.py rename to chesspp/eval.py diff --git a/i_mcts.py b/chesspp/i_mcts.py similarity index 100% rename from i_mcts.py rename to chesspp/i_mcts.py diff --git a/i_strategy.py b/chesspp/i_strategy.py similarity index 100% rename from i_strategy.py rename to chesspp/i_strategy.py diff --git a/lichess-engine.py b/chesspp/lichess-engine.py similarity index 100% rename from lichess-engine.py rename to chesspp/lichess-engine.py diff --git a/simulation.py b/chesspp/simulation.py similarity index 100% rename from simulation.py rename to chesspp/simulation.py diff --git a/util.py b/chesspp/util.py similarity index 100% rename from util.py rename to chesspp/util.py diff --git a/main.py b/main.py index 842a45d..2b85e3b 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,11 @@ import chess import chess.engine import chess.pgn -from classic_mcts import ClassicMcts -import engine -import eval -import util -import simulation +from chesspp.classic_mcts import ClassicMcts +from chesspp import engine +from chesspp import eval +from chesspp import util +from chesspp import simulation def test_simulate(): @@ -64,11 +64,11 @@ def analyze_results(moves: dict): def test_evaluation(): a = engine.ClassicMctsEngine b = engine.RandomEngine - evaluator = simulation.Evaluation(a,b) + evaluator = simulation.Evaluation(a, b) results = evaluator.run(4) - a_results = len(list(filter(lambda x: x.winner == simulation.Winner.Engine_A, results)))/len(results)*100 - b_results = len(list(filter(lambda x: x.winner == simulation.Winner.Engine_B, results)))/len(results)*100 - draws = len(list(filter(lambda x: x.winner == simulation.Winner.Draw, results)))/len(results)*100 + a_results = len(list(filter(lambda x: x.winner == simulation.Winner.Engine_A, results))) / len(results) * 100 + b_results = len(list(filter(lambda x: x.winner == simulation.Winner.Engine_B, results))) / len(results) * 100 + draws = len(list(filter(lambda x: x.winner == simulation.Winner.Draw, results))) / len(results) * 100 print(f"Engine {a.get_name()} won {a_results}% of games") print(f"Engine {b.get_name()} won {b_results}% of games")