File Exchange

image thumbnail

Tetris for Dummies

version 1.2 (13.8 KB) by

Tetris with easy code layout and extensive comments.

5 Downloads

Updated

View License

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 :)

Comments and Ratings (15)

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

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

Nathan

Nathan (view profile)

some

some (view profile)

diegomrivera

Kenneth Eaton

Kenneth Eaton (view profile)

@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.

John D'Errico

John D'Errico (view profile)

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.

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.

Husam Aldahiyat

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

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.

Dania Adwan

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.

Updates

1.2

Added help and minor corrections

1.1

Acknowledgements added

MATLAB Release
MATLAB 7.4 (R2007a)
Acknowledgements

Inspired: MATLABTETRIS

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

» Watch video