Skip to content

Conversation

@konard
Copy link
Owner

@konard konard commented Oct 17, 2025

🎮 2-4-6 Game Implementation

This pull request implements an interactive 2-4-6 puzzle game that can be played via VK private messages.

📋 Issue Reference

Fixes #26

✨ Features

Game Mechanics:

  • 🎯 Interactive logic puzzle that teaches inductive reasoning
  • 🧠 Helps users understand confirmation bias
  • 🔢 Players test number triples to discover a hidden rule
  • 💡 The secret rule: numbers must be in ascending order (a < b < c)

Gameplay:

  1. Start the game with commands: играть 246, play, сыграем, игра, let's play
  2. Bot confirms the triple 2, 4, 6 follows the hidden rule
  3. Players propose their own triples (e.g., 8 10 12, 1 2 3, -1 121 130.5)
  4. Bot validates each triple and provides feedback with ✅ or ❌
  5. When confident, players submit their rule guess
  6. Limited to one rule guess per day to encourage thoughtful testing

Bilingual Support:

  • Full Russian and English language support
  • Natural language processing for game commands
  • Localized responses and feedback

🛠️ Technical Implementation

Three specialized triggers:

  1. startGameTrigger - Initializes new game sessions and stores state
  2. handleTripleGuessTrigger - Validates number triples against the rule
  3. handleRuleGuessTrigger - Evaluates rule guesses with rate limiting

State Management:

  • Game state tracked per user in peer state object
  • Stores guess history, timestamps, and active game status
  • Prevents multiple rule guesses within 24 hours

Testing:

  • ✅ Comprehensive Jest test suite in __tests__/triggers/two-four-six-game.js
  • ✅ Experiment script for manual testing in experiments/test-two-four-six-game.js
  • ✅ All regex patterns and game logic validated

📁 Files Changed

  • triggers/two-four-six-game.js - Main game implementation with three triggers
  • index.js - Enabled game triggers in main bot loop
  • __tests__/triggers/two-four-six-game.js - Jest test suite
  • experiments/test-two-four-six-game.js - Manual testing script

🎯 Example Game Flow

User: играть 246
Bot: Давайте сыграем в игру 2-4-6! 🎮

Правила:
• Я загадал правило для троек чисел
• Тройка 2, 4, 6 подходит под это правило
• Предлагайте свои тройки чисел, я скажу, подходят ли они
• Когда будете уверены, что знаете правило — напишите его
• У вас есть одна попытка угадать правило в день

Предложите первую тройку чисел!

User: 8 10 12
Bot: ✅ Да! Тройка 8, 10, 12 подходит под правило.
Продолжайте предлагать тройки или попробуйте угадать правило!

User: 10 8 6
Bot: ❌ Нет. Тройка 10, 8, 6 не подходит под правило.
Продолжайте предлагать тройки или попробуйте угадать правило!

User: правило: числа в порядке возрастания
Bot: 🎉 Поздравляю! Вы угадали правило!

✨ Правило: числа должны идти в возрастающем порядке (a < b < c)
...

📚 Educational Value

The 2-4-6 game is a classic cognitive psychology experiment that demonstrates:

  • Confirmation bias - tendency to seek information confirming existing beliefs
  • Inductive reasoning - drawing general conclusions from specific examples
  • Scientific method - importance of testing falsifiable hypotheses

Players often assume the rule is "even numbers increasing by 2" and only test confirming examples. The game teaches the value of testing examples that might disprove your hypothesis.


🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 17, 2025
Implements an interactive 2-4-6 puzzle game that can be played via VK private messages. The game teaches inductive reasoning and helps users understand confirmation bias.

Game Features:
- Start game with commands like "играть 246", "play", "сыграем"
- Test number triples to discover the hidden rule
- Submit rule guesses (limited to one per day)
- Bilingual support (Russian and English)
- The rule: numbers must be in ascending order (a < b < c)

Implementation:
- Three triggers handle different game phases:
  1. startGameTrigger: Initializes new game sessions
  2. handleTripleGuessTrigger: Validates number triples
  3. handleRuleGuessTrigger: Evaluates rule guesses
- Game state tracked per user in peer state object
- Comprehensive test coverage with Jest
- Experiment script for manual testing

Fixes #26

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Support 2 4 6 game playing via private messages Support 2-4-6 game playing via private messages Oct 17, 2025
@konard konard marked this pull request as ready for review October 17, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support 2 4 6 game playing via private messages

1 participant