Computer Science Canada 23 Line Pong |
Author: | copthesaint [ Wed Jan 19, 2011 10:34 pm ] | ||
Post subject: | 23 Line Pong | ||
Tony @ Mon Jan 10, 2011 wrote: copthesaint @ Mon Jan 10, 2011 3:31 am wrote: Lol I dont want to know how complex it would be to minipulate the values for a 3 dimensional array doing this... lol
You weren't around for this, but things very quickly get out of hand... http://compsci.ca/blog/your-computer-science-isu-in-20-lines/
So no this isn't original, but it is funny having a 23 line pong program... If you press p you will pause the game 'w' and 's' are the keys for player one, up arrow and down arrow are keys for player two. |
Author: | Insectoid [ Wed Jan 19, 2011 11:22 pm ] |
Post subject: | RE:23 Line Pong |
This is likely just because I'm running it through Wine, but it's incredibly slow (4-5 spf -not fps, spf)on my computer. I'm far too lazy to figure out the conditional atm. I find a lot of programs can be simplified if you just look up patterns in the code. Many conditionals, loops, etc. can be collapsed into very few lines, or by reading possible outputs of functions you can generate truth tables and write them mathematically in far fewer lines. I've had fun going through assignments and collapsing them into very few lines or single complex statements that might not appear to work at first but do with explanation. Good job on this- If I have access to a Windows machine with Turing anytime in the near future I'll try it out for real. |
Author: | TheGuardian001 [ Thu Jan 20, 2011 1:35 am ] |
Post subject: | Re: 23 Line Pong |
It's seems to run quite well on a Windows machine. That's one hell of a conditional though. |
Author: | Zren [ Thu Jan 20, 2011 10:17 am ] |
Post subject: | RE:23 Line Pong |
That one line is why normal people judge length in characters . . . >.< Haven't played long enough by myslef but is there a win condition? |
Author: | Tony [ Thu Jan 20, 2011 10:36 am ] |
Post subject: | RE:23 Line Pong |
No, there is no win condition. The loop will never exit. |
Author: | 2goto1 [ Thu Jan 20, 2011 11:29 am ] |
Post subject: | Re: RE:23 Line Pong |
Zren @ Thu Jan 20, 2011 10:17 am wrote: That one line is why normal people judge length in characters . . . >.<
Good point. The motivation for "least number of lines / characters" has always been one of algorithmic efficiency, above all else |
Author: | Tony [ Thu Jan 20, 2011 11:52 am ] |
Post subject: | RE:23 Line Pong |
/sarcasm, right? |
Author: | Sur_real [ Thu Jan 20, 2011 1:36 pm ] |
Post subject: | Re: RE:23 Line Pong |
Zren @ Thu Jan 20, 2011 10:17 am wrote: That one line is why normal people judge length in characters . . . >.<
Haven't played long enough by myslef but is there a win condition? I agree... on a similar note then you should check you fishtastic's Turing TD http://compsci.ca/v3/viewtopic.php?t=20247 |
Author: | mirhagk [ Thu Jan 20, 2011 2:19 pm ] | ||
Post subject: | RE:23 Line Pong | ||
I know something more impressive. I didn't find this, but this kid in my compsci class did, so I insta-conscripted him to me ecoo team found it. There's this coconut problem http://ecoo.org/cs/ECOO_08_Board/brd2008p2.html There solution is that big, but it's decently complex. his solution (works for every answer they have) (also note the input is wrong... 144, 120 and 17 are 44, 20 and 7 respectively, they even say so lol) is one variable declaration, a for loop (to get all 5 answers), an input, and an output (with non-complex math)
|
Author: | Insectoid [ Thu Jan 20, 2011 4:12 pm ] |
Post subject: | RE:23 Line Pong |
Things like that are what I love about programing contests. There's always an 'obvious' answer that most of the participants will use. Then there are a number of 'obscure' solutions that require you to look at the problem sideways. Anyone can figure these out given time, but it takes a different kind of thinker to figure these out within the time constraints of a contest. Imo these are the true gods of programing contests. |
Author: | copthesaint [ Thu Jan 20, 2011 11:53 pm ] |
Post subject: | RE:23 Line Pong |
I love programing contests, I didnt win for our contest last year on the count that I forgot to copy the java installers onto my labtop and couldn't test anything -_- but! I did get third previous year! lol |