Surn commited on
Commit
f6d7e8a
·
1 Parent(s): 5f8a848

- fix guess bug - allowing guesses only after word guessed or letter revealed

Files changed (3) hide show
  1. README.md +3 -192
  2. wrdler/__init__.py +1 -1
  3. wrdler/ui.py +5 -4
README.md CHANGED
@@ -178,6 +178,9 @@ All test files must be placed in the `/tests` folder. This ensures a clean proje
178
 
179
  ## Changelog
180
 
 
 
 
181
  ### v0.0.2 (Current - All Sprints Complete) 🎉
182
  - **Sprint 1-3:** Core data models, generator refactor, radar removal
183
  - **Sprint 4:** Implemented free letter selection UI with circular green gradient buttons
@@ -198,201 +201,9 @@ All test files must be placed in the `/tests` folder. This ensures a clean proje
198
  - Core data models updated for rectangular grid
199
  - Generator refactored for horizontal-only placement
200
 
201
- ### v0.3.0 (planned - post-launch)
202
- - Local persistent storage for personal game history (offline-capable)
203
- - Personal high scores sidebar with filtering
204
- - Player statistics tracking (games played, averages, bests)
205
-
206
- ### Previous BattleWords Versions (v0.2.x - before Wrdler fork)
207
-
208
- -0.2.29
209
- - change difficulty calculation
210
- - add test_compare_difficulty_functions
211
- - streamlit version update to 1.51.0
212
-
213
- -0.2.28
214
- - PWA INSTALL_GUIDE.md added
215
- - PWA implementation with service worker and manifest.json added
216
-
217
- -0.2.27
218
- - Add "Show Challenge Share Links" setting (default: off)
219
- - When disabled:
220
- - Header Challenge Mode: hides the Share Challenge link
221
- - Game Over: allows submitting results but suppresses displaying the generated share URL
222
- - The setting is saved in session state and preserved across "New Game"
223
- - No changes to game logic or storage; only UI visibility behavior
224
-
225
- -0.2.26
226
- - fix copy/share link button
227
-
228
- -0.2.25
229
- - Share challenge from expander
230
- - fix incorrect guess overlap of guess box
231
-
232
- -0.2.24
233
- - compress height
234
- - change incorrect guess tooltip location
235
- - update final screen layout
236
- - add word difficulty formula
237
- - update documentation
238
-
239
- -0.2.23
240
- - Update miss and correct guess sound effects to new versions
241
- - allow iframe hosted version to pass url as a query string parameter (&iframe_host=https%3A%2F%2Fwww.battlewords.com%2Fplaynow.html) url encoding is required.
242
- - minimal security added to prevent users from changing the options in a challenge.
243
-
244
- -0.2.22
245
- - fix challenge mode link
246
- - challenge mode UI improvements
247
-
248
- -0.2.21
249
- - fix tests
250
-
251
- -0.2.20
252
- - Remote Storage game_id:
253
- - Per-game JSON settings uploaded to a storage server (Hugging Face repo) under unique `games/{uid}/settings.json`
254
- - A shortened URL id (sid) is generated; shareable link: `?game_id=<sid>`
255
- - On load with `game_id`, the app resolves sid to the JSON and applies word_list, game_mode, grid_size, puzzle options
256
- - High Scores: add remote `highscores/highscores.json` (repo) alongside local highscores
257
- - Dependencies: add `huggingface_hub` and `python-dotenv`
258
- - Env: `.env` should include `HF_API_TOKEN` (or `HF_TOKEN`), `CRYPTO_PK`, `HF_REPO_ID`, `SPACE_NAME`
259
-
260
- ### Environment Variables
261
- - HF_API_TOKEN or HF_TOKEN: HF Hub access token
262
- - CRYPTO_PK: reserved for signing (optional)
263
- - HF_REPO_ID: e.g., Surn/Storage
264
- - SPACE_NAME: e.g., Surn/BattleWords
265
-
266
- ### Remote Storage Structure
267
- - shortener.json
268
- - games/{uid}/settings.json
269
- - highscores/highscores.json
270
-
271
  Note
272
  - `battlewords/storage.py` remains local-only storage; a separate HF integration wrapper is provided as `game_storage.py` for remote challenge mode.
273
 
