Files
WHCandCursor 1f1fcba7ad Initial CST-Agent: portable Linux/Termux/Windows coding agent.
Vendored sashidown, OpenAI-compatible env (OPENAI_*), and bootstrap scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:42:32 +08:00

916 B

Snake Game

A classic terminal-based Snake game written in C++17.

Features

  • Smooth snake movement using POSIX terminal I/O
  • WASD or Arrow keys for movement
  • Food spawning and snake growth
  • Wall and self-collision detection
  • Score tracking
  • Pause functionality (P key)
  • Clean terminal rendering

Build

make

This compiles snake.cpp with optimization level O2 and C++17 standard.

Run

./snake

Controls

Key Action
W / ↑ Move Up
S / ↓ Move Down
A / ← Move Left
D / → Move Right
P Pause/Resume
Q Quit

Game Rules

  • Eat the * food to grow and score points (+10 per food)
  • Avoid hitting the walls #
  • Avoid colliding with your own body o
  • The snake moves continuously

Requirements

  • GCC/G++ with C++17 support
  • POSIX-compliant system (Linux, macOS)
  • Terminal with ANSI escape support