File Exchange

image thumbnail

Classic Snake Game in MATLAB GUI

version (260 KB) by Akash Gupta
Enjoy a simple and easy to play game where the snake needs to feed on its prey.


Updated 26 Oct 2010

View License

Unzip the '' and run the game.m file. The game controls are present on the GUI screen that comes up and are self explanatory, although small annotations have been added for easier grasp.

Hope you enjoy.
A better version with subtle scoring methods and riskier play will be uploaded in time.

Cite As

Akash Gupta (2020). Classic Snake Game in MATLAB GUI (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (15)

Ryan Trent


good feature



how do i download this code??
any body can help me ?

Vinh Le

w sq

Although your program is good, i found it coundn't resume when I pushed the 'PAUSE' button. Matlab 'paush' function can be waken up by any key, but it is just once. What's mean is that when you click one time, it's be waked up. But this doesn't continuous. So can you solve this little problem?

Akash Gupta

The game is designed through the application of mild image processing.

Akash Gupta

The wavplay error has been redeemed.
To exit, one will have to stop the execution of the game by going to MATLAB command line and typing CTRL+C.
This is my first attempt at such an endeavour and I haven't seen other submissions in this regard.

Binbin Qi

i don't know how to exit the game?can you tell me?

Perhaps you can explain how this is better/worse/different than previous snake-game submissions:

Sean de

??? Error using ==> wavplay at 36
WAVPLAY is only for use with Windows machines.

Use a simple check:
if ispc; wavplay...;end
So those of us without windows don't get an error every time we get the food.


will not give error on Linux.

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux