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

Username:   Password: 
 RegisterRegister   
 Horse game
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Xion




PostPosted: Tue Apr 08, 2008 1:05 pm   Post subject: Horse game

Cute fun little game, make bets with your friends!
_____________________________________________

code:

colorback (black)
cls
drawfillbox (600, 0, 600, 500, brightred)
var answer : string
var horsepic1 : int
var horsepic2 : int
var horsepic3 : int
horsepic1 := Pic.FileNew ("horse1.bmp")
horsepic2 := Pic.FileNew ("horse2.bmp")
horsepic3 := Pic.FileNew ("horse3.bmp")
var x1 : int := 50
var x2 : int := 50
var x3 : int := 50
var x4 : int := 50
var x5 : int := 50
var x6 : int := 50
var x7 : int := 50
var x8 : int := 50
loop
    cls
    x1 := 50
    x2 := 50
    x3 := 50
    x4 := 50
    x5 := 50
    x6 := 50
    x7 := 50
    x8 := 50
    drawfillbox (600, 0, 600, 500, brightred)

    loop
        drawfillbox (x1 - 10, 350, x1 + 32, 382, black)
        drawfillbox (x2 - 10, 300, x2 + 32, 332, black)
        drawfillbox (x3 - 10, 250, x3 + 32, 282, black)
        drawfillbox (x4 - 10, 200, x4 + 32, 232, black)
        drawfillbox (x5 - 10, 150, x5 + 32, 182, black)
        drawfillbox (x6 - 10, 100, x6 + 32, 132, black)
        drawfillbox (x7 - 10, 50, x7 + 32, 82, black)
        drawfillbox (x8 - 10, 0, x8 + 32, 32, black)
        Pic.Draw (horsepic1, x1, 350, picCopy)
        Pic.Draw (horsepic1, x2, 300, picCopy)
        Pic.Draw (horsepic1, x3, 250, picCopy)
        Pic.Draw (horsepic1, x4, 200, picCopy)
        Pic.Draw (horsepic1, x5, 150, picCopy)
        Pic.Draw (horsepic1, x6, 100, picCopy)
        Pic.Draw (horsepic1, x7, 50, picCopy)
        Pic.Draw (horsepic1, x8, 0, picCopy)
        delay (10)
        Pic.Draw (horsepic2, x1, 350, picCopy)
        Pic.Draw (horsepic2, x2, 300, picCopy)
        Pic.Draw (horsepic2, x3, 250, picCopy)
        Pic.Draw (horsepic2, x4, 200, picCopy)
        Pic.Draw (horsepic2, x5, 150, picCopy)
        Pic.Draw (horsepic1, x6, 100, picCopy)
        Pic.Draw (horsepic1, x7, 50, picCopy)
        Pic.Draw (horsepic1, x8, 0, picCopy)
        delay (10)
        Pic.Draw (horsepic3, x1, 350, picCopy)
        Pic.Draw (horsepic3, x2, 300, picCopy)
        Pic.Draw (horsepic3, x3, 250, picCopy)
        Pic.Draw (horsepic3, x4, 200, picCopy)
        Pic.Draw (horsepic3, x5, 150, picCopy)
        Pic.Draw (horsepic1, x6, 100, picCopy)
        Pic.Draw (horsepic1, x7, 50, picCopy)
        Pic.Draw (horsepic1, x8, 0, picCopy)
        delay (10)
        Pic.Draw (horsepic3, x1, 350, picCopy)
        Pic.Draw (horsepic3, x2, 300, picCopy)
        Pic.Draw (horsepic3, x3, 250, picCopy)
        Pic.Draw (horsepic3, x4, 200, picCopy)
        Pic.Draw (horsepic3, x5, 150, picCopy)
        Pic.Draw (horsepic1, x6, 100, picCopy)
        Pic.Draw (horsepic1, x7, 50, picCopy)
        Pic.Draw (horsepic1, x8, 0, picCopy)
        delay (10)
        Pic.Draw (horsepic3, x1, 350, picCopy)
        Pic.Draw (horsepic3, x2, 300, picCopy)
        Pic.Draw (horsepic3, x3, 250, picCopy)
        Pic.Draw (horsepic3, x4, 200, picCopy)
        Pic.Draw (horsepic3, x5, 150, picCopy)
        Pic.Draw (horsepic1, x6, 100, picCopy)
        Pic.Draw (horsepic1, x7, 50, picCopy)
        Pic.Draw (horsepic1, x8, 0, picCopy)
        delay (10)
        Pic.Draw (horsepic3, x1, 350, picCopy)
        Pic.Draw (horsepic3, x2, 300, picCopy)
        Pic.Draw (horsepic3, x3, 250, picCopy)
        Pic.Draw (horsepic3, x4, 200, picCopy)
        Pic.Draw (horsepic3, x5, 150, picCopy)
        Pic.Draw (horsepic1, x6, 100, picCopy)
        Pic.Draw (horsepic1, x7, 50, picCopy)
        Pic.Draw (horsepic1, x8, 0, picCopy)
        delay (10)
        x1 := x1 + Rand.Int (1, 10)
        x2 := x2 + Rand.Int (1, 10)
        x3 := x3 + Rand.Int (1, 10)
        x4 := x4 + Rand.Int (1, 10)
        x5 := x5 + Rand.Int (1, 10)
        x6 := x6 + Rand.Int (1, 10)
        x7 := x7 + Rand.Int (1, 10)
        x8 := x8 + Rand.Int (1, 10)

        exit when x1 >= 600 or x2 >= 600 or x3 >= 600 or x4 >= 600 or x5 >= 600 or x6 >= 600 or x7 >= 600 or x8 >= 600
    end loop
    color (10)
    if x1 >= 600 then
        put "Horse 1 Wins!"
    elsif x2 >= 600 then
        put "Horse 2 Wins!"
    elsif x3 >= 600 then
        put "Horse 3 Wins!"
    elsif x4 >= 600 then
        put "Horse 4 Wins!"
    elsif x5 >= 600 then
        put "Horse 5 Wins!"
    elsif x6 >= 600 then
        put "Horse 6 Wins!"
    elsif x7 >= 600 then
        put "Horse 7 Wins!"
    elsif x8 >= 600 then
        put "Horse 8 Wins!"
    end if
    put ""
    locate (13, 10)
    put "Press 'Y' to race again, press any key to exit"
    get answer
    exit when answer not= "y" and answer not= "Y"
