View License

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

» Watch video

Highlights from
Tetris for Dummies

5.0 | 8 ratings Rate this file 9 Downloads (last 30 days) File Size: 13.8 KB File ID: #21246 Version: 1.2
image thumbnail

Tetris for Dummies



28 Aug 2008 (Updated )

Tetris with easy code layout and extensive comments.

| Watch this File

File Information

Tetris game code with sounds, high scores and gravity. It is intended as a learning tool with its extensive comments and laid out code with easy getarounds and simple functions. The code explores things such as loops and if statements, patch, save/load, GUI techniques, callbacks and sound generation.

It can be easily edited to suit one's needs and/or to make it more modular, and I hope at least some people will learn new things from it :)


This file inspired Matlabtetris.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
16 Oct 2011 mohammad Al-Kayyali

15 Oct 2011 mohammad Al-Kayyali

Just want to say thank you cause you are the one who helped me not to lose faith in MATLAB ...

Comment only
30 Sep 2010 almohallas

Good Day Mr. Husam.will you pls send me the figure of this game?because i don't know how to create a tetris like this.i want to know the basic.plsssss.i really need it...and i need your help to make another game cause i'm just surfing this matlab and i can't really understand the whole program...God bless

07 Apr 2010 Nathan

Nathan (view profile)

14 Mar 2010 some

some (view profile)

16 Oct 2009 diegomrivera

09 Feb 2009 Kenneth Eaton

@Niye: As John D'Errico (a well-respected and trusted individual on this site) has already stated, this submission is not a copy of Pascal's. Granted, it is the same game, but written and designed in a different way. If you have specific arguments why the other is better, then by all means make them. But simply implying plagiarism is inappropriate.

Comment only
09 Feb 2009 John D'Errico

John D'Errico (view profile)

09 Feb 2009 Husam Aldahiyat

Thanks for the comment it means a lot.

Most of the files I've submitted have no H1 line and proper help, but I'm updating them soon.

Comment only
09 Feb 2009 John D'Errico

John D'Errico (view profile)

Unfortunately, the help on this code gives no help. Apparently, the help function does not recognize %{ and %} blocks.

>> help play2


Regardless, this is obviously NOT plagiarized code. I've done a careful comparison between the codes and found no evidence of any such behavior. The comment (made by Patricia Castro) is a false accusation.

Comment only
09 Feb 2009 Husam Aldahiyat

I posted this to help people and in return got an ill-conceived accusation of being a plagiarist. Great.

Comment only
04 Feb 2009 Husam Aldahiyat

Please elaborate on that accusation.

By the way, and this is completely unrelated, I had tried twice to give that particular file an acknowledgment, but the update wouldn't go through.

Comment only
02 Dec 2008 Mohannad Omari

29 Aug 2008 Dania Adwan

28 Aug 2008 John D'Errico

I'll admit that I'm impressed. The author has given us interesting insights into their thoughts as they wrote the code. LOTS of comments, that really try to explain why specific things are done, and what a code fragment does in the code. This is to be highly commended.

Yes, there are a few things that I'd disagree with. The use of globals to pass information around is generally a poor choice, and unnecessary, since nested functions are already employed. Also, the author uses preallocation (not prelocation) but appears to be unsure what it truly does for the code, and thus why to use it.

Well done, for the effort that went into this code, the comments, and the honesty they show. While there is room for improvement in their work, this author has earned my respect.

Must I pick a numerical rating? Nope.

Comment only
09 Feb 2009 1.1

Acknowledgements added

09 Feb 2009 1.2

Added help and minor corrections

Contact us