Spaces:
Running
Running
Documentation Update
Browse files- README.md +36 -2
- battlewords/__init__.py +1 -1
- specs/requirements.md +11 -6
- specs/specs.md +6 -1
README.md
CHANGED
|
@@ -29,12 +29,13 @@ BattleWords is a vocabulary learning game inspired by classic Battleship mechani
|
|
| 29 |
- Reveal grid cells and guess words for points
|
| 30 |
- Scoring tiers: Good (34–37), Great (38–41), Fantastic (42+)
|
| 31 |
- Responsive UI built with Streamlit
|
|
|
|
| 32 |
- Wordlist sidebar controls (picker + one-click sort)
|
| 33 |
- Deterministic seed support (Beta/Full)
|
| 34 |
- Keyboard navigation and guessing (Beta/Full)
|
| 35 |
-
- Overlapping words on shared letters (Beta)
|
| 36 |
- Daily and practice modes (Full)
|
| 37 |
- Leaderboards, persistence, and advanced features (Full)
|
|
|
|
| 38 |
- **Game ends when all words are guessed or all word letters are revealed**
|
| 39 |
|
| 40 |
## Installation
|
|
@@ -67,6 +68,21 @@ or
|
|
| 67 |
streamlit run app.py
|
| 68 |
```
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
## Folder Structure
|
| 71 |
|
| 72 |
- `app.py` – Streamlit entry point
|
|
@@ -89,6 +105,22 @@ streamlit run app.py
|
|
| 89 |
|
| 90 |
## Changelog
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
- 0.1.5
|
| 93 |
- Hit/Miss circular indicator.
|
| 94 |
- Completed words render as non-interactive styled cells.
|
|
@@ -122,7 +154,9 @@ BattlewordsTM. All Rights Reserved. All content, trademarks and logos are copyri
|
|
| 122 |
|
| 123 |
## Hugging Face Spaces Configuration
|
| 124 |
|
| 125 |
-
BattleWords is deployable as a Hugging Face Space.
|
|
|
|
|
|
|
| 126 |
|
| 127 |
```yaml
|
| 128 |
---
|
|
|
|
| 29 |
- Reveal grid cells and guess words for points
|
| 30 |
- Scoring tiers: Good (34–37), Great (38–41), Fantastic (42+)
|
| 31 |
- Responsive UI built with Streamlit
|
| 32 |
+
- Customizable word lists
|
| 33 |
- Wordlist sidebar controls (picker + one-click sort)
|
| 34 |
- Deterministic seed support (Beta/Full)
|
| 35 |
- Keyboard navigation and guessing (Beta/Full)
|
|
|
|
| 36 |
- Daily and practice modes (Full)
|
| 37 |
- Leaderboards, persistence, and advanced features (Full)
|
| 38 |
+
- **Dockerfile-based deployment supported for Hugging Face Spaces and other container platforms**
|
| 39 |
- **Game ends when all words are guessed or all word letters are revealed**
|
| 40 |
|
| 41 |
## Installation
|
|
|
|
| 68 |
streamlit run app.py
|
| 69 |
```
|
| 70 |
|
| 71 |
+
### Dockerfile Deployment (Hugging Face Spaces and more)
|
| 72 |
+
|
| 73 |
+
BattleWords supports containerized deployment using a `Dockerfile`. This is the recommended method for deploying to [Hugging Face Spaces](https://huggingface.co/docs/hub/spaces-sdks-docker) or any Docker-compatible environment.
|
| 74 |
+
|
| 75 |
+
To deploy on Hugging Face Spaces:
|
| 76 |
+
1. Add a `Dockerfile` to your repository root (see [Spaces Dockerfile guide](https://huggingface.co/docs/hub/spaces-sdks-docker)).
|
| 77 |
+
2. Push your code to your Hugging Face Space.
|
| 78 |
+
3. The platform will build and run your app automatically.
|
| 79 |
+
|
| 80 |
+
For local Docker runs:
|
| 81 |
+
```sh
|
| 82 |
+
docker build -t battlewords .
|
| 83 |
+
docker run -p 8501:8501 battlewords
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
## Folder Structure
|
| 87 |
|
| 88 |
- `app.py` – Streamlit entry point
|
|
|
|
| 105 |
|
| 106 |
## Changelog
|
| 107 |
|
| 108 |
+
- 0.1.10
|
| 109 |
+
- Sidebar Game Mode selector: `standard` (allows guess chaining after correct guesses) and `too easy` (no chaining; score panel reveals words list).
|
| 110 |
+
- Replaced Hit/Miss with Correct/Try Again status indicator for guesses.
|
| 111 |
+
- UI polish: animated ocean background; metal-scope styled radar retained with session-cached GIF.
|
| 112 |
+
- Footer shows version info (commit, Python, Streamlit).
|
| 113 |
+
- Word list handling: defaults to `classic.txt` when present; selection persists across new games; sort action rewrites the file and restarts after 5s notice.
|
| 114 |
+
- Documentation updated.
|
| 115 |
+
|
| 116 |
+
- 0.1.9
|
| 117 |
+
- Background naming cleanup and consistency.
|
| 118 |
+
- Version info surfaced in Settings panel.
|
| 119 |
+
- Mobile layout improvements.
|
| 120 |
+
|
| 121 |
+
- 0.1.8
|
| 122 |
+
- Bumped runtime to Python 3.12 (and config/docs updated accordingly).
|
| 123 |
+
|
| 124 |
- 0.1.5
|
| 125 |
- Hit/Miss circular indicator.
|
| 126 |
- Completed words render as non-interactive styled cells.
|
|
|
|
| 154 |
|
| 155 |
## Hugging Face Spaces Configuration
|
| 156 |
|
| 157 |
+
BattleWords is deployable as a Hugging Face Space. You can use either the YAML config block or a Dockerfile for advanced/custom deployments.
|
| 158 |
+
|
| 159 |
+
To configure your Space with the YAML block, add it at the top of your `README.md`:
|
| 160 |
|
| 161 |
```yaml
|
| 162 |
---
|
battlewords/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
__version__ = "0.1.
|
| 2 |
__all__ = ["models", "generator", "logic", "ui"]
|
|
|
|
| 1 |
+
__version__ = "0.1.10"
|
| 2 |
__all__ = ["models", "generator", "logic", "ui"]
|
specs/requirements.md
CHANGED
|
@@ -62,7 +62,7 @@ Acceptance: Types exist and are consumed by generator/logic; simple constructors
|
|
| 62 |
- Streamlit: `st.cache_data` to memoize loading/filtering.
|
| 63 |
- Loader is centralized in `word_loader.py` and used by generator and UI.
|
| 64 |
|
| 65 |
-
Acceptance: Loading function returns lists by length with >=
|
| 66 |
|
| 67 |
3) Puzzle Generation (Placement)
|
| 68 |
- Randomly place 2×4, 2×5, 2×6 letter words on a 12×12 grid.
|
|
@@ -84,7 +84,7 @@ Acceptance: Generator returns a valid `Puzzle` passing validation checks (no col
|
|
| 84 |
- If correct: add base points = word length; bonus points = count of unrevealed cells in that word at guess time; mark all cells of the word as revealed; add to `guessed`.
|
| 85 |
- If incorrect: no points awarded.
|
| 86 |
- After any guess, set `can_guess=False` and require another reveal before next guess.
|
| 87 |
-
- Exception in
|
| 88 |
- Streamlit: `with st.form("guess"):` + `st.text_input("Your guess")` + `st.form_submit_button("OK", disabled=not can_guess)`; after guess, call `st.rerun()`.
|
| 89 |
- End of game when all 6 words are guessed or all word letters are revealed; display summary and tier, then `st.stop()`.
|
| 90 |
|
|
@@ -94,8 +94,8 @@ Acceptance: Unit tests cover scoring, guess gating, and reveal behavior.
|
|
| 94 |
- Layout:
|
| 95 |
- Title and brief instructions via `st.title`, `st.subheader`, `st.markdown`.
|
| 96 |
- Left: 12×12 grid using `st.columns(12)`.
|
| 97 |
-
- Right: Animated radar,
|
| 98 |
-
- Sidebar: New Game, wordlist selectbox, Sort Wordlist action.
|
| 99 |
- Visuals:
|
| 100 |
- Covered vs revealed styles; revealed empty cells use CSS class `empty`.
|
| 101 |
- Completed word cells styled with `bw-cell-complete`; cell tooltips show coordinates.
|
|
@@ -111,9 +111,9 @@ Acceptance: Users can play end-to-end; radar shows exactly 6 pulses; reveal and
|
|
| 111 |
7) Basic Tests
|
| 112 |
- Placement validity (bounds, overlap, counts, no duplicate words).
|
| 113 |
- Scoring logic and bonus calculation.
|
| 114 |
-
- Guess gating (reveal required except chaining after correct guess).
|
| 115 |
|
| 116 |
-
Current Deltas (0.1.3 → 0.1.
|
| 117 |
- 0.1.3
|
| 118 |
- Sidebar wordlist select; sorting persists length-then-alpha ordering; auto new-game after 5s notice.
|
| 119 |
- Score panel improvements; per-word points; final score styling.
|
|
@@ -124,6 +124,11 @@ Current Deltas (0.1.3 → 0.1.5)
|
|
| 124 |
- Hit/Miss indicator derived from `last_action`.
|
| 125 |
- Completed word cells render as non-buttons with tooltips.
|
| 126 |
- Helper functions for scope image and stable letter map rebuild.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
Known Issues / TODO
|
| 129 |
- Word list selection bug: improper list fetched/propagated in some runs.
|
|
|
|
| 62 |
- Streamlit: `st.cache_data` to memoize loading/filtering.
|
| 63 |
- Loader is centralized in `word_loader.py` and used by generator and UI.
|
| 64 |
|
| 65 |
+
Acceptance: Loading function returns lists by length with >= 25 words per length or fallback minimal lists.
|
| 66 |
|
| 67 |
3) Puzzle Generation (Placement)
|
| 68 |
- Randomly place 2×4, 2×5, 2×6 letter words on a 12×12 grid.
|
|
|
|
| 84 |
- If correct: add base points = word length; bonus points = count of unrevealed cells in that word at guess time; mark all cells of the word as revealed; add to `guessed`.
|
| 85 |
- If incorrect: no points awarded.
|
| 86 |
- After any guess, set `can_guess=False` and require another reveal before next guess.
|
| 87 |
+
- Exception: in default mode a correct guess allows chaining (`can_guess=True`); other modes may disable chaining.
|
| 88 |
- Streamlit: `with st.form("guess"):` + `st.text_input("Your guess")` + `st.form_submit_button("OK", disabled=not can_guess)`; after guess, call `st.rerun()`.
|
| 89 |
- End of game when all 6 words are guessed or all word letters are revealed; display summary and tier, then `st.stop()`.
|
| 90 |
|
|
|
|
| 94 |
- Layout:
|
| 95 |
- Title and brief instructions via `st.title`, `st.subheader`, `st.markdown`.
|
| 96 |
- Left: 12×12 grid using `st.columns(12)`.
|
| 97 |
+
- Right: Animated radar, Correct/Try Again indicator, guess form, and score panel.
|
| 98 |
+
- Sidebar: New Game, wordlist selectbox, Sort Wordlist action, Game Mode selector.
|
| 99 |
- Visuals:
|
| 100 |
- Covered vs revealed styles; revealed empty cells use CSS class `empty`.
|
| 101 |
- Completed word cells styled with `bw-cell-complete`; cell tooltips show coordinates.
|
|
|
|
| 111 |
7) Basic Tests
|
| 112 |
- Placement validity (bounds, overlap, counts, no duplicate words).
|
| 113 |
- Scoring logic and bonus calculation.
|
| 114 |
+
- Guess gating (reveal required except chaining after correct guess when enabled).
|
| 115 |
|
| 116 |
+
Current Deltas (0.1.3 → 0.1.10)
|
| 117 |
- 0.1.3
|
| 118 |
- Sidebar wordlist select; sorting persists length-then-alpha ordering; auto new-game after 5s notice.
|
| 119 |
- Score panel improvements; per-word points; final score styling.
|
|
|
|
| 124 |
- Hit/Miss indicator derived from `last_action`.
|
| 125 |
- Completed word cells render as non-buttons with tooltips.
|
| 126 |
- Helper functions for scope image and stable letter map rebuild.
|
| 127 |
+
- 0.1.10
|
| 128 |
+
- Game Mode selector (`standard`, `too easy`); chaining allowed only in `standard`.
|
| 129 |
+
- Guess feedback indicator switched to Correct/Try Again.
|
| 130 |
+
- Version footer shows commit/Python/Streamlit; ocean background effect.
|
| 131 |
+
- Word list default/persistence fixes and sort action persists after delay.
|
| 132 |
|
| 133 |
Known Issues / TODO
|
| 134 |
- Word list selection bug: improper list fetched/propagated in some runs.
|
specs/specs.md
CHANGED
|
@@ -10,7 +10,9 @@ Battlewords is inspired by the classic Battleship game, but uses words instead o
|
|
| 10 |
- Two five-letter words
|
| 11 |
- Two six-letter words
|
| 12 |
- Words are placed horizontally (left-right) or vertically (top-down), not diagonally.
|
|
|
|
| 13 |
- Entry point is `app.py`.
|
|
|
|
| 14 |
|
| 15 |
## Gameplay (Common)
|
| 16 |
- Players click grid squares to reveal letters or empty spaces.
|
|
@@ -20,6 +22,7 @@ Battlewords is inspired by the classic Battleship game, but uses words instead o
|
|
| 20 |
- After revealing a letter, players may guess a word by entering it in a text box.
|
| 21 |
- Guess submission triggers an immediate rerun to reflect results.
|
| 22 |
- Only one guess per letter reveal; must uncover another letter before guessing again.
|
|
|
|
| 23 |
- **The game ends when all six words are guessed or all word letters are revealed.**
|
| 24 |
|
| 25 |
## Scoring
|
|
@@ -55,11 +58,12 @@ Battlewords is inspired by the classic Battleship game, but uses words instead o
|
|
| 55 |
- Radar screen (shows last letter locations); y-axis inverted so (0,0) is top-left
|
| 56 |
- Text box for word guesses
|
| 57 |
- Score display (shows word, base points, bonus points, total score)
|
|
|
|
| 58 |
|
| 59 |
## Word List
|
| 60 |
- External list at `battlewords/words/wordlist.txt`.
|
| 61 |
- Loaded by `battlewords.word_loader.load_word_list()` with caching.
|
| 62 |
-
- Filtered to uppercase A�Z, lengths in {4,5,6}; falls back if <
|
| 63 |
|
| 64 |
## Generator
|
| 65 |
- Centralized word loader.
|
|
@@ -67,6 +71,7 @@ Battlewords is inspired by the classic Battleship game, but uses words instead o
|
|
| 67 |
|
| 68 |
## Entry Point
|
| 69 |
- The Streamlit entry point is `app.py`.
|
|
|
|
| 70 |
|
| 71 |
## Copyright
|
| 72 |
BattlewordsTM. All Rights Reserved. All content, trademarks and logos are copyrighted by the owner.
|
|
|
|
| 10 |
- Two five-letter words
|
| 11 |
- Two six-letter words
|
| 12 |
- Words are placed horizontally (left-right) or vertically (top-down), not diagonally.
|
| 13 |
+
- Words may touch edges or corners but do not overlap unless a future mode allows shared letters.
|
| 14 |
- Entry point is `app.py`.
|
| 15 |
+
- **Supports Dockerfile-based deployment for Hugging Face Spaces and other container platforms.**
|
| 16 |
|
| 17 |
## Gameplay (Common)
|
| 18 |
- Players click grid squares to reveal letters or empty spaces.
|
|
|
|
| 22 |
- After revealing a letter, players may guess a word by entering it in a text box.
|
| 23 |
- Guess submission triggers an immediate rerun to reflect results.
|
| 24 |
- Only one guess per letter reveal; must uncover another letter before guessing again.
|
| 25 |
+
- In the default mode, a correct guess allows chaining an additional guess without another reveal.
|
| 26 |
- **The game ends when all six words are guessed or all word letters are revealed.**
|
| 27 |
|
| 28 |
## Scoring
|
|
|
|
| 58 |
- Radar screen (shows last letter locations); y-axis inverted so (0,0) is top-left
|
| 59 |
- Text box for word guesses
|
| 60 |
- Score display (shows word, base points, bonus points, total score)
|
| 61 |
+
- Guess status indicator (Correct/Try Again)
|
| 62 |
|
| 63 |
## Word List
|
| 64 |
- External list at `battlewords/words/wordlist.txt`.
|
| 65 |
- Loaded by `battlewords.word_loader.load_word_list()` with caching.
|
| 66 |
+
- Filtered to uppercase A�Z, lengths in {4,5,6}; falls back if < 25 per length.
|
| 67 |
|
| 68 |
## Generator
|
| 69 |
- Centralized word loader.
|
|
|
|
| 71 |
|
| 72 |
## Entry Point
|
| 73 |
- The Streamlit entry point is `app.py`.
|
| 74 |
+
- **A `Dockerfile` can be used for containerized deployment (recommended for Hugging Face Spaces).**
|
| 75 |
|
| 76 |
## Copyright
|
| 77 |
BattlewordsTM. All Rights Reserved. All content, trademarks and logos are copyrighted by the owner.
|