Set scopa targets to their traditional defaults
CI / Build and push docker image (push) Successful in 2m6s
CI / Build and push docker image (push) Successful in 2m6s
Partnership games go to 21: scopone scientifico (the tournament target) and scopa a quattro, while two-player scopa keeps its usual 11. The scopa package resolves the default from the player count and exposes a per variant options_schema default, so the lobby creation form shows the right value without frontend changes.
This commit is contained in:
@@ -21,8 +21,6 @@ from tavolo.scopa.state import (
|
||||
ScopaState,
|
||||
)
|
||||
|
||||
ENGINES = (ScopaEngine, ScopaQuattroEngine)
|
||||
|
||||
|
||||
def _session(engine, **options) -> GameSession:
|
||||
session = GameSession(
|
||||
@@ -66,14 +64,26 @@ def _drive_to_end(engine, session: GameSession) -> None:
|
||||
|
||||
class CreateTest(unittest.TestCase):
|
||||
def test_create_seats_creator_on_side_a(self) -> None:
|
||||
for engine_type in ENGINES:
|
||||
for engine_type, target in ((ScopaEngine, 11), (ScopaQuattroEngine, 21)):
|
||||
engine = engine_type()
|
||||
session = _session(engine)
|
||||
self.assertEqual("A", session.players[0].team)
|
||||
self.assertIsInstance(session.state, ScopaState)
|
||||
self.assertEqual(11, session.state.target_score)
|
||||
# Two-player scopa is played to 11, the partnership game to 21.
|
||||
self.assertEqual(target, session.state.target_score)
|
||||
self.assertFalse(session.state.asso_pigliatutto)
|
||||
|
||||
def test_schema_defaults_follow_the_variant(self) -> None:
|
||||
self.assertEqual(
|
||||
11, ScopaEngine().options_schema["properties"]["target_score"]["default"]
|
||||
)
|
||||
self.assertEqual(
|
||||
21,
|
||||
ScopaQuattroEngine().options_schema["properties"]["target_score"][
|
||||
"default"
|
||||
],
|
||||
)
|
||||
|
||||
def test_create_options(self) -> None:
|
||||
engine = ScopaEngine()
|
||||
session = _session(engine, target_score=21, asso_pigliatutto=True)
|
||||
|
||||
Reference in New Issue
Block a user