Spaces:
Sleeping
Sleeping
improve ux
Browse files
app.py
CHANGED
|
@@ -126,12 +126,17 @@ CUSTOM_CSS = """
|
|
| 126 |
}
|
| 127 |
|
| 128 |
.history-panel {
|
| 129 |
-
background: rgba(0, 0, 0, 0.
|
| 130 |
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 131 |
border-radius: 8px !important;
|
| 132 |
padding: 15px !important;
|
| 133 |
max-height: 200px !important;
|
| 134 |
overflow-y: auto !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
}
|
| 136 |
|
| 137 |
.action-btn {
|
|
@@ -154,15 +159,19 @@ CUSTOM_CSS = """
|
|
| 154 |
}
|
| 155 |
|
| 156 |
.status-text {
|
| 157 |
-
color: #
|
| 158 |
font-size: 1.1em !important;
|
| 159 |
line-height: 1.6 !important;
|
| 160 |
padding: 10px !important;
|
| 161 |
-
background: rgba(0, 0, 0, 0.
|
| 162 |
border-radius: 8px !important;
|
| 163 |
margin-top: 10px !important;
|
| 164 |
}
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
.game-over-text {
|
| 167 |
color: #ffd700 !important;
|
| 168 |
font-size: 1.2em !important;
|
|
@@ -608,7 +617,8 @@ class TinyHanabiGame:
|
|
| 608 |
|
| 609 |
self.info_tokens -= 1
|
| 610 |
positions_str = ", ".join(str(p) for p in matching)
|
| 611 |
-
|
|
|
|
| 612 |
|
| 613 |
def _shift_and_draw(self, player_idx: int, position: int):
|
| 614 |
"""Shift cards left and draw new card."""
|
|
@@ -819,13 +829,13 @@ def format_game_display(game: TinyHanabiGame) -> str:
|
|
| 819 |
def format_history(game: TinyHanabiGame) -> str:
|
| 820 |
"""Format turn history."""
|
| 821 |
if game is None or not game.turn_history:
|
| 822 |
-
return "<p style='color: #
|
| 823 |
|
| 824 |
lines = []
|
| 825 |
for entry in game.turn_history:
|
| 826 |
player = "You" if entry["player"] == 0 else "AI"
|
| 827 |
color = "#ffd700" if entry["player"] == 0 else "#4dabf7"
|
| 828 |
-
lines.append(f'<p style="margin: 5px 0;"><strong style="color: {color};">{player}:</strong> {entry["feedback"]}</p>')
|
| 829 |
|
| 830 |
return "".join(lines)
|
| 831 |
|
|
|
|
| 126 |
}
|
| 127 |
|
| 128 |
.history-panel {
|
| 129 |
+
background: rgba(0, 0, 0, 0.4) !important;
|
| 130 |
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
| 131 |
border-radius: 8px !important;
|
| 132 |
padding: 15px !important;
|
| 133 |
max-height: 200px !important;
|
| 134 |
overflow-y: auto !important;
|
| 135 |
+
color: #ffffff !important;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
.history-panel p {
|
| 139 |
+
color: #ffffff !important;
|
| 140 |
}
|
| 141 |
|
| 142 |
.action-btn {
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
.status-text {
|
| 162 |
+
color: #ffffff !important;
|
| 163 |
font-size: 1.1em !important;
|
| 164 |
line-height: 1.6 !important;
|
| 165 |
padding: 10px !important;
|
| 166 |
+
background: rgba(0, 0, 0, 0.4) !important;
|
| 167 |
border-radius: 8px !important;
|
| 168 |
margin-top: 10px !important;
|
| 169 |
}
|
| 170 |
|
| 171 |
+
.status-text p {
|
| 172 |
+
color: #ffffff !important;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
.game-over-text {
|
| 176 |
color: #ffd700 !important;
|
| 177 |
font-size: 1.2em !important;
|
|
|
|
| 617 |
|
| 618 |
self.info_tokens -= 1
|
| 619 |
positions_str = ", ".join(str(p) for p in matching)
|
| 620 |
+
target_name = "AI" if target == 1 else "you"
|
| 621 |
+
return f"Hinted {target_name}: {hint_type} at position(s) [{positions_str}]"
|
| 622 |
|
| 623 |
def _shift_and_draw(self, player_idx: int, position: int):
|
| 624 |
"""Shift cards left and draw new card."""
|
|
|
|
| 829 |
def format_history(game: TinyHanabiGame) -> str:
|
| 830 |
"""Format turn history."""
|
| 831 |
if game is None or not game.turn_history:
|
| 832 |
+
return "<p style='color: #aaa; font-style: italic;'>No actions yet</p>"
|
| 833 |
|
| 834 |
lines = []
|
| 835 |
for entry in game.turn_history:
|
| 836 |
player = "You" if entry["player"] == 0 else "AI"
|
| 837 |
color = "#ffd700" if entry["player"] == 0 else "#4dabf7"
|
| 838 |
+
lines.append(f'<p style="margin: 5px 0; color: #fff;"><strong style="color: {color};">{player}:</strong> {entry["feedback"]}</p>')
|
| 839 |
|
| 840 |
return "".join(lines)
|
| 841 |
|