274
- -0.2.19
275
- - Fix music and sound effect volume issues
276
- - Update documentation for proposed new features
277
-
278
- -0.2.18
279
- - Fix sound effect volume wiring and apply volume to all effects (hit/miss/correct/incorrect)
280
- - Respect "Enable music" and "Volume" when playing congratulations music and when resuming background music (uses selected track)
281
- - Add "Enable Sound Effects" checkbox (on by default) and honor it across the app
282
- - Save generated effects to `assets/audio/effects/` so they are picked up by the app
283
- - Add `requests` dependency for sound effect generation
284
-
285
- -0.2.17
286
- - documentation updates and corrections
287
- - updated CLAUDE.md with accurate feature status and project structure
288
- - clarified v0.3.0 planned features vs current implementation
289
-
290
- -0.2.16
291
- - replace question marks in score panel with underscores
292
- - add option to toggle incorrect guess history display in settings (enabled by default)
293
- - game over popup updated to ensure it is fully visible on screen
294
-
295
- -0.2.15
296
- - fix music playing after game end
297
- - change incorrect guesses icon
298
- - fix sound effect and music volume issues
299
-
300
- -0.2.14
301
- - bug fix on final score popup
302
- - score panel alignment centered
303
- - change incorrect guess history UI
304
-
305
- -0.2.13
306
- - upgrade background ocean view
307
- - apply volume control to sound effects
308
-
309
- -0.2.12
310
- - fix music looping on congratulations screen
311
-
312
- -0.2.11
313
- - update timer to be live during gameplay, but reset with each action
314
- - compact design
315
- - remove fullscreen image tooltip
316
-
317
- -0.2.10
318
- - reduce sonar graphic size
319
- - update music and special effects file locations
320
- - remove some music and sound effects
321
- - change Guess Text input color
322
- - incorrect guess UI update
323
- - scoreboard update
324
-
325
- -0.2.9
326
- - fix sonar grid alignment issue on some browsers
327
- - When all letters of a word are revealed, it is automatically marked as found.
328
-
329
- -0.2.8
330
- - Add10 incorrect guess limit per game
331
-
332
- -0.2.7
333
- - fix background music playback issue on some browsers
334
- - add sound effects
335
- - enhance sonar grid visualization
336
- - add claude.md documentation
337
-
338
- -0.2.6
339
- - fix sonar grid alignment
340
- - improve score summary layout and styling
341
- - Add timer to game display in sidebar
342
-
343
- -0.2.5
344
- - fix finale pop up issue
345
- - make grid cells square on wider devices
346
-
347
- -0.2.4
348
- - Add music files to repo
349
- - disable music by default
350
-
351
- -0.2.3
352
- - Update version information display
353
- - adjust sonar grid alignment
354
- - fix settings scroll issue
355
-
356
- -0.2.2
357
- - Add Musical background and settings to toggle sound on/off.
358
-
359
- -0.2.1
360
- - Add Theme toggle (light/dark/custom) in sidebar.
361
-
362
- -0.2.0
363
- - Added a loading screen when starting a new game.
364
- - Added a congratulations screen with your final score and tier when the game ends.
365
-
366
- -0.1.13
367
- - Improved score summary layout for clarity and style.
368
-
369
- -0.1.12
370
- - Improved score summary layout and styling.
371
- - Enhanced overall appearance and readability.
372
-
373
- -0.1.11
374
- - Game now ends when all words are found or revealed.
375
- - Added word spacing logic and improved settings.
376
-
377
- -0.1.10
378
- - Added game mode selector and improved UI feedback.
379
-
380
- -0.1.9
381
- - Improved background and mobile layout.
382
-
383
- -0.1.8
384
- - Updated to Python3.12.
385
-
386
- -0.1.5
387
- - Added hit/miss indicator and improved grid feedback.
388
-
389
- -0.1.4
390
- - Radar visualization improved and mobile layout enhanced.
391
-
392
- -0.1.3
393
- - Added wordlist picker and sort feature.
394
- - Improved score panel and final score display.
395
-
396
  ## Known Issues / TODO
397
 
398
  - Word list loading bug: the app may not select the proper word lists in some environments. Investigate `word_loader.get_wordlist_files()` / `load_word_list()` and sidebar selection persistence to ensure the chosen file is correctly used by the generator.
 
178
 
179
  ## Changelog
180
 
181
+ ### v0.0.7
182
+ - fix guess bug - allowing guesses only after word guessed or letter revealed
183
+
184
  ### v0.0.2 (Current - All Sprints Complete) 🎉
185
  - **Sprint 1-3:** Core data models, generator refactor, radar removal
186
  - **Sprint 4:** Implemented free letter selection UI with circular green gradient buttons
 
201
  - Core data models updated for rectangular grid
202
  - Generator refactored for horizontal-only placement
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  Note
205
  - `battlewords/storage.py` remains local-only storage; a separate HF integration wrapper is provided as `game_storage.py` for remote challenge mode.
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  ## Known Issues / TODO
208
 
209
  - Word list loading bug: the app may not select the proper word lists in some environments. Investigate `word_loader.get_wordlist_files()` / `load_word_list()` and sidebar selection persistence to ensure the chosen file is correctly used by the generator.
wrdler/__init__.py CHANGED
@@ -8,5 +8,5 @@ Key differences from BattleWords:
8
  - 2 free letter guesses at game start
9
  """
10
 
11
- __version__ = "0.0.6"
12
  __all__ = ["models", "generator", "logic", "ui", "word_loader"]
 
8
  - 2 free letter guesses at game start
9
  """
10
 
11
+ __version__ = "0.0.7"
12
  __all__ = ["models", "generator", "logic", "ui", "word_loader"]
wrdler/ui.py CHANGED
@@ -1167,14 +1167,15 @@ def _render_grid(state: GameState, letter_map, show_grid_ticks: bool = True):
1167
  reveal_cell(state, letter_map, clicked)
1168
  # Auto-mark and award base points for any fully revealed words
1169
  if auto_mark_completed_words(state):
1170
- # Note: letter_map is static and built once in _init_session(), no need to rebuild
1171
  _sync_back(state)
1172
 
1173
- # Allow guessing after any letter is revealed
1174
- st.session_state.can_guess = True
 
 
 
1175
 
1176
  # Play sound effect based on hit or miss
1177
- action = (state.last_action or "").strip()
1178
  if action.startswith("Revealed '"):
1179
  play_sound_effect("hit", volume=(st.session_state.get("effects_volume", 50) / 100))
1180
  elif action.startswith("Revealed empty"):
 
1167
  reveal_cell(state, letter_map, clicked)
1168
  # Auto-mark and award base points for any fully revealed words
1169
  if auto_mark_completed_words(state):
 
1170
  _sync_back(state)
1171
 
1172
+ # Only allow guessing if a letter was revealed or after a correct guess
1173
+ action = (state.last_action or "").strip()
1174
+ if action.startswith("Revealed '"):
1175
+ st.session_state.can_guess = True
1176
+ # Do NOT set can_guess to True for empty cell reveals
1177
 
1178
  # Play sound effect based on hit or miss
 
1179
  if action.startswith("Revealed '"):
1180
  play_sound_effect("hit", volume=(st.session_state.get("effects_volume", 50) / 100))
1181
  elif action.startswith("Revealed empty"):