Files
coorl-lost-cities/tests/games/classic/test_scoring.py
T
coolguy 7df6e42904 로스트 시티 클래식 코어 이식
맥락:
- 새 레포의 첫 범위를 RL 없는 Lost Cities classic 게임 구현으로 잡았다.
- 기존 tier0-3 실험 축은 제거하고 classic 5-expedition 룰을 기본값으로 둔다.

변경:
- games/classic 아래에 Cython 게임 엔진, env, bots, backend 경계, Rust core와 proto schema를 이식했다.
- setuptools/Cython 빌드 설정과 package data, README, classic port notes를 추가했다.
- 룰, 점수, 마스크, env, canonical state, bot, Rust parity 테스트를 새 경로로 가져왔다.

확인:
- uv run pytest tests/games/classic
- uv run lost-cities-classic
2026-05-06 19:07:46 +09:00

36 lines
1.4 KiB
Python

from coolrl_lost_cities.games.classic.game import Card, LostCitiesConfig, score_expedition
def test_empty_expedition_scores_zero() -> None:
assert score_expedition([], LostCitiesConfig()) == 0
def test_handshake_only_deepens_negative_score() -> None:
config = LostCitiesConfig(n_handshakes=3)
assert score_expedition([Card(0, 0), Card(0, 0)], config) == -60
def test_numbers_only_score() -> None:
config = LostCitiesConfig()
expedition = [Card(0, 1), Card(0, 3), Card(0, 5)]
assert score_expedition(expedition, config) == (2 + 4 + 6 - 20)
def test_two_handshakes_and_three_numbers() -> None:
config = LostCitiesConfig(n_handshakes=3)
expedition = [Card(0, 0), Card(0, 0), Card(0, 1), Card(0, 2), Card(0, 3)]
assert score_expedition(expedition, config) == (2 + 3 + 4 - 20) * 3
def test_bonus_threshold_adds_bonus() -> None:
config = LostCitiesConfig(n_ranks=9, n_handshakes=3, bonus_threshold=4, bonus_amount=20)
expedition = [Card(0, 1), Card(0, 2), Card(0, 3), Card(0, 4)]
assert score_expedition(expedition, config) == (2 + 3 + 4 + 5 - 20) + 20
def test_manual_multi_color_examples() -> None:
config = LostCitiesConfig(n_handshakes=3)
assert score_expedition([Card(1, 0), Card(1, 5)], config) == (6 - 20) * 2
assert score_expedition([Card(2, 4), Card(2, 5)], config) == 5 + 6 - 20
assert score_expedition([Card(0, 0), Card(0, 0), Card(0, 0)], config) == -80