Computer Science Canada Programming Challenge |
Author: | Martin [ Sat Apr 12, 2003 10:55 pm ] | ||
Post subject: | Programming Challenge | ||
I challenge anyone to make the most impressive program in 200 lines or less. The rules are as follows. a) No Images (bitmaps, jpegs etc) b) No included, text or binary files c) No Sys. commands Standard spacing the following, or anything similar counts as 201 lines:
Otherwise, anything goes. Please post the source. Any submissions that I (or any of the mods) like will get 50 bits. The winner gets another 50 (End date undecided). Best of luck. P.S. Anything already posted on compsci.ca is not allowed, even if you are the original poster. |
Author: | Tony [ Sat Apr 12, 2003 10:57 pm ] |
Post subject: | |
martin, please clarify No pictures is it only image files or graphics at all? Also by 200 lines or less I assume standart spacing, not placing your whole program onto the snigle line. |
Author: | Asok [ Sat Apr 12, 2003 11:29 pm ] | ||
Post subject: | |||
Well... it looked more impressive in notepad... oh well.. Special Thanks goes out to tony for giving me insparation to do this |
Author: | Martin [ Sat Apr 12, 2003 11:39 pm ] |
Post subject: | |
Tony, I have no idea what you're talking about: *innocent* Also, it can be in any language (french, english, c++, turing...you name it) |
Author: | Asok [ Sat Apr 12, 2003 11:41 pm ] |
Post subject: | |
well it doesn't make any sence for someone to do it in c++ when they are worried about line consumption ie. hWnd alone takes a good 150 lines or so.I would reccomend looser line restrictions on c++ applicants. |
Author: | Martin [ Sun Apr 13, 2003 12:24 am ] |
Post subject: | |
Fine, 300 lines if you use c++, no DirectX or OpenGL |
Author: | Martin [ Sun Apr 13, 2003 12:24 am ] |
Post subject: | |
Oh, and if you use c++, you can include standard header files |
Author: | Blade [ Sun Apr 13, 2003 12:44 am ] |
Post subject: | |
i think tony means we which cant we use (or both) Pic.FileNew and/or Draw... as in Draw.Line and such |
Author: | Catalyst [ Sun Apr 13, 2003 1:29 am ] |
Post subject: | |
can i use something i have posted as exe but not source? |
Author: | Asok [ Sun Apr 13, 2003 10:34 am ] |
Post subject: | |
I think that would be fine catalyst. |
Author: | Martin [ Tue Apr 15, 2003 9:30 pm ] |
Post subject: | |
Nobody? |
Author: | Catalyst [ Tue Apr 15, 2003 9:46 pm ] |
Post subject: | |
ill post up my per pixel code soon... |
Author: | Tony [ Tue Apr 15, 2003 10:09 pm ] |
Post subject: | |
lol, might as well give bits to catalyst then maybe we should give a bonus prize if the winner is someone other then catalyst Lol, its kind of hard to compeat against him. |
Author: | Delta [ Wed Apr 16, 2003 8:58 am ] |
Post subject: | Create a New One |
I think Catalyst should create a new program so we can see more of his wonderful skills (Delta shows signs of jealousy) And then that way we've got more time to create ours... anyone in agreement with me...? Anyone? |
Author: | Martin [ Mon Apr 21, 2003 12:12 am ] |
Post subject: | |
Nah, I could out program Catalyst any day |
Author: | Tony [ Mon Apr 21, 2003 12:16 am ] |
Post subject: | |
well if its under 200 lines, then I suppose Catalyst would not be able to fit in his 3D engine which opens up an oportunity for Martin and myself I just dont have time or enough motivation at the moment |
Author: | Catalyst [ Mon Apr 21, 2003 1:12 am ] |
Post subject: | |
i can fit my engine in 200 lines, im not going to tho |
Author: | Homer_simpson [ Mon Apr 21, 2003 9:47 pm ] |
Post subject: | |
So when's the due date? |
Author: | Homer_simpson [ Mon Apr 21, 2003 9:48 pm ] |
Post subject: | |
and why da hell my avatar doesn't show =Þ |
Author: | Tony [ Mon Apr 21, 2003 10:23 pm ] |
Post subject: | |
due date? well lets see a first submition (i suppose it can be exe, but source code would have to be checked before declearing a winner) we'll see from there... I think it should be before school ends or something... |
Author: | Martin [ Tue Apr 22, 2003 8:35 pm ] | ||
Post subject: | |||
Just incase nobody enters, I'm gonna win by default
|
Author: | Tony [ Tue Apr 22, 2003 9:46 pm ] | ||
Post subject: | |||
and the competition is on! My sujestion is to mark all your submitions with a under 200 lines of code if applicable from now untill beginning of June. Also post a link in here to your under 200 line program (even if its exe, number of lines will be varified in June) now so that Martin will not get a default win, here's my submition:
|
Author: | DarkHelmet [ Thu Apr 24, 2003 5:39 pm ] |
Post subject: | |
Hey, here's something. It's minigolf. Unfortunately, there is only one hole, and it isn't perfect, b/c i had to trim it under two hundred lines. [code] colourback (gray) procedure drawhole1 (intx : int, inty : int, var blnpress : boolean, blnline : boolean) var intmousex : int var intmousey : int var intbutton : int mousewhere (intmousex, intmousey, intbutton) Draw.FillBox (100, 75, 150, 375, 2) Draw.FillBox (150, 250, 250, 375, 2) Draw.FillBox (200, 250, 250, 75, 2) Draw.FillBox (250, 200, 375, 75, 2) Draw.FillBox (300, 75, 375, 375, 2) Draw.FillBox (100, 70, 95, 380, brown) Draw.FillBox (95, 375, 255, 380, brown) Draw.FillBox (295, 375, 380, 380, brown) Draw.FillBox (300, 375, 295, 200, brown) Draw.FillBox (250, 375, 255, 200, brown) Draw.FillBox (250, 200, 300, 205, brown) Draw.FillBox (95, 75, 155, 70, brown) Draw.FillBox (150, 70, 155, 250, brown) Draw.FillBox (200, 70, 195, 250, brown) Draw.FillBox (150, 250, 200, 245, brown) Draw.FillBox (195, 75, 380, 70, brown) Draw.FillBox (375, 70, 380, 380, brown) Draw.FillOval (335, 350, 5, 5, black) Draw.FillOval (intx - 2, inty - 2, 4, 4, white) Draw.Oval (intx - 2, inty - 2, 4, 4, black) if blnline = true then Draw.Line (intx - 1, inty - 1, intmousex, intmousey, red) end if delay (7) if intbutton > 0 then blnpress := true end if end drawhole1 procedure getnum (var intnum : int, intx : int, inty : int) var strnum : string var chars : array char of boolean strnum := "" locate (intx, inty) loop Input.Pause Input.KeyDown (chars) locate (intx, inty) put skip locate (intx, inty) if chars ('1') then strnum := strnum + "1" elsif chars ('2') then strnum := strnum + "2" elsif chars ('3') then strnum := strnum + "3" elsif chars ('4') then strnum := strnum + "4" elsif chars ('5') then strnum := strnum + "5" elsif chars ('6') then strnum := strnum + "6" elsif chars ('7') then strnum := strnum + "7" elsif chars ('8') then strnum := strnum + "8" elsif chars ('9') then strnum := strnum + "9" elsif chars ('0') then strnum := strnum + "0" elsif chars (KEY_ENTER) then exit elsif chars (KEY_BACKSPACE) then if length (strnum) > 1 then strnum := strnum (1 .. (length (strnum) - 1)) else strnum := "" end if end if put strnum .. end loop intnum := strint(strnum) end getnum var intx, inty, intbutton : int var intmousex : int var intmousey : int var intballx : real := 125 var intbally : real := 100 var intpower : int var intshots : int := 0 var blnpress : boolean := false var relslope : real var distance : int var intdist : real var inth : int var intw : int loop blnpress := false loop View.Set ("offscreenonly") cls drawhole1 (intballx div 1, round (intbally), blnpress, true) if blnpress = true then mousewhere (intx, inty, intbutton) exit end if View.Update end loop View.Set ("nooffscreenonly") loop cls drawhole1 (intballx div 1, round (intbally), blnpress, false) locate (23, 25) put "How powerful would you like your shot to be?" .. getnum (intpower,23, 70) exit when intpower >= 1 and intpower <= 20 end loop intshots += 1 intpower := (intpower * 1.5) div 1 inth := inty - intbally div 1 intdist := (intpower ** 3) * 4 intw := intx - intballx div 1 relslope := inth / intw if inth / intw < 0 then relslope *= -1 end if for decreasing i : intpower .. 1 for a : 1 .. i for x : 1 .. 2 if intdist > 0 then cls View.Set ("offscreenonly") if intw < 0 then intballx := intballx - .5 if inth > 0 then intbally := (intbally + (relslope / 2)) elsif inth < 0 then intbally := (intbally - (relslope / 2)) end if intdist -= sqrt ((.5 ** 2) + (inth ** 2)) elsif intw > 0 then intballx := intballx + .5 if inth > 0 then intbally := (intbally + relslope) elsif inth < 0 then intbally := (intbally - relslope) end if intdist -= sqrt ((.5 ** 2) + (inth ** 2)) end if if intballx < 102 then intw := intw * -1 elsif intballx >= 150 and intballx <= 200 then if intbally < 250 then if intbally >= 240 then if inth < 0 then inth := inth * -1 end if else intw := intw * -1 end if end if elsif intballx >= 248 and intballx <= 302 then if intbally >= 195 then if intbally <= 205 then if inth > 0 then inth := inth * -1 end if else intw := intw * -1 end if end if elsif intballx >= 373 then intw := intw * -1 end if drawhole1 (round (intballx), round (intbally), blnpress, false) if intbally > 373 or intbally <= 77 then View.Update inth := inth * -1 delay (i) if inth > 0 then intbally := (intbally + relslope) div 1 elsif inth < 0 then intbally := (intbally - relslope) div 1 end if drawhole1 (round (intballx), round (intbally), blnpress, false) end if distance := round (sqrt (((intballx - 333) ** 2) + ((intbally - 353) ** 2))) if distance <= 5 then if i <= 8 then exit end if end if put distance View.Update delay (40 - i) end if end for exit when distance <= 5 end for exit when distance <= 5 end for exit when distance <= 5 View.Set ("nooffscreenonly") end loop put "you took ", intshots, "shots." [/code] |
Author: | Dan [ Thu Apr 24, 2003 5:55 pm ] |
Post subject: | |
that's prity cool for only 200 lines. looks like your in the lead for now |
Author: | Tony [ Thu Apr 24, 2003 6:03 pm ] |
Post subject: | |
thats preaty sweet... and defenetly the lead so far I'd love to see the full version uploaded as exe in submitions |
Author: | DarkHelmet [ Thu Apr 24, 2003 7:59 pm ] |
Post subject: | |
I'll post it as soon as I write it. |
Author: | AsianSensation [ Thu May 08, 2003 4:08 pm ] |
Post subject: | Christmas Carol |
I'm game, I thought I was going to use this code when Christmas comes around, but I guess now is as good as any other time. I think the indenting is going to be a problem, but if i don't leave them all in one line, then there will be breaks when turing executes the play procedure. But it is well under 200 lines. |
Author: | Tony [ Thu May 08, 2003 4:23 pm ] |
Post subject: | |
AHAHA Awesome. I think someone was looking for notes to song like that before. cool, although I dont like X-mas songs... |
Author: | bugzpodder [ Thu May 22, 2003 4:37 pm ] |
Post subject: | |
I dont think i've submitted this one. and unfortunately i lost the source. but if i remember correctly, with all the comments i think its around 250-300. lines. but i am not sure. anywayz, download it by selecting chess at http://www.geocities.com/bugz_podder/ its all pixels, no gif graphics |
Author: | Grey_Wolf [ Sat Jun 07, 2003 2:24 pm ] |
Post subject: | dog fight game |
i don't think this contest is still going on but regardless i'll enter. this is dogfight game its a little glitchy and loops forever because i had to cut it down to 200 lines . the controls are the arrow keys and space bar. |
Author: | Andy [ Sat Jun 07, 2003 2:28 pm ] |
Post subject: | |
rrriiiittteee, darkness and marijuwana is illegal in canada |
Author: | Homer_simpson [ Sat Jun 07, 2003 2:35 pm ] |
Post subject: | |
take a look at my avatar... |
Author: | Martin [ Sat Jun 14, 2003 8:46 pm ] |
Post subject: | |
Grey_Wolf is the winner. Congratulations, you get 100 bits! |
Author: | Grey_Wolf [ Sun Jun 15, 2003 10:01 pm ] |
Post subject: | |
Yes , congradulations me. |
Author: | AsianSensation [ Mon Jun 16, 2003 6:52 pm ] |
Post subject: | |
What, and I worked so hard on those music pieces.... oh well, congratulations Grey_Wolf |
Author: | Andy [ Mon Jun 16, 2003 7:24 pm ] |
Post subject: | |
what music pieces |
Author: | nate [ Mon Jun 16, 2003 9:57 pm ] |
Post subject: | |
earlier in the post!!! *Slaps dodge in the face* |
Author: | Andy [ Tue Jun 17, 2003 10:32 am ] |
Post subject: | |
*steels asok's flame thrower and burns nate in to crisp |
Author: | SilverSprite [ Wed Jun 18, 2003 1:02 pm ] |
Post subject: | |
dodge_tomahawk wrote: rrriiiittteee, darkness and marijuwana is illegal in canada
Marijuana is no longer illegal in Ontario so long as it is carried in quantities less than 30 grams i think it is.. |
Author: | JayLo [ Wed Jun 18, 2003 1:08 pm ] |
Post subject: | |
Same sex marriages too... nasty. |
Author: | Andy [ Wed Jun 18, 2003 2:59 pm ] |
Post subject: | |
and they got married in a church, wtf is wrong with this word |
Author: | BlAcK TuRtLe [ Wed Jun 18, 2003 3:28 pm ] |
Post subject: | |
same sex marriages aren;t all that bad. after all there will be alot more lesbians around |
Author: | JayLo [ Wed Jun 18, 2003 3:48 pm ] |
Post subject: | |
... whatever turns you on, black turtle. |
Author: | Andy [ Wed Jun 18, 2003 3:51 pm ] |
Post subject: | |
well considering that they are lesbians, i dun think they'll go after u |
Author: | JayLo [ Wed Jun 18, 2003 3:59 pm ] |
Post subject: | |
lol that's right. only in his fantasies then... |
Author: | Grey_Wolf [ Mon Jun 23, 2003 9:05 am ] |
Post subject: | |
marijuana is still illegal in ontario. firstly that law has yet to be past. secondly the law just states that if you have less than 15 grams you won't have a criminal record. It'll get taken away and you will get a fine. decriminilized not legalized |
Author: | void [ Mon Jun 23, 2003 9:12 am ] |
Post subject: | |
if your a minor and u have under 30g on u...u get a call home, and the MJ is taken away, if ur major, u get a fine |