first prototype

This commit is contained in:
2026-09-27 09:52:00 +02:00
parent 4635199a41
commit 6d011d474f
109 changed files with 6354 additions and 507 deletions
+26
View File
@@ -0,0 +1,26 @@
# wizard_game
Pure-Python rules engine of Wizard (no dependencies). It is used by the game
server and can be installed on its own to train AI players:
```bash
pip install ./wizard_server/game_logic
```
```python
import random
from wizard_game import WizardGame, GameOptions
game = WizardGame(num_players=4, options=GameOptions(not_equal=True), seed=1)
rng = random.Random(1)
while not game.is_finished:
player = game.current_player
obs = game.observation(player) # what this player may see
action = rng.choice(obs.legal_actions) # Bid / PlayCard / ChooseTrump
events = game.apply(player, action) # TrickCompleted, RoundCompleted, ...
print(game.scores, game.winners())
```
`Observation.to_dict()` / `Observation.from_dict()` and
`action_to_dict()` / `action_from_dict()` define the JSON format that the
server sends to web clients and to the AI service.