Implementation of the classic video game Snake in low level MIPS Assembly Language πΉοΈ
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See below for prerequisite libraries and notes on how to deploy the project on a live system.
git clone https://github.com/mahirahman/Snake.git
To get a feel for this game, try it out in QtSpim:
- Open QtSpim (Or your preferred MIPS emulator)
- Click 'File' on the top left
- Click 'Reinitialize and Load File' from the drop-down menu
- Find snake.s on your computer and open it
- Click the green play button
- Enter command w|a|s|d into the console that pops up
.@.............
...............
...............
...............
...............
...............
...............
....ooo#.......
...............
...............
...............
...............
...............
...............
...............
The starting state of a game to the right, where you can see all the key parts of the game. Snake is played on a 15Γ15 grid. The snake is made up of a head (#), and a number of body segments (o), and can move around the grid.
When the user enters one of w, a, s, or d, the snake will move one step on the grid either north, west, south, or east, respectively. The snake won't move if the requested direction is where the first non-head segment is.
Also on the grid: apples! Snakes like apples [citation needed] so, if the snake's head moves over an apple (denoted @), the snake consumes it, and gains three segments over the next three moves. If there's no apple on the grid, a new one is added in a random empty cell.
The game ends only when either the snake falls off one of the edges of the board, or the snake runs into its own body as the snake's length increases, not falling off the board or running into itself become increasingly tricky!
- MIPS Assembly Language (MAL) - Assembly Language
- QtSpim - MIPS Simulator
- Mahi Rahman