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 ]