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
md




PostPosted: Thu Sep 21, 2006 9:57 am   Post subject: (No subject)

Someone wanna post a screenie of zylum's running program? Those of us lacking turing might be curious too...
Sponsor
Sponsor
Sponsor
sponsor
zylum




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

its just a rotating cube Laughing

although you can make it render more complex models, i didnt feel like initializing that array Wink
War_Caymore




PostPosted: Thu Sep 21, 2006 1:04 pm   Post subject: my entry to the 20 anything competition

this is going to be noobish, but i'm a noob programmer so i'll give this a shot...

code:
% Anything in 20 lines. By War_Caymore
View.Set ("graphics")
var font : int
var x, y : int := 0
font := Font.New ("sans serif:18:bold")
assert font > 0
Font.Draw ("Whats that?", 240, 200, font, black)
delay (3000)
cls
Font.Draw ("omigod!", 260, 200, font, black)
delay (3000)
loop
    Draw.FillOval (300, 200, x, y, red)
    x := x + 1
    y := y + 1
    exit when x = 600
    delay (10)
end loop


don't blam it too badly... i want to continue programming.
ZeroPaladn




PostPosted: Thu Sep 21, 2006 1:24 pm   Post subject: (No subject)

time for me to step up, brother. hers my lines in 12 lines.

note that the lines are not completely random, nor are they in a set order. it is both. figure it out WarCaymore.

