Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Shortest Tetris Challenge
Index -> Contests
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zylum




PostPosted: Fri Feb 01, 2008 12:24 pm   Post subject: Shortest Tetris Challenge

OK, so there's been a few tetris submissions in the turing forums, some of which had comments relating to how long a tetris program should be. Thus I propose a challenge: program tetris in as few lines as possible.

Rules:
1) Your program must more or less conform to the standard tetris rules outlined in section 5 here
2) The official line count will be the number of lines after hitting F2 in the turing environment
3) You may post your code here or you may PM me with your submissions
4) Deadline is Sunday February 10th, 2008 at midnight

Bits will be awarded based on how many lines your program is. To make things more interesting you have a choice:

Bits = round (10000 / max (lines - 50, 1)) - 50
or
Bits = round (1000 / max (lines - zylumLines + 1, 1))

I suppose other languages could be allowed, though the graphics wouldn't be as easy.

That's about all for now. I look forward to some creative solutions!

BTW here's my submission. I will post the password to the source once the contest is over...



tetris.rar
 Description:

Download
 Filename:  tetris.rar
 Filesize:  228.41 KB
 Downloaded:  587 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Fri Feb 01, 2008 12:28 pm   Post subject: RE:Shortest Tetris Challenge

Is there a character limit per line?
zylum




PostPosted: Fri Feb 01, 2008 12:42 pm   Post subject: RE:Shortest Tetris Challenge

Well if the lines are too long, they are wrapped after hitting F2. If you are referring to languages other than turing, then no, there is no line limit but standard coding conventions should be used.
fishtastic




PostPosted: Fri Feb 01, 2008 1:20 pm   Post subject: RE:Shortest Tetris Challenge

I am in!

since exam has been delayed till monday i will spend some time changing my code.
current lengh is around 400 with all the extra features now let me get rid of them XD
fishtastic




PostPosted: Fri Feb 01, 2008 11:56 pm   Post subject: Re: Shortest Tetris Challenge

here it is, still very long. it looks like i can only get something like 10 bits.

Is that all the features i need?



omg so long .zip
 Description:

Download
 Filename:  omg so long .zip
 Filesize:  272.02 KB
 Downloaded:  393 Time(s)


omg so long .zip
 Description:

Download
 Filename:  omg so long .zip
 Filesize:  272.02 KB
 Downloaded:  356 Time(s)

StealthArcher




PostPosted: Sat Feb 02, 2008 12:35 am   Post subject: RE:Shortest Tetris Challenge

If I decide to try this, being relatively horrible at tetris, and at game making in general, what is the limitation of external files?
zylum




PostPosted: Sat Feb 02, 2008 1:47 am   Post subject: RE:Shortest Tetris Challenge

fishtastic> your board is only 8x18.. Also, your controls seem a bit sticky at times, and at other times over responsive (ie rotates a few times from pushing up once). Standard tetris says "All inputs take effect on the rising-edge of the positive input (i.e., on button press, as opposed to button release)"

Other than that, everything seems to be in good shape Wink

StealthArcher> What do you mean external files? If your source is divided amongst several files, then the sum of the line counts will be the total line count..
StealthArcher




PostPosted: Sat Feb 02, 2008 1:54 am   Post subject: RE:Shortest Tetris Challenge

I mean, using files to store data (numbers etc.), not source code.
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: Sat Feb 02, 2008 3:16 am   Post subject: RE:Shortest Tetris Challenge

Lets keep it to 1 file as I stored all my data in my source code..
fishtastic




PostPosted: Sat Feb 02, 2008 9:29 am   Post subject: Re: RE:Shortest Tetris Challenge

zylum @ Sat Feb 02, 2008 12:47 am wrote:
Also, your controls seem a bit sticky at times, and at other times over responsive (ie rotates a few times from pushing up once). Standard tetris says "All inputs take effect on the rising-edge of the positive input (i.e., on button press, as opposed to button release)"


you mean each time you press a key the block should only rotate/move once??

how do you do that in turing? Shocked
well i cound but if i make a extra variable to make sure the key stops then it will take even more lines.
fishtastic




PostPosted: Sat Feb 02, 2008 9:55 am   Post subject: RE:Shortest Tetris Challenge

I changed from input.keydown to getchar.
now every key does something. and it will repeat if you hold down for i while.

it says
"When a button press occurs, this counts as a request. Holding a button down beyond a certain time may result in the "auto-repeat" feature of a keyboard, generating new button presses -- but this feature is external to the game engine. "

so i guess its ok.
Tony




PostPosted: Sat Feb 02, 2008 2:27 pm   Post subject: Re: RE:Shortest Tetris Challenge

fishtastic @ Sat Feb 02, 2008 9:29 am wrote:
how do you do that in turing? Shocked

When we are talking about input edges, or button states, there are 4 for each button. It's tracked over two frames -- that is, where the button was last time through the loop, and where it is now. This generates 4 unique possible states:

UP UP -- the button is up
DOWN DOWN -- the button is held down
UP DOWN -- the button has just be pressed down
DOWN UP -- the button has just been released up

In Turing you would copy the state of the keyboard into the "old_state" variable just before calling Input.KeyDown()
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
fishtastic




PostPosted: Sat Feb 02, 2008 2:58 pm   Post subject: Re: Shortest Tetris Challenge

Here it is! my final version.

This is the shortest I can do.
And i think i fixed all the problems.

I was being very cheap while coding this.
I was changing all "const" to actual number, all 2 layer for loop to 1 layer div/mod for loop.
I had a lot of fun making this and being cheap. hopefully, Zylum did not do the same thing. Rolling Eyes

you can still play the game
Anyway. i will tell everyone the password for code on the final day as the rule said.



Fish Tetris.zip
 Description:

Download
 Filename:  Fish Tetris.zip
 Filesize:  276.9 KB
 Downloaded:  435 Time(s)

Clayton




PostPosted: Sat Feb 02, 2008 4:03 pm   Post subject: RE:Shortest Tetris Challenge

Zylum probably did his in 25 lines.
fishtastic




PostPosted: Sat Feb 02, 2008 4:13 pm   Post subject: Re: RE:Shortest Tetris Challenge

Clayton @ Sat Feb 02, 2008 3:03 pm wrote:
Zylum probably did his in 25 lines.


what?? in turing?? Shocked Shocked OMGOMG Shocked OMGOMG Shocked Shocked

That is not possible. no way!
If he did it in 25 lines then the equation will not be 1000/(yourline - zylumline)
I say it took him at least 50 lines.
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 31 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: