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

Username:   Password: 
 RegisterRegister   
 Best "Anything" in 20 Lines (Choose Your Language)
Index -> Contests
Goto page Previous  1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
[Gandalf]




PostPosted: Fri Sep 15, 2006 5:47 pm   Post subject: (No subject)

Heh, glad my program is getting all this attention. Although I most certainly didn't plagiarize it from those trusty Turing help files... It's purely original coding.

The problem I see with the 80 column limit is that the code will become even more obfusciated than it would with just a line limit.
code:
fcn f(n:int):int if n<=1then result 1 else result n*f(n-1)end if end f put f(4)

Code like that (and worse) is not good for the eyes...

Does 80 columns seem like too few now?
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Fri Sep 15, 2006 5:54 pm   Post subject: (No subject)

an 80 column limit sounds good, if you have only one statement on the line however (eg for an if statement) i think it should be allowed to break the 80 column limit, i have already recieved a perfectly viable entry from Wolf_Destiny which is in actuality 18 lines
richcash




PostPosted: Fri Sep 15, 2006 6:15 pm   Post subject: (No subject)

Yeah, so since there is already a submission, let's keep the limit off. However, this seems like an ok idea for a future contest. I can imagine how bad it would get, especially in the above line from [Gandalf] with no spaces (to save even more room). But then I guess the marker of the program could first check if it meets the requirements (20 x 80) and indent it afterwards to actually read it!

regarding [Gandalf] : I agree that that's not plagiarism. That's like saying put "a" is plagiarism because someone has done it before. If it's from your own head it's not plagiarism as far as I can see (even if the Turing help files do have the same one, not sure!). Although this random colour circle program is silly to argue over [and NikG was joking!], it could be an issue for other complicated programs.
[Gandalf]




PostPosted: Fri Sep 15, 2006 6:25 pm   Post subject: (No subject)

Yeah. Since you didn't seem to notice, I was being a little sarcastic. Surprised
richcash




PostPosted: Fri Sep 15, 2006 6:53 pm   Post subject: (No subject)

