Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

The smallest tetris in Java

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 112
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the subject of this thread is wrong, maybe "The smallest tetris in java" is better.
Earlier today I found another "smallest Tetris"
 
Petr Blahos
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, anyway, if anybody is interested, you can see the
smallest tetris I could write here:
http://sweb.cz/petrblahos/4ktris/tiny.zip

P.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic