File Exchange

image thumbnail


version (1.46 KB) by Kirill K. Pankratov
Goal is to arrange 15 numbered squares in the 4x4 field.


Updated 11 Jul 2002

No License

Want to relax sometimes when working with MATLAB? Here I post an example of a game, invoked from the MATLAB environment to be played by pushing GUI buttons in a figure window. The game is very simple (looking) but not so easy to accomplish the goal. The purpose is to arrange 15 numbered squares in the 4*4 field (so that only one space is available) in the numbering order: 1,2,3,...,15. Only the squares adjacent to the empty space can be moved to this space at each step (by pressing their buttons).

Originally it is played with 15 plastic (or wooden) chips in a box, not the computer buttons. It is one one of the best simple games I know, much simpler to learn than anything else but still requires some thinking to do . (guess I was not smart enough to be a good chess player...). I used to play it as a kid (we called it "pyatnashki", means "fifteens" in Russian). I have no idea where it originally came from and how popular it was in other countries.

Cite As

Kirill K. Pankratov (2021). Fifteens (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

tudor dima

oldies by goldies ... thanks!
And pretty impressive for 10 year-old code, all I had to do in order to make it run in 2010b was to edit line 27 from:
if fnd~=[]
if ~isempty(fnd)

The plastic "perspico" was a huge hit in Romania when I was a kid. Numbers came in two colours (blue/red for odd/even) and on the back it had 6 (or maybe 9?) different output solutions to reach. (the normal 1-15 was called "horizontal", then "vertical", "spiral", "random" (a jumble everyone avoided), "total 30" and "impossible" which was 15:-1:1 , of course unreachable due to its opposite parity.
Thanks, this made my day :-)

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!