code:
View.Set ("graphics:400;30,nobuttonbar,position:center;center")
var lines : array 1 .. 15 of int := init (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
loop
    lines (1) := Rand.Int (0, 255)
    for o : 2 .. 30 by 2
        Draw.ThickLine (0, o, 400, o, 5, lines (o div 2))
    end for
    for decreasing i : 30 .. 4 by 2
        lines (i div 2) := lines ((i div 2) - 1)
    end for
    delay (50)
end loop
NikG




PostPosted: Thu Sep 21, 2006 3:50 pm   Post subject: (No subject)

Ahh crap, I gave my bits to a mod Embarassed

Well, the contest is getting interesting, so I thought I'd put up something.
Some of you may remember I put up a SMS messenger in the visual basic section. Well it doesn't work anymore, so I'm remaking it.

There's a trick to how it works, Wink it should be obvious to figure out. Here is the 20-line "Lite" version (the actual version needs more than 20 lines).

Couple of things to remember:
  • There's no error trapping in this "lite" version, so plz dont try and mess it up intentionally
  • Once you've sent a message, you have to close and re-open the program to send another one
  • People may get charged when receiving messages. AFAIK, only rogers allows free incoming text messages.



The Extension 'exe' was deactivated by an board admin, therefore this Attachment is not displayed.

Clayton




PostPosted: Thu Sep 21, 2006 3:52 pm   Post subject: (No subject)

source? heh ill give you the bits you gave him lol
neufelni




PostPosted: Fri Sep 22, 2006 4:42 pm   Post subject: (No subject)

Here is my submission for the contest in exactly 20 lines. It is a a Sierpinski's triangle program also knows as the chaos game program. Enjoy.
code:
View.Set("graphics: max; max, title: Nick's 20 Line Sierpinski's triangle Program")
colorback(7)
cls
var x, y : array 1 .. 4 of int
var num, count, col : int := 0
loop
    if count mod 100000 = 0 or count = 0 then
        for i : 1 .. 4
            x (i) := Rand.Int (1, maxx)
            y (i) := Rand.Int (1, maxy)
        end for
        col := Rand.Int (1, 100)
        cls
    end if
    num := Rand.Int (1, 3)
    x (4) := round ((x (num) + x (4)) / 2)
    y (4) := round ((y (num) + y (4)) / 2)
    Draw.Dot (x (4), y (4), col)
    count += 1
end loop
NikG




PostPosted: Fri Sep 22, 2006 11:30 pm   Post subject: (No subject)

Nick, you're not a mod right?
Good job. +bits
Sponsor
Sponsor
Sponsor
sponsor
NikG




PostPosted: Sat Sep 23, 2006 2:01 am   Post subject: (No subject)

Here's my turing submission, a casino-style slot machine:
code:
var Slots : array 1 .. 9 of int := init (35, 64, 37, 42, 36, 1, 2, 3, 25) %array 1-5: slot pics (#@%*$), 6-8: pic location on reel, 9: start money
loop
    Slots (9) -= 1 %insert money
    for i : 1 .. 3 %have to press a key to stop each reel
        loop
            exit when hasch %"pull lever" on slot machine
            for j : i .. 3
                Slots (5 + j) += 1 + 5 * min (0, 4 - Slots (5 + j)) %formula: repeating 1..5
            end for
            put chr (Slots (Slots (6))) : 3, chr (Slots (Slots (7))) : 3, chr (Slots (Slots (8))) : 3, " " : 3, "Money: ", Slots (9)
            delay (150)
            cls
        end loop
        Input.Flush
    end for
    if Slots (6) = Slots (7) and Slots (6) = Slots (8) then %all 3 reels the same
        Slots (9) += 10 * Slots (6) %###=10, @@@=20... $$$=50
    end if
    exit when Slots (9) = 0 %money done :(
end loop
Press any key to stop each reel.

I hate using one array for all the variables, but it was the only was to get down to 20 lines. If anyone wants to see a "clean" version, let me know.
Silent Avenger




PostPosted: Sat Sep 23, 2006 7:21 pm   Post subject: (No subject)

I've made another VB program for the contest (too bad you can only enter 2 per language). It's a Picture Viewer and yes I know it has the same name as the Quicktime program but I'm not very creative with words. This will let you view thumbnails of just about any picture. Oh and Freakman I've sent you the source code in a pm.


The Extension 'exe' was deactivated by an board admin, therefore this Attachment is not displayed.

apomb




PostPosted: Mon Sep 25, 2006 12:13 am   Post subject: (No subject)

NickG: That is one addicting game you got there! Razz the stars are the funnest to try and get... +bits for sure ... its entertaining.
NikG




PostPosted: Mon Sep 25, 2006 1:09 pm   Post subject: (No subject)

CompWiz333 wrote:
NickG: That is one addicting game you got there! Razz the stars are the funnest to try and get... +bits for sure ... its entertaining.
Thanks CompWiz333.
Addicting? uh-oh... I hope my game doesn't lead you to real gambling... hahaha

Also, sure the stars are fun, but the "$" is where the real money is at!
ZeroPaladn




PostPosted: Mon Sep 25, 2006 1:15 pm   Post subject: (No subject)

lol, CompWiz333 is right. It is addicting. Too bad it is hard as hell.
War_Caymore




PostPosted: Mon Sep 25, 2006 1:22 pm   Post subject: (No subject)

here is my second try at this. i hope this is looking like a little less noobish. i ahve to thank the Turing refrence book that one of my teachers have.

code:
% The Line Noise Maker
% War_Caymore
View.Set ("graphics:225;532,title:Line Noise Maker,position:center;center,nobuttonbar")
var x, y : int := 0
var dx, dy : int := 1
loop
    if View.WhatDotColor (x, y) not= 0 then
        Music.Sound (400, 50)
    end if
    Draw.Dot (x, y, 1)
    x := x + dx
    y := y + dy
    if x = 0 or x = maxx then
        dx := -dx
    end if
    if y = 0 or y = maxy then
        dy := -dy
    end if
    Time.Delay (2)
end loop


I hope you like it. BTW, don't turn up your volume to much, it's really annoying after about half a minute or so.
ZeroPaladn




PostPosted: Mon Sep 25, 2006 1:40 pm   Post subject: (No subject)

lol, bro, i think thre is a rule against something that annoying. a rule of thumb for posting a program like that.

run it
listen or watch it for 2 mins
if you still think its cool, then post it.

either way, bravo bro!
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

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


Style:  
Search: