DarshanScripts commited on
Commit
a2faa84
·
verified ·
1 Parent(s): 6922b66

Upload stratego\web\config\game_config.py with huggingface_hub

Browse files
stratego//web//config//game_config.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Game configuration constants for web UI"""
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Dict, Tuple
5
+
6
+ # Game mode definitions (MVP: Standard only, Duel/Custom in Phase 2)
7
+ GAME_MODES = {
8
+ "Standard (10x10)": {
9
+ "env_id": "Stratego-v0",
10
+ "size": 10,
11
+ "display_name": "Standard"
12
+ }
13
+ }
14
+
15
+ # Default AI models (Ollama only for MVP)
16
+ DEFAULT_MODELS = {
17
+ "Ollama": {
18
+ "mistral:7b": "mistral:7b",
19
+ "gemma3:1b": "gemma3:1b",
20
+ "phi3:3.8b": "phi3:3.8b",
21
+ }
22
+ }
23
+
24
+ # Prompt presets
25
+ PROMPT_PRESETS = ["base", "concise", "adaptive"]
26
+
27
+ # Default prompt
28
+ DEFAULT_PROMPT = "base"
29
+
30
+ # Default agent backend (Ollama for MVP)
31
+ DEFAULT_AGENT_BACKEND = "ollama"
32
+
33
+ # Default model for new games
34
+ DEFAULT_MODEL = "mistral:7b"
35
+
36
+ # Game UI settings
37
+ BOARD_REFRESH_INTERVAL = 0.1 # seconds
38
+ DEFAULT_GAME_TIMEOUT = 300 # 5 minutes per move
39
+ MAX_MOVE_HISTORY_DISPLAY = 10 # Show last N moves
40
+
41
+ # Piece representations in board (ASCII only for compatibility)
42
+ PIECE_DISPLAY = {
43
+ "fl": "F", # Flag
44
+ "bm": "B", # Bomb
45
+ "ms": "M", # Marshal
46
+ "gn": "G", # General
47
+ "mn": "N", # Miner
48
+ "sc": "S", # Scout
49
+ "sp": "P", # Spy
50
+ "sr": "R", # Sergeant
51
+ "lt": "L", # Lieutenant
52
+ "cp": "C", # Captain
53
+ "mx": "X", # Unknown enemy
54
+ ".": ".", # Empty
55
+ "~": "~", # Lake
56
+ }
57
+
58
+
59
+ def get_game_config(mode_name: str) -> Dict:
60
+ """Get game configuration by mode name"""
61
+ return GAME_MODES.get(mode_name, GAME_MODES["Standard (10x10)"])
62
+
63
+
64
+ def get_env_id(mode_name: str) -> str:
65
+ """Get environment ID from mode name"""
66
+ config = get_game_config(mode_name)
67
+ return config["env_id"]
68
+
69
+
70
+ def get_board_size(mode_name: str) -> int:
71
+ """Get board size from mode name"""
72
+ config = get_game_config(mode_name)
73
+ return config["size"]
74
+
75
+
76
+ def get_available_models(backend: str = DEFAULT_AGENT_BACKEND) -> list:
77
+ """Get available models for selected backend (Ollama only for MVP)"""
78
+ if backend == "ollama":
79
+ return list(DEFAULT_MODELS["Ollama"].keys())
80
+ return []
81
+
82
+
83
+ def format_piece_for_display(piece_code: str) -> str:
84
+ """Convert piece code to display emoji"""
85
+ return PIECE_DISPLAY.get(piece_code, piece_code)