Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <padraiglamont@gmail.com>"]
license = "MIT License"
Expand All @@ -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]
Expand Down
29 changes: 20 additions & 9 deletions royalur/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
4 changes: 4 additions & 0 deletions royalur/lut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
LutReader,
Lut,
)

from .lut_player import (
LutAgent,
)
6 changes: 2 additions & 4 deletions royalur/lut/board_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down