Yeah, lol Laughing , I know nothing about that was serious if I failed to express this (that's what I get for trying to over-explain things over the internet!)
I am no longer referring to [Gandalf]'s program.
What I was trying to say was that if you learn something from someone else and use it in a different context, that's not plagiarism. For example, I'm sure there will be people using the famous method that involves this function (something like this) :
code:
fcn equalize (cond : boolean, var a : int, b : int) : boolean
     if cond then
          a := b
     end if
     result false
end equalize

because the function can be used for almost anything simple and you can call it as many times as you want with exit when on the same line (and it will never exit because it's always false!).

I believe this was first introduced by Catalyst, in the old contest : http://www.compsci.ca/v2/viewtopic.php?t=5539&start=0. In my opinion it's ok to use this if you understand what it means and you don't make a pong game with it. I'm not sure if you give credit in a situation like this, because it can easily be seen how it works and you can make it yourself in a different context. That was the point I was trying to bring up.
Clayton




PostPosted: Sun Sep 17, 2006 8:13 pm   Post subject: (No subject)

alright guys, screenshots will be posted of submitted entries, so here you go:

By: Wolf_Destiny

Posted Image, might have been reduced in size. Click Image to view fullscreen.

now get to coding Very Happy
zylum




PostPosted: Sun Sep 17, 2006 11:54 pm   Post subject: (No subject)

why dont people just post their code here like in the last one? that made it funner and more competative.. for me atleast Wink
Clayton




PostPosted: Mon Sep 18, 2006 12:51 pm   Post subject: (No subject)

if you wish to post your source thats fine, if not just PM it Surprised
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Wed Sep 20, 2006 4:58 pm   Post subject: (No subject)

alright guys, lets get some more entries, i now have 3 turing entries and one VB entry, keep em coming, post your source up here if you feel like it Razz
[Gandalf]




PostPosted: Wed Sep 20, 2006 6:21 pm   Post subject: (No subject)

Fine, I present Gandalf's Attempt at Trippy Graphics in 17 Lines in Turing:
code:
/* Gandalf's Attempt at Trippy Graphics in 17 Lines in Turing */
var a, b1x, b1y : array 1 .. 10 of int := init (36, 36 * 2, 36 * 3, 36 * 4, 36 * 5, 36 * 6, 36 * 7, 36 * 8, 36 * 9, 36 * 10)
var h, mh, od, ib, acc : int := 300
fcn cc (c : boolean, var b : int, a : int) : boolean
    if c then
        b := a
    end if
    result false
end cc
setscreen ("graphics:550;550,nobuttonbar")
loop
    exit when cc (od = 300, od, -1) | cc (acc = 300, acc, 0) | cc (ib = 300, ib, 10)| cc (h > mh| h < -mh, od, -od) | cc (h > mh| h < -mh, acc, acc + 1) | cc ((h > mh| h < -mh) & acc > 8, ib, -ib)
    for i : 1 .. upper (a)
        exit when cc (true, b1x (i), round (cosd (a (i)) * h))| cc (true, b1y (i), round (sind (a (i)) * h))| cc (true, a (i), a (i) + ib) | cc (true, h, h + od)| cc (a (i) = 360, a (i), 72 * i)
        Draw.FillOval (b1x (i) + maxx div 2, b1y (i) + maxy div 2, 10, 10, round (Math.Distance (b1x (i), b1y (i), maxx div 2, maxy div 2) / 10) + 16)
    end for
    Time.DelaySinceLast (18)
end loop

Razz
Clayton




PostPosted: Wed Sep 20, 2006 6:44 pm   Post subject: (No subject)

very nice [Gandalf] Razz

i have to ask, what is the purpose of the parameter 'c' in the cc function? if it is always true, why not just have a:=b no matter what?
[Gandalf]




PostPosted: Wed Sep 20, 2006 6:49 pm   Post subject: (No subject)

It's not always true. Smile
zylum




PostPosted: Wed Sep 20, 2006 9:32 pm   Post subject: (No subject)

3d with shading and z-sorting in 18 (somewhat long) lines...

[edit] 16 lines now and some of the longer lines have been reduced a bit [/edit]

code:
setscreen ("offscreenonly,graphics:400;400,nobuttonbar,title:zylum3Dv3")
var x, y : array 1 .. 4 of int
var c : array 1 .. 78 of real := init (-1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, - 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0)
for a : 0 .. maxint
    for i : 0 .. 60 by 12
        for j : 0 .. 9 by 3
            c (74 + j div 3) := ((cosd (a / 9) * sind (a / 8) * cosd (a / 7) + sind (a / 9) * sind (a / 7)) * c (i + j + 1) - c (i + j + 2) * sind (a / 9) * cosd (a / 7) + c (i + j + 3) * cosd (a / 9) * cosd (a / 8) + c (i + j + 2) * cosd (a / 9) * sind (a / 8) * sind (a / 7))
            x (j div 3 + 1) := round ((cosd (a / 8) * cosd (a / 7) * c (i + j + 1) + c (i + j + 2) * sind (a / 7) * cosd (a / 8) - c (i + j + 3) * sind (a / 8)) * 100 / (c (74 + j div 3) + 3) + maxx div 2)
            y (j div 3 + 1) := round (((sind (a / 9) * sind (a / 8) * cosd (a / 7) - cosd (a / 9) * sind (a / 7)) * c (i + j + 1) + c (i + j + 2) * cosd (a / 9) * cosd (a / 7) + c (i + j + 3) * sind (a / 9) * cosd (a / 8) + c (i + j + 2) * sind (a / 9) * sind (a / 8) * sind (a / 7)) * 100 / (c (74 + j div 3) + 3) + maxy div 2)
        end for
        c (78) := ((x (4) - x (3)) * (y (2) - y (3)) - (y (4) - y (3)) * (x (2) - x (3))) / (2 * 10186) + 1e-3
        drawfillpolygon (x, y, (c (78) + abs(c (78))) div c (78) * 2, RGB.AddColor (c (78) + 0.25, c (78) + 0.25, c (78) + 0.25))
    end for
    View.Update
    drawfillbox(0, 0, maxx, maxy, 43)
end for
NikG




PostPosted: Thu Sep 21, 2006 12:55 am   Post subject: (No subject)

zylum, that is just plain crazy! AMAZING JOB! +bits

Gandalf, nice effect, but I personally like it better after adding a cls after your Time.DelaySinceLast (18).
Clayton




PostPosted: Thu Sep 21, 2006 7:35 am   Post subject: (No subject)

NikG, zylum's a mod Laughing

zylum, very, very nice, 3d in 18 lines

me likey very much
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 5  [ 66 Posts ]
Goto page Previous  1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: