Refactor chesspp module with pyproject

This commit is contained in:
2024-01-27 21:36:46 +01:00
parent 69aa9ce2d9
commit c69b542653
12 changed files with 27 additions and 11 deletions

View File

@@ -1,11 +1,10 @@
import chess import chess
import chess.engine import chess.engine
import chess.pgn import chess.pgn
from chesspp.classic_mcts import ClassicMcts from src.chesspp.classic_mcts import ClassicMcts
from chesspp import engine from src.chesspp import engine
from chesspp import eval from src.chesspp import util
from chesspp import util from src.chesspp import simulation, eval
from chesspp import simulation
def test_simulate(): def test_simulate():

13
pyproject.toml Normal file
View File

@@ -0,0 +1,13 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "chess-pp"
version = "0.1"
dependencies = [
"chess==1.10.0",
"numpy==1.26.3",
"stockfish==3.28.0",
]
requires-python = ">= 3.10"

0
src/chesspp/__init__.py Normal file
View File

View File

@@ -1,10 +1,12 @@
import chess import chess
import random import random
import eval
import util
import numpy as np import numpy as np
from chesspp import eval
from chesspp import util
class ClassicMcts: class ClassicMcts:
def __init__(self, board: chess.Board, color: chess.Color, parent=None, move: chess.Move | None = None, def __init__(self, board: chess.Board, color: chess.Color, parent=None, move: chess.Move | None = None,

View File

@@ -1,9 +1,10 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
import chess import chess
import chess.engine import chess.engine
from classic_mcts import ClassicMcts
import random import random
from chesspp.classic_mcts import ClassicMcts
class Engine(ABC): class Engine(ABC):
color: chess.Color color: chess.Color

View File

@@ -1,7 +1,7 @@
import chess import chess
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from i_strategy import IStrategy
from typing import Dict from typing import Dict
from chesspp.i_strategy import IStrategy
class IMcts(ABC): class IMcts(ABC):

View File

@@ -1,6 +1,7 @@
from lichess_bot.lib.engine_wrapper import MinimalEngine, MOVE from lichess_bot.lib.engine_wrapper import MinimalEngine, MOVE
import chess.engine import chess.engine
import engine
from chesspp import engine
class ProbStockfish(MinimalEngine): class ProbStockfish(MinimalEngine):

View File

@@ -6,7 +6,7 @@ from typing import Tuple, List
from enum import Enum from enum import Enum
from dataclasses import dataclass from dataclasses import dataclass
from engine import Engine from chesspp.engine import Engine
class Winner(Enum): class Winner(Enum):