Author |
Message |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: 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...
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
tetris.rar |
Filesize: |
228.41 KB |
Downloaded: |
605 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Feb 01, 2008 12:28 pm Post subject: RE:Shortest Tetris Challenge |
|
|
Is there a character limit per line?
|
|
|
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
fishtastic
![](http://compsci.ca/v3/uploads/user_avatars/2112433479479e80d9034af.png)
|
|
|
|
![](images/spacer.gif) |
fishtastic
![](http://compsci.ca/v3/uploads/user_avatars/2112433479479e80d9034af.png)
|
Posted: 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?
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
omg so long .zip |
Filesize: |
272.02 KB |
Downloaded: |
407 Time(s) |
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
omg so long .zip |
Filesize: |
272.02 KB |
Downloaded: |
369 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
StealthArcher
![](http://compsci.ca/v3/uploads/user_avatars/18949255664b176c4f1481b.jpg)
|
Posted: 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?
|
|
|
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: 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
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..
|
|
|
|
|
![](images/spacer.gif) |
StealthArcher
![](http://compsci.ca/v3/uploads/user_avatars/18949255664b176c4f1481b.jpg)
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: 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..
|
|
|
|
|
![](images/spacer.gif) |
fishtastic
![](http://compsci.ca/v3/uploads/user_avatars/2112433479479e80d9034af.png)
|
Posted: 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?
well i cound but if i make a extra variable to make sure the key stops then it will take even more lines.
|
|
|
|
|
![](images/spacer.gif) |
fishtastic
![](http://compsci.ca/v3/uploads/user_avatars/2112433479479e80d9034af.png)
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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 Shocked](http://compsci.ca/v3/images/smiles/icon_eek.gif)
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()
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
fishtastic
![](http://compsci.ca/v3/uploads/user_avatars/2112433479479e80d9034af.png)
|
Posted: 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.
you can still play the game
Anyway. i will tell everyone the password for code on the final day as the rule said.
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Fish Tetris.zip |
Filesize: |
276.9 KB |
Downloaded: |
445 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Sat Feb 02, 2008 4:03 pm Post subject: RE:Shortest Tetris Challenge |
|
|
Zylum probably did his in 25 lines.
|
|
|
|
|
![](images/spacer.gif) |
fishtastic
![](http://compsci.ca/v3/uploads/user_avatars/2112433479479e80d9034af.png)
|
|
|
|
![](images/spacer.gif) |
|