View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 2.46 KB File ID: #47289 Version: 1.2
image thumbnail



21 Jul 2014 (Updated )

This is a 2048 game developped by Matlab M script and functions.

| Watch this File

File Information

The game 2048 is a popular cell phone game in iOS and Andriods. Now One simple version is realized in Matlab just for fun.
Nan in matrix is taken as blank position.
main.m -- user can run this script to start the game. It will call other 3 functions during the game.
add2mat.m -- add one 2 element into matrix
move_element.m -- move one element by one step.
move_mat.m -- move the whole matrix according to player's command in one step.
One 4*4 matrix is created and initialized with two 2 element in random position.
All operations are in Matlab Command Window, the move operation that are touch and slide in cell phone are replaced by inputting command of orientation.
The matrix will be updated and displayed in Each step after user's operation.
I will upload an Chinese version to later. If having some questions and good advice, please contact hyowinner in

Required Products MATLAB
MATLAB release MATLAB 8.2 (R2013b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
08 Mar 2016 totakura akhil

easy for students to understand

21 Jul 2014 1.1

Add description for Nan.

24 Jul 2014 1.2

Check for move is valid or not added.

Contact us