diff --git a/poetry.lock b/poetry.lock index edebce7..aef146c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.0 and should not be changed by hand. [[package]] name = "certifi" @@ -536,4 +536,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "8657ed259700be84f3e3f448241fdeb9099533347e5f5ec0acc400d04cceaf56" +content-hash = "b2a75d9dc302469cac7cf058e0b38886c11e6600a639bbe412ce553cfe5462aa" diff --git a/pyproject.toml b/pyproject.toml index 551049e..a6eb3cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "RoyalUr" -version = "0.0.6" +version = "0.0.7" description = "An API to support the playing and analysis of games of The Royal Game of Ur." authors = ["Padraig Lamont "] license = "MIT License" @@ -10,6 +10,7 @@ readme = "README.md" python = "^3.10" numpy = "^1.26.4" huggingface-hub = "^0.20.3" +overrides = "^7.7.0" [tool.poetry.group.dev.dependencies] diff --git a/royalur/__init__.py b/royalur/__init__.py index 41c742c..add4997 100644 --- a/royalur/__init__.py +++ b/royalur/__init__.py @@ -4,21 +4,32 @@ from .model import ( Tile, - PlayerType, PlayerState, - PathPair, PathType, - BoardShape, BoardType, - Piece, Move, Board, - Dice, DiceType, + PlayerType, + PlayerState, + PathPair, + PathType, + BoardShape, + BoardType, + Piece, + Move, + Board, + Dice, + DiceType, GameSettings, GameMetadata, ) from .rules import ( - RuleSet, RuleSetProvider, - SimpleRuleSet, SimpleRuleSetProvider, + RuleSet, + RuleSetProvider, + SimpleRuleSet, + SimpleRuleSetProvider, ) from .game import ( - Game, GameBuilder, + Game, + GameBuilder, ) from .lut import ( - LutReader, Lut, + LutReader, + Lut, + LutAgent, ) diff --git a/royalur/lut/__init__.py b/royalur/lut/__init__.py index 9387709..fe85dc3 100644 --- a/royalur/lut/__init__.py +++ b/royalur/lut/__init__.py @@ -2,3 +2,7 @@ LutReader, Lut, ) + +from .lut_player import ( + LutAgent, +) diff --git a/royalur/lut/board_encoder.py b/royalur/lut/board_encoder.py index 0cbe673..990b177 100644 --- a/royalur/lut/board_encoder.py +++ b/royalur/lut/board_encoder.py @@ -11,8 +11,7 @@ def __init__(self): bits = 1 while max_compressed > (1 << bits): bits += 1 - if bits != 13: - raise RuntimeError("Expected the middle lane to take 13 bits") + assert bits == 13, f"Expected the middle lane to take 13 bits, got {bits}" def generate_middle_lane_compression(self) -> List[int]: middle_lane_compression = [-1] * 0xFFFF @@ -57,8 +56,7 @@ def encode_middle_lane(self, board): state |= occupant << (2 * index) compressed = self.middle_lane_compression[state] - if compressed == -1: - raise ValueError("Illegal board state!") + assert compressed != -1, f"Failed to compress middle lane state {state}" return compressed