#!/bin/bash # Math Teacher - Game Generator # Creates gamified math challenges with scoring and achievements set -e # Colors GREEN='\033[0;32m' BLUE='\033[0;34m' PURPLE='\033[0;35m' NC='\033[0m' print_success() { echo -e "${GREEN}✓ $1${NC}"; } print_info() { echo -e "${BLUE}ℹ $1${NC}"; } prompt_select() { local prompt="$1" local var_name="$2" shift 2 local options=("$@") echo -e "${BLUE}${prompt}${NC}" PS3="Select (1-${#options[@]}): " select opt in "${options[@]}"; do if [ -n "$opt" ]; then eval "$var_name='$opt'" break fi done } echo "" echo "╔════════════════════════════════════════════════════════════╗" echo "║ Math Teacher - Game Generator 🎮 ║" echo "╚════════════════════════════════════════════════════════════╝" echo "" print_info "Step 1/3: Game Type" prompt_select "What type of game?" GAME_TYPE \ "Speed Challenge (Time Attack)" \ "Accuracy Mode (No Mistakes)" \ "Endless Practice (Streak Building)" \ "Boss Battle (Progressive Difficulty)" print_info "Step 2/3: Math Topic" prompt_select "Which topic?" TOPIC \ "Mental Math" \ "Fractions" \ "Algebra" \ "Geometry" \ "Mixed Topics" print_info "Step 3/3: Output" read -p "Game name (e.g., speed-math-game.html): " OUTPUT_FILE OUTPUT_DIR="./math-games" mkdir -p "$OUTPUT_DIR" OUTPUT_PATH="$OUTPUT_DIR/$OUTPUT_FILE" print_info "🎮 Generating your math game..." cat > "$OUTPUT_PATH" << 'GAMEEOF' Math Game Challenge

🎯 Math Challenge

Score
0
Streak
0
Level
1
60
5 + 3 = ?

🎉 Game Over!

0

GAMEEOF echo "" print_success "Game created: $OUTPUT_PATH" echo "" print_info "Game features:" echo " ✓ 60-second time challenge" echo " ✓ Progressive difficulty" echo " ✓ Streak bonuses" echo " ✓ Achievement system" echo " ✓ Final score rating" echo "" print_info "🚀 Opening game in browser..." open "$OUTPUT_PATH"