end loop
cls
locate (13, 30)
put "Thankyou for playing!"


Pictures you'll need:

http://uploadmb.com/dw.php?id=1207637943&/horse1.bmp
http://uploadmb.com/dw.php?id=1207637963&/horse2.bmp
http://w1.uploadmb.com/dw.php?id=1207721416&/horse3.bmp

Have fun!!!

( You'll need some knowledge about importing pictures to amake it work. )
Sponsor
Sponsor
Sponsor
sponsor
petree08




PostPosted: Tue Apr 08, 2008 1:20 pm   Post subject: RE:Horse game

Why couldn't you put all the files in a zip?
Xion




PostPosted: Tue Apr 08, 2008 4:21 pm   Post subject: Re: Horse game

1. I was at school at the time, and even had trouble finding an upload site that wasnt blocked.

2. If you too lazy to download 3 tiny files, then don't ditch at me, and dont set up the game.

I really couldn't care less, I just thought I'd share my project.
gitoxa




PostPosted: Tue Apr 08, 2008 7:11 pm   Post subject: Re: Horse game

This forum supports uploading files, had you have thrown in the three pictures and the turing code into one zip it would have made for a quick easy download. He was just making a simple suggestion, not "ditching" at you.
Mackie




PostPosted: Tue Apr 08, 2008 7:23 pm   Post subject: RE:Horse game

I personally don't want to wait 45 seconds total for a download to even start, on a site probably ridden with malware, or anywhere for that matter.
Xion




PostPosted: Wed Apr 09, 2008 10:49 am   Post subject: Re: Horse game

You guys are so B itchy!

Here, it's attached

EDITED: Program in the zip file is screwy, this next attachment is the correct game.



Lotsofhorse.t
 Description:

Download
 Filename:  Lotsofhorse.t
 Filesize:  2.96 KB
 Downloaded:  155 Time(s)


Horsegame.zip
 Description:

Download
 Filename:  Horsegame.zip
 Filesize:  1.93 KB
 Downloaded:  122 Time(s)

petree08




PostPosted: Wed Apr 09, 2008 12:16 pm   Post subject: RE:Horse game

do you know about arrays yet?

cuz if you used those you could probably reduce your line count by at least 60%
Xion




PostPosted: Thu Apr 10, 2008 8:52 am   Post subject: Re: Horse game

We haven't been taught arrays yet.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: