aspose file tools*
The moose likes Programming Diversions and the fly likes The smallest tetris in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "The smallest tetris in Java" Watch "The smallest tetris in Java" New topic
Author

The smallest tetris in Java

Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131
Hi all,

I have just finished my submission to Java 4K Game Programming Contest (http://www.woogley.net/java4k.html) - a tetris. You can check it out here:
http://www.woogley.net/j4k/4ktris/

Anyway, it made me think what size would the smallest possible tetris in java be. If we define rules as follows:
* Size of class files + any possible data files count.
* If there are data files, they must be acquired using CLASS.class.getClassLoader().getResourceAsSream() - or similar, so that it would run both from a jar and from a directory.
* Neither colors nor sizes are important (though presumably it shouldn't be unplayable due to un-visibility).
* It should display score and level and a next item. It must be clear that the displayed Score and Level are score and level.
* The level (of difficulty) should increate with a certain number of removed lines.
* It should implement a keyboard control, up-key will rotate, left, right is obvious.
* Down-key will cause cause the block to either fall down immediatelly or to fall faster. It is kept on the discretion of the implementor, as long as it does something reasonable.
* It should implement a "game over". Then, the space-bar will start a new game. There is no need to let user know that the game ended, neither that they must press space.
* It should be written in Java (not Jython, java assembler, ...).

I have pushed it down to 3536B class file and 224B data file, compiled with jdk-1.4.2_03. What about you?

I don't want to distract you by my solution so I will post it in couple of days time. Just to give you time to think... ;-)

Petr
[ February 22, 2005: Message edited by: Petr Blahos ]

Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
Peter van de Riet
Ranch Hand

Joined: Apr 09, 2004
Posts: 112

I think the subject of this thread is wrong, maybe "The smallest tetris in java" is better.
Earlier today I found another "smallest Tetris"


Each number system has exactly 10 different digits.
Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131
Well, anyway, if anybody is interested, you can see the
smallest tetris I could write here:
http://sweb.cz/petrblahos/4ktris/tiny.zip

P.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The smallest tetris in Java
 
Similar Threads
Best Fit Algorithm
how to make game in java
Need logic for this game.
Tetris- Not functioning properly
Interfaces Question(s)