Commit graph

88 commits

Author SHA1 Message Date
07a620a389 Fix activity15 coin usage and duplicate messages
- Remove duplicate messages from section transitions like activity14
- Fix coin categorization issue - 'use coin' was being misclassified as 'use_key_and_password'
- Add section_4:step_2 for post-safe-opening state with proper coin slot options
- Update tokens_for_ai to properly distinguish between different user actions
- Now players can properly access the secret compartment using the coin
- Activity validated and passes all checks
2025-08-11 18:35:46 -04:00
e3d33b90fd Simplify battleship prompts to let AI imagine destruction details
Remove prescriptive ship destruction descriptions and let the AI be creative.
Since skip_condition ensures these prompts only run when ships are actually
destroyed, we can make the prompts more concise and focused on the outcome.
2025-08-11 17:16:06 -04:00
fca7addaa5 Fix battleship AI hallucination bug with skip_condition system
Add skip_condition logic to feedback prompts to prevent AI from generating
false ship destruction messages when no ships were actually destroyed.

Changes:
- Add skip_condition parameter support in provide_feedback_prompts()
- Support all_null, all_false, and all_true condition types
- Apply skip_condition to battleship Ship Status and Game Over prompts
- Add comprehensive unit tests covering all skip condition scenarios
- Test real battleship scenario that was causing hallucinations

This prevents the AI from creating false positive ship destruction messages
when metadata indicates no ships were actually sunk (all null values).
2025-08-11 17:04:17 -04:00
98b0ebab24 Fix duplicate exit messages in battleship
- Removed feedback_tokens_for_ai from step 3 Game Over
- Exit transition already has appropriate content_blocks
- Eliminates duplicate farewell messages when exiting
2025-08-11 13:14:07 -04:00
f90df2ae57 modified: activity_yaml_validator.py
modified:   app.py
	modified:   research/activity29-battleship.yaml
	modified:   research/activity29-testship.yaml
	modified:   research/guarded_ai.py
	modified:   tests/functional/test_activity_flows.py
	modified:   tests/functional/test_battleship_pre_script.py
	modified:   tests/functional/test_guarded_ai.py
	modified:   tests/unit/test_activity_yaml_validator.py
	modified:   tests/unit/test_app_feedback.py
	modified:   tests/unit/test_guarded_ai.py
2025-08-11 12:39:42 -04:00
d4d697db59 Implement per-prompt metadata filtering and fix battleship feedback system
Major improvements to battleship game feedback accuracy and user experience:

## New Multi-Prompt Feedback System
- Replaced single feedback with 3 specialized prompts: Shot Report, Ship Status, Game Over
- Each prompt has individual metadata filtering to see only relevant data
- Shot Report only sees hit/miss data, Ship Status only sees ship destruction data
- Added STFU token system to suppress empty messages (filtered out automatically)

## Technical Implementation
- Added per-prompt metadata_filter support in YAML structure
- Updated app.py and guarded_ai.py to handle prompt-specific filtering
- Legacy single-prompt system still works with transition-level filtering
- Added comprehensive test suite for feedback system validation

## User Experience Fixes
- Fixed TTS queue blocking JavaScript execution (async promises instead of await)
- Ship Status now correctly reports who destroyed which ship (role confusion fixed)
- Game Over only appears when game actually ends (no more random messages)
- Maintained dramatic storytelling while ensuring factual accuracy

## Battleship-Specific Improvements
- Ship destruction messages only appear when ships actually sink
- Clear separation of concerns: hits/misses vs ship destruction vs game over
- Eliminated false positive ship destruction reports
- Fixed role reversal where wrong player got credit for destruction

The battleship narrator now provides accurate, contextual feedback while preserving the dramatic naval warfare atmosphere.
2025-08-11 11:39:49 -04:00
e28dc11f04 Improve user experience with battleship feedback and auto-play TTS
- Fix battleship feedback perspective confusion with better Hermes prompting
- Add auto-play TTS button with localStorage persistence and queueing system
- Move activity controls below model/voice selectors in sidebar
- Add activity controls to mobile hamburger menu
- Fix model/activity dropdowns to stay within container bounds
- Filter activities API to only show .yaml/.yml files
- Clean up system message labels by moving to usernames (System (Feedback), System (Question))
- Apply black formatting to app.py
2025-08-11 09:34:29 -04:00
1b44c2d66b Integrate comprehensive testing framework with Makefile
- Added unit tests for YAML loading and parsing functionality
- Created integration tests for multiple activity files validation
- Implemented functional tests for complete activity workflows
- Added battleship pre_script functionality tests
- Integrated all test types into comprehensive Makefile
- Fixed CLI validator test with proper failing fixture
- Applied black formatting to all Python files
- Removed problematic hardcoded targets from Makefile
- Added proper venv dependency management

