Gameplay Guide

Game Overview

Logic Quest combines education with adventure in a retro cyberpunk setting. You’ll progress through different memory banks of the LOGIC-1 AI system, each teaching core Prolog concepts through interactive puzzles.

Game Structure

Complexity Selection

Before starting any game mode, you’ll select your difficulty level:

  • 🌱 Beginner: Maximum guidance with templates, examples, and always-available hints (1.0x scoring)
  • ⚡ Intermediate: Moderate guidance with examples and hints on request (1.2x scoring)
  • 🔥 Advanced: Minimal guidance with brief hints after attempts (1.5x scoring)
  • 💀 Expert: No guidance, no hints, optimization required (2.0x scoring)

Your complexity level affects: - Hint availability and detail - Explanation depth - Puzzle parameters (variables, predicates, syntax complexity) - Scoring multipliers - Template and example availability

Tutorial Mode: Hello World Prolog

Perfect for beginners, the tutorial covers:

  1. Introduction: What is Prolog and logic programming?
  2. Facts: Creating statements of truth
  3. Fact Creation: Hands-on practice writing your first fact
  4. Queries: Asking questions with Prolog syntax
  5. Variables: Using variables to find multiple solutions
  6. Completion: Summary and next steps

The tutorial adapts to your selected complexity level, providing more or less guidance accordingly.

Main Adventure: Memory Bank Restoration

The full game consists of multiple levels, each focusing on a key Prolog concept:

  • Memory Stack Failure: Debug system failures using Prolog queries and stack trace analysis
  • Level 1 - Facts Database: Restore basic knowledge
  • Level 2 - Inference Engine: Repair logical rules
  • Level 3 - Pattern Matching: Fix unification systems
  • Level 4 - Search Algorithms: Restore backtracking
  • Level 5 - Recursive Core: Master recursive problem solving

Each puzzle adapts to your complexity level with appropriate challenge and guidance.

Interface Guide

Web-Based Terminal Interface

Logic Quest runs in your web browser with an authentic retro terminal experience:

  • Welcome Screen: Cyberpunk-styled main menu with ASCII art
  • Interactive Buttons: Click to navigate between game modes
  • Full-Height Terminal Display: Optimized layout that uses the entire browser viewport with fixed header and input areas
  • Enhanced Terminal Output: Multi-color terminal output with proper color coding, automatic scrolling, and robust error handling
  • Terminal Window: Type commands and see responses in real-time with responsive height adjustment
  • Educational Content Boxes: Centered explanation boxes with retro styling for displaying learning materials and concept explanations
  • Defensive Programming: Safe array bounds checking ensures stable terminal rendering without errors
  • Responsive Design: Works on desktop and mobile browsers with dynamic layout calculations
  • Optimized Performance: Lazy-loaded game components for smooth interaction
  • Real-time State Management: Instant updates without page refreshes

Terminal Commands

Once in the game terminal, use these commands:

LOGIC-1 > help              # Show available commands
LOGIC-1 > hint              # Get guidance for current step (availability depends on complexity)
LOGIC-1 > menu              # Return to main menu
LOGIC-1 > status            # Check progress and stats
LOGIC-1 > complexity        # View or change complexity level
LOGIC-1 > achievements      # View achievements by complexity level

Advanced Error Handling & Validation

The game provides comprehensive error handling with progressive learning support:

Progressive Hint System

  • 5 Escalating Levels: From gentle encouragement to complete solutions
  • Intelligent Error Detection: Automatic categorization of common Prolog syntax mistakes
  • Contextual Guidance: Hints tailored to specific error types and exercises
  • Attempt-Based Progression: More specific help as users make more attempts

Specific Error Messages

  • Missing Period Errors: Clear guidance when facts/queries lack required periods
  • Capitalization Issues: Help with predicate and variable capitalization rules
  • Parentheses Problems: Detection and guidance for missing or mismatched parentheses
  • Query Syntax: Specific help with ?- prefix and query formatting
  • Pattern Recognition: Comprehensive detection of malformed Prolog syntax

Recovery Mechanisms for Stuck Users

  • Multiple Help Options: Continue, get hints, see examples, show answers, skip exercises
  • Alternative Explanations: Different ways to understand the same concept
  • Adaptive Support: More recovery options become available after multiple attempts
  • Concept Review: Quick refreshers on key Prolog concepts when needed

Color-Coded Feedback

  • Valid syntax: Green confirmation with parsed components
  • Syntax errors: Red error messages with specific, encouraging hints
  • 💡 Progressive hints: Yellow encouraging messages with escalating specificity
  • 🔵 System messages: Cyan text for commands and system responses
  • General text: White text for neutral information
  • 🎯 Recovery options: Highlighted help options for stuck users

Example Interactions

Creating a fact:

LOGIC-1 > likes(alice, chocolate).
 Valid fact! Predicate: likes, Arguments: [alice, chocolate]

Writing a query:

LOGIC-1 > ?- likes(alice, X).
 Valid query! This will find what Alice likes.

