클래식 pygame GUI 이식

맥락:
- classic 게임을 사람이 플레이할 수 있도록 레거시 pygame GUI를 가져온다.
- 현재 GUI는 Python backend와 registry bot만 지원하고 Rust backend와 학습 checkpoint 로딩은 제외한다.

변경:
- pygame_pvp.py를 classic 패키지에 이식하고 tier, backend 선택, Deep CFR checkpoint 옵션을 제거했다.
- lost-cities-classic-gui 엔트리포인트와 README 실행 안내를 추가했다.
- GUI argparse smoke 테스트를 추가했다.

확인:
- uv run pre-commit run --all-files
- uv run pytest tests/games/classic
- uv run lost-cities-classic-gui --help
- SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy uv run python - <<'PY'
from coolrl_lost_cities.games.classic.pygame_pvp import LostCitiesGuiApp
app = LostCitiesGuiApp(mode='pvc', bot_name='random', seed=1, width=1024, height=768)
app.draw()
app.pygame.quit()
print('gui init ok')
PY
This commit is contained in:
2026-05-06 20:08:05 +09:00
parent 12b59211b2
commit a6de79d444
4 changed files with 1314 additions and 0 deletions
+9
View File
@@ -27,6 +27,15 @@ For future GUI work, install the optional GUI dependencies:
uv sync --extra gui uv sync --extra gui
``` ```
Run the classic pygame GUI:
```bash
uv run lost-cities-classic-gui --mode pvc --bot safe-heuristic
```
The GUI currently uses the Python backend only. The Rust core remains covered by
parity tests and is not exposed as a GUI backend.
## Basic Usage ## Basic Usage
```python ```python
+1
View File
@@ -19,6 +19,7 @@ gui = [
[project.scripts] [project.scripts]
lost-cities-classic = "coolrl_lost_cities.games.classic:main" lost-cities-classic = "coolrl_lost_cities.games.classic:main"
lost-cities-classic-gui = "coolrl_lost_cities.games.classic.pygame_pvp:main"
[dependency-groups] [dependency-groups]
dev = [ dev = [
File diff suppressed because it is too large Load Diff
+33
View File
@@ -0,0 +1,33 @@
from __future__ import annotations
import pytest
from coolrl_lost_cities.games.classic import pygame_pvp
def test_gui_argparser_accepts_classic_options() -> None:
args = pygame_pvp.build_argparser().parse_args(
[
"--mode",
"pvc",
"--bot",
"safe-heuristic",
"--seed",
"7",
"--width",
"1024",
"--height",
"768",
]
)
assert args.mode == "pvc"
assert args.bot == "safe-heuristic"
assert args.seed == 7
assert args.width == 1024
assert args.height == 768
def test_gui_argparser_rejects_removed_backend_option() -> None:
with pytest.raises(SystemExit):
pygame_pvp.build_argparser().parse_args(["--backend", "rust"])