Test coverage includes:
- Unit: YAML loading, validator functionality
- Integration: Cross-file validation, metadata operations
- Functional: End-to-end activity flows, pre_script execution
- All 30 activity files validated and tested
2025-08-10 19:38:50 -04:00
51b74be7d9 Fix YAML validator and activity file validation errors
- Updated validator terminal step detection to only flag truly terminal steps
- Fixed validator to accept integers and booleans in buckets (as supported by app.py)
- Fixed metadata_remove format in activity17 from dictionary to list of strings
- Added proper terminal section to activity3.yaml without questions/buckets
- Fixed missing restart transition and bucket in activity28
- Removed unused game_end transitions from battleship files
- Updated exit transitions to go directly to step_4 (goodbye step)
- Applied black formatting to validator code

All 30 activity YAML files now validate successfully with 0 errors and 0 warnings.
2025-08-10 19:38:50 -04:00
1ca6f67c3d Fix code quality issues from PR review
- Add matplotlib.use("Agg") backend configuration to prevent runtime errors in headless environments
- Add error handling guards for script results that might return None
- Fix AI targeting logic to exclude already-fired cells in super hunter and hunter modes
- Update CLAUDE.md with matplotlib best practices
2025-08-10 16:01:58 -04:00
4d909aaecb Fix indentation error from commented print statements
- Add pass statements to empty else blocks that only contained commented prints
- Ensures Python syntax remains valid after commenting out debug statements
2025-08-10 15:19:59 -04:00
29573eaa75 Enhance battleship activity with improved user input handling and feedback
- Add user_response to pre-script metadata for better game state management
- Implement metadata_feedback_filter to control feedback data exposure
- Improve ship destruction announcements and game over messaging
- Add debug logging for ship sinking events
- Include test ship configuration file
2025-08-10 14:49:03 -04:00
368c7d290e Add Hermes Reasoner mode to battleship with game ending fixes
- Add new Hermes Reasoner AI mode that combines probability analysis with LLM reasoning
- Implement pre-script and post-script architecture in app.py for flexible YAML processing
- Fix game ending detection by adding transition override mechanism
- Add probability matrix visualization and strategic move analysis
- Support both legacy processing_script and new pre_script/post_script naming
- Restore full ship complement for complete battleship gameplay
2025-08-10 11:57:22 -04:00
fc53cd3cc5 ● Enhance math plotting activity with secure multi-function support
- Replace unsafe eval() with sympy for secure expression parsing
  - Add YAML anchors to eliminate code duplication in processing scripts
  - Implement multiple function plotting with comma-separated syntax
  - Add dynamic plot ranges based on function characteristics
  - Include automatic function type detection and analysis
  - Streamline activity flow: intro → demo plot → open sandbox
  - Add comprehensive error handling with visual error messages
  - Support enhanced mathematical notation (arcsin, ln, implied multiplication)

	modified:   research/activity24-math-plot.yaml
2025-06-23 23:21:25 -04:00
2a1efd1f90 claude security upgrade
modified:   requirements.txt
	modified:   research/activity24-math-plot.yaml
2025-06-23 22:36:23 -04:00
Russell Ballestrini
8cee47fcc9 modified: research/activity29-battleship.yaml 2025-04-23 16:17:05 -04:00
b257f766f8 Rubric for battleship ending.
modified:   research/activity29-battleship.yaml
2024-09-16 11:59:56 -04:00
9246565407 battleship, super human hunter mode
modified:   research/activity29-battleship.yaml
2024-09-09 07:12:58 -04:00
49cc545a4c Battleship Hunter Mode!
In this mode the AI will switch from random to hunting all the positions
around the latest hit. It's still not as smart as a human but you will
start to feel hunted as the game progresses versus the other game mode.

	modified:   research/activity29-battleship.yaml
2024-09-07 13:18:42 -04:00
6763c0b9d5 tic tac toe
modified:   research/activity27-tic-tac-toe.yaml
2024-09-07 10:12:11 -04:00
930fa66b19 a bit better battleship
modified:   research/activity29-battleship.yaml
2024-08-30 09:46:07 -04:00
ba91cbcb27 modified: research/activity27-tic-tac-toe.yaml
new file:   static/images/tic-tac-toe.png
2024-08-29 06:55:40 -04:00
d1998f9d1c move off message to chat_message but it doesn't fix order issue.
The app seems to queue the category, feedback/content_blocks question

The strange part is the set_background happens in the middle of the
script after category but it comes first and FAST! In about a second
while the other messages take about 4 secs to finally arrive.

	modified:   app.py
	modified:   research/activity29-battleship.yaml
	modified:   templates/chat.html
