/snake.php

Snake, in (almost) pure PHP

Primary LanguagePHP

Snake

A limited implementation of the classic game of Snake.

This is a proof-of-concept, and avoids the use of (n)curses and readline.

Gameplay

$ php snake.php

Move the snake with the arrow keys. Eat the fruit. Avoid your tail.

To quit during the game, press ESCape. Otherwise your terminal may not be reset properly.

Requirements

  • Terminal with TTY emulation
  • PHP 5 CLI (tested with 5.3, but probably works with 5.0+)

Important Information

Running this will clear your terminal (including scrollback). You've been warned.

This program uses ANSI escape sequences and TTY control commands that are not supported by Windows, even when running a terminal like Git Bash.