Progressive error handling:

# First attempt - gentle hint
LOGIC-1 > likes(alice, chocolate)
 Missing period at the end.
💡 Don't forget the period (.) at the end!

# Second attempt - more specific
LOGIC-1 > likes(alice, chocolate)
❌ Missing period at the end.
💡 All Prolog facts must end with a period (.).
🔍 Remember the pattern: predicate(argument1, argument2).

# Third attempt - detailed guidance
LOGIC-1 > likes(alice, chocolate)
❌ Missing period at the end.
💡 The period tells Prolog that your statement is complete.
📝 Let's check your syntax step by step:
   1. Does it start with a lowercase predicate? 
   2. Are the arguments in parentheses? 
   3. Are arguments separated by commas? 
   4. Does it end with a period (.)? 

# Recovery options after multiple attempts
🤔 You've made several attempts. What would you like to do?
1. Keep trying (I can do this!)
2. Give me a more specific hint
3. Show me a similar example
4. Show me the correct answer
5. Skip this exercise for now

Progression System

Scoring

Your performance is tracked across multiple dimensions:

  • Puzzle Score: Based on attempts and hints used
  • Complexity Multiplier: Higher difficulty levels earn bonus points (1.0x to 2.0x)
  • Speed Bonus: Faster completion earns extra points
  • Accuracy Rating: Fewer mistakes improve your rating
  • Concept Mastery: Track which Prolog concepts you’ve learned
  • Per-Level Achievements: Separate tracking for each complexity level

Progress Tracking

The game maintains detailed statistics:

  • Facts and queries you’ve created
  • Mistakes made and lessons learned
  • Time spent on each concept
  • Overall completion percentage
  • Puzzles completed at each complexity level
  • Average scores by difficulty
  • Complexity level changes during gameplay

Adaptive Difficulty

Puzzles dynamically adapt to your selected complexity level:

  • 🌱 Beginner: Step-by-step guidance with detailed hints, templates, and examples (1.0x scoring)
    • Always-available hints with detailed explanations
    • Templates provided for every exercise
    • Maximum 2 variables, 3 predicates
    • Simple syntax only
  • ⚡ Intermediate: Moderate guidance with standard complexity (1.2x scoring)
    • Hints available on request
    • Examples provided but no templates
    • Maximum 4 variables, 5 predicates
    • Complex syntax allowed
  • 🔥 Advanced: Minimal guidance with complex problems (1.5x scoring)
    • Hints only after multiple attempts
    • No templates or examples
    • Maximum 6 variables, 8 predicates
    • Requires optimization and multiple solution paths
  • 💀 Expert: No guidance with optimization challenges (2.0x scoring)
    • No hints available
    • Maximum 8 variables, 12 predicates
    • Edge cases and performance constraints
    • Requires complete mastery

You can change your complexity level at any time during gameplay.

Learning Features

Interactive Validation

Every input is validated with educational feedback:

  • Syntax checking: Immediate feedback on Prolog grammar
  • Semantic analysis: Verify logical correctness
  • Helpful hints: Specific suggestions for common mistakes
  • Encouraging messages: Supportive feedback to maintain motivation

Contextual Help

Get assistance tailored to your current situation:

  • Concept explanations: Clear descriptions of Prolog features with alternative explanations
  • Example solutions: See correct syntax in action with step-by-step breakdowns
  • Progressive hints: 5 escalating levels from gentle encouragement to complete solutions
  • Error analysis: Intelligent categorization and specific guidance for common mistakes
  • Recovery mechanisms: Multiple help options when you’re stuck, including concept reviews
  • Encouraging support: Positive, motivational messaging throughout the learning process

Practice Exercises

Reinforce learning with hands-on practice:

  • Guided exercises: Step-by-step practice with immediate feedback
  • Free exploration: Experiment with concepts in a safe environment
  • Challenge problems: Test your understanding with complex scenarios
  • Review sessions: Revisit concepts you’ve learned

Tips for Success

For Beginners

  1. Start with the tutorial: Don’t skip the Hello World introduction
  2. Read error messages carefully: They contain valuable learning hints
  3. Experiment freely: The system is forgiving and educational
  4. Use hints when stuck: They’re designed to teach, not just solve
  5. Take your time: Understanding is more important than speed

For Experienced Programmers

  1. Embrace the logic paradigm: Prolog thinks differently than imperative languages
  2. Focus on declarative thinking: Describe what you want, not how to get it
  3. Practice pattern matching: It’s fundamental to Prolog’s power
  4. Understand backtracking: Learn how Prolog explores solution spaces
  5. Master recursion: It’s the key to solving complex logical problems

General Strategy

  • Read the story: Context helps understand the technical concepts
  • Practice regularly: Consistent engagement builds understanding
  • Don’t rush: Take time to understand each concept thoroughly
  • Ask for hints: They’re educational tools, not cheating
  • Review your progress: Use the stats to identify areas for improvement

Ready to dive deeper into the concepts? Learn about the Prolog fundamentals taught in Logic Quest!