2024-08-28 07:15:18 -04:00
0170327483 battleship
new file:   research/activity29-battleship.yaml
2024-08-25 15:40:33 -04:00
41dff2865a Easy way to restart an activity without quitting.
modified:   app.py
	modified:   research/activity27-tic-tac-toe.yaml
	modified:   research/activity28-killer-squares.yaml
2024-08-25 10:05:57 -04:00
ba37cb448c new file: research/activity28-killer-squares.yaml 2024-08-24 20:11:03 -04:00
db983f6d4b mathplotlib tic tac toe board.
modified:   research/activity27-tic-tac-toe.yaml
2024-08-24 16:15:05 -04:00
df54e6b4aa conditionally run processing_script
modified:   app.py
	modified:   research/activity22-odds-or-evens.yaml
	modified:   research/activity24-math-plot.yaml
	modified:   research/activity27-tic-tac-toe.yaml
	modified:   research/guarded_ai.py
2024-08-24 14:31:46 -04:00
691e4ab054 working tic tac toe
modified:   app.py
	modified:   research/activity27-tic-tac-toe.yaml
2024-08-24 13:38:38 -04:00
e95a150f3a modified: research/activity26-magic-8-ball.yaml 2024-08-24 09:21:51 -04:00
863cec2e86 modified: app.py
new file:   research/activity26-magic-8-ball.yaml
2024-08-21 08:06:56 -04:00
1095df37e1 modified: app.py
new file:   research/activity25-20-questions.yaml
2024-08-20 17:38:48 -04:00
3e183da802 modified: research/activity24-math-plot.yaml 2024-08-14 08:10:05 -04:00
c7086f6ee9 plot even more lines like sin(x)
modified:   research/activity24-math-plot.yaml
2024-08-11 18:24:16 -04:00
dc03ce9d5e math plotting!!! try out these equations:
( x^2 - 4x + 3 )
    ( x^2 - 2x + 1 )
    ( 2^x - 1 )

	modified:   app.py
	modified:   requirements.txt
	new file:   research/activity24-math-plot.yaml
2024-08-11 17:03:03 -04:00
5c9ef230ae modified: app.py
modified:   research/activity23-math.yaml
2024-08-11 13:39:30 -04:00
f09d24aefc make math progressively more difficult.
modified:   ../app.py
	modified:   activity23-math.yaml
2024-08-11 11:27:32 -04:00
7ac9c4583c new file: activity23-math.yaml 2024-08-11 09:44:15 -04:00
14dd105d03 woot upgraded guarded to support odds-or-evens game.
modified:   ../app.py
	new file:   activity22-odds-or-evens.yaml
	modified:   guarded_ai.py
2024-08-11 08:43:47 -04:00
be61486f38 modified: research/activity19-rock-paper-scissors.yaml 2024-08-10 19:23:14 -04:00
f923570f5a prompt engineering
modified:   app.py
	modified:   research/activity19-rock-paper-scissors.yaml
2024-08-10 19:15:19 -04:00
2609ff993d limited_effort should not be treated as correct.
modified:   app.py
	modified:   research/guarded_ai.py
2024-08-10 17:23:04 -04:00
f5df195e9b black and also set_language isn't "correct" anymore.
so it doesn't move the student on.

	modified:   app.py
	modified:   migrations/env.py
	modified:   migrations/versions/190d5ef26e20_add_token_count_to_message.py
	modified:   migrations/versions/a9e886c56482_create_room_table.py
	modified:   migrations/versions/d737de68d6fa_add_metadata_field_to_activitystate.py
	modified:   research/activity21.yaml
	modified:   research/guarded_ai.py
2024-08-10 17:00:52 -04:00
5f4cf76372 modified: activity21.yaml 2024-08-10 16:07:23 -04:00
3a6c62cf22 hopefully we get some python examples
modified:   ../app.py
	modified:   activity21.yaml
2024-08-10 15:55:46 -04:00
9a4f2a8b30 violent python activity21.yaml
modified:   ../app.py
	new file:   activity21.yaml
2024-08-10 15:42:31 -04:00
058b0161df allow increment to go backward with n-1 and also support any int c for the
increment or decrement.

	modified:   ../app.py
	modified:   guarded_ai.py
2024-08-10 15:00:28 -04:00
e3d3bf0303 n+1 in yaml to accumulate integers.
modified:   ../app.py
	new file:   activity20-n-plus-1.yaml
	modified:   guarded_ai.py
2024-08-10 14:39:37 -04:00
87faba6379 modified: guarded_ai.py 2024-08-10 13:40:22 -04:00
4f7caffe17 guarded_ai.py can also play rock-paper-scissors.yaml 2024-08-10 13:36:31 -04:00