Playing Rules

  • Objective: Eat food to grow your snake and earn points. First to reach the winning score (default: 1000) wins.
  • Player Snake: Blue (Human). Controlled with arrow keys or on-screen buttons (mobile).
  • AI Snake: Red (AI). Moves automatically to chase food and power-ups.
  • Modes:
    • Player vs AI: You control Human against AI.
    • AI vs AI: Watch Human and AI compete.
  • Game Speed: Increases as total score rises (every 150 points). Super/shrink food temporarily slows the game.
  • Obstacles: Black blocks that move every 30 seconds. Avoid them to prevent collisions.
  • Cannon: A moving cannon ("The Cannon") chases the closest snake, with its barrel facing its movement direction. It shoots projectiles every 30 frames. If hit, the snake grows by 1 segment, loses 1 point (if score > 0), and the cannon gains 1 point. The cannon’s score is displayed as "The Cannon: $X".
  • Collisions: Hitting obstacles, yourself, or the other snake triggers penalties, a 30-frame invincibility period, and specific sounds:
    • Self-Collision: Lose half your score (rounded down), other snake gains it.
    • Snake Collision: Lose all your score, other snake gains it.
    • Obstacle Collision: Lose 80% of your score (rounded down), other snake gains it.
  • Wrapping: Snakes wrap around screen edges for continuous movement.
  • Scoring:
    • Regular Food: Red apple, +1 point. Plays "eat" sound.
    • Super Food: Golden, pulsing item, +5 points, grows snake, slows game speed (-1). Disappears after 5 seconds. Plays "ding" sound.
    • Shrink Food: Pink item, +2 points, shrinks snake to 3 segments, slows game speed (-0.5). Disappears after 8 seconds. Plays "ding" and "shrink" sounds if shrunk.
    • Mystery Food: White square with "?", randomly gives:
      • Super Effect: +5 points, growth, slows game speed (-1). Plays "ding" sound.
      • Shrink Effect: +2 points, shrinks to 3 segments, slows game speed (-0.5). Plays "ding" and "shrink" sounds if shrunk.
      Disappears after 8 seconds.
  • Power-Ups: Special items with temporary boosts, disappear after 8 seconds. Plays "ding" sound with popup message:
    • Speed Boost: Yellow lightning bolt, 50% speed increase for ~100 frames. Shows "Speed Up!"
    • Invincibility: Blue shield, prevents collisions for ~100 frames. Shows "Invincible!"
    • Score Multiplier: Purple star, doubles points from food for ~200 frames. Shows "x2 Points!"
    • Teleport: Green portal, enables the snake to teleport to the closest food item each move for ~10 frames, consuming it immediately. Shows "Teleport Active!" when collected and "Teleported!" each teleport.
  • Settings: Adjust AI speed, game speed, obstacle count, and winning score via dropdowns. Settings save automatically.
  • Reset: Click "Reset" to reload the page if lagging occurs. Settings are preserved.
  • Pause: Click the game canvas to pause or resume the game during play (on mobile devices swipe left or right on the canvas to pause/resume).
  • More Help:
    Snake Game with Two Snakes on GitHub