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

Username:   Password: 
 RegisterRegister   
 HELP NEEDED PLEASE!
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jaxter




PostPosted: Fri Mar 26, 2004 3:00 pm   Post subject: HELP NEEDED PLEASE!

I have a school project and I need to pick a game and change it. I'm having problems making a figure eight raceway instead of a straight line. Here's a game that I found here.

code:
% Andrew's Race Way
% Created by: Andrew Gunn, John Baker
% Created on November 4th, 2003
% This is virtual illigal underground dot racing game

% Variables

var racer1, racer2, speed1, speed2, wager, credits, win, startcredits : int
% racer1/racer2: Represents the posistion of the racers
% speed1/speed2: Represents the speed of the two racers
% wager: Repesents the user's wager
% credits: Represents the amount of credits the user has
% win: Represents wether you have won, lost, or had a tie
% startcredits: Represents the amount of starting credits

var continue, restart, guess : string
% continue: Represents the users choice to race again
% restart: Represents the user choice to start over, if he/she has ran out of money
% guess: Represents the guess of the user

var next : char % Represents the user input of any key, to move to the next screen

% Variable Definition

win := 0
racer1 := 50
racer2 := 50
credits := 100

colourback (7)
colour (0)
cls

% Introduction

put " " : 26, "Welcome to Andrew's Race Way"
put " " : 25, "------------------------------"
put " "
put "Welcome to Andrew's Race Way!"
put " "
put "You will first choose the ammount of starting credits you want."
put " "
put "You will be biding on one of the two racers, grey or red."
put " "
put "The bidding system works as the following,"
put "you will choose the racer you think will win."
put " "
put "You will then be asked to place a bet on your racer."
put " "
put "If you win, you will get your wager back,"
put "plus double your wager on top of it!"
put " "
put "Press any key to begin."
put " "

next := getchar

cls

% Start Credits

loop

    put " " : 26, "Welcome to Andrew's Race Way"
    put " " : 25, "------------------------------"
    put " "
    put "How many credit(s) would you like to start with? (1-1000)"
    put " "

    get startcredits

    if (startcredits >= 1) and (startcredits <= 1000) then

        cls

        exit

    end if

    cls

end loop

credits := startcredits

loop

    racer1 := 50
    racer2 := 50
    wager := 0

    % User Input (Guess)
    loop

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "Which racer would you like to bid on?"
        put " "
        put "Each racer has their own speed."
        put " "
        put "Grey Racer - Will move from 2-4 spaces. (Grey) or (1)"
        put "Red Racer - Will move from 1-5 spaces. (Red) or (2)"
        put " "
        put "You have ", credits, " credit(s)."
        put " "

        get guess

        cls

        if (guess = "Grey") or (guess = "grey") or (guess = "1") or (guess = "Red") or (guess = "red") or (guess = "2") then

            exit

        end if

    end loop

    % User Input (Wager)
    loop

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "How many credits would you like to wager on your racer?"
        put " "
        put "You have ", credits, " credit(s)."
        put " "

        get wager

        cls

        if wager > 0 and wager <= credits then

            exit

        else

            cls

        end if

    end loop

    % Draws the initial images
    drawfilloval (racer1, 250, 20, 20, 8)
    drawfilloval (racer2, 150, 20, 20, 12)
    drawline (575, 300, 575, 100, 0)

    % Starts race countdown
    put " " : 26, "Welcome to Andrew's Race Way"
    put " " : 25, "------------------------------"
    put " "
    put " " : 27, "On your mark" ..

    delay (1000)

    put ", get set" ..

    delay (1000)

    put ", GO!"

    delay (500)

    cls

    % Race begins
    loop

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "

        if (guess = "Grey") or (guess = "grey") or (guess = "1") then

            put " " : 26, "You voted for the Grey Racer"

        end if

        if (guess = "Red") or (guess = "red") or (guess = "2") then

            put " " : 26, "You voted for the Red Racer"

        end if

        % Rolls to find speed of each racer
        randint (speed1, 2, 4)
        randint (speed2, 1, 5)

        % Draws images, in their new position
        drawfilloval (racer1, 250, 20, 20, 8)
        drawfilloval (racer2, 150, 20, 20, 12)
        drawline (575, 300, 575, 100, 0)

        % Calculates how far the racers have moved
        racer1 := speed1 + racer1
        racer2 := speed2 + racer2

        delay (40)

        cls

        % Stops race when first racer reaches certian point
        exit when racer1 >= 555 or racer2 >= 555

    end loop

    % Re-draws the racers
    drawfilloval (racer1, 250, 20, 20, 8)
    drawfilloval (racer2, 150, 20, 20, 12)
    drawline (575, 300, 575, 100, 0)

    % Deciding the winner (Racer one)
    if racer1 >= 555 then

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "Grey racer is the winner!"
        put " "

        if (guess = "Grey") or (guess = "grey") or (guess = "1") then % Racer one wins, and you guess for him

            put "You won ", wager * 2, " credits!"

            drawfilloval (racer1, 250, 20, 20, 8)
            drawfilloval (racer2, 150, 20, 20, 12)
            drawline (575, 300, 575, 100, 0)

            win := 1

        else % Racer one wins, and you didn't guess for him

            put "You lost ", wager, " credit(s)."

            drawfilloval (racer1, 250, 20, 20, 8)
            drawfilloval (racer2, 150, 20, 20, 12)
            drawline (575, 300, 575, 100, 0)

            win := 2

        end if

    end if

    % Deciding the winner (Racer two)
    if racer2 >= 555 then

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "Red racer is the winner!"
        put " "

        if (guess = "Red") or (guess = "red") or (guess = "2") then % Racer two wins, and you guess for him

            put "You won ", wager * 2, " credits!"

            drawfilloval (racer1, 250, 20, 20, 8)
            drawfilloval (racer2, 150, 20, 20, 12)
            drawline (575, 300, 575, 100, 0)

            win := 1

        else % Racer two wins, and you didn't guess for him

            put "You lost ", wager, " credit(s)."

            drawfilloval (racer1, 250, 20, 20, 8)
            drawfilloval (racer2, 150, 20, 20, 12)
            drawline (575, 300, 575, 100, 0)

            win := 2

        end if

    end if

    % Deciding the winner (Tie)
    if (racer1 >= 555) and (racer2 >= 555) then

        cls

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "It is a tie!"
        put " "
        put "You get your ", wager, " credit(s) back."

        drawfilloval (racer1, 250, 20, 20, 8)
        drawfilloval (racer2, 150, 20, 20, 12)
        drawline (575, 300, 575, 100, 0)

        win := 3

    end if

    % Process earnings
    if win = 1 then % Win

        credits := credits + (wager * 2)

    elsif win = 2 then % Lose

        credits := credits - wager

    elsif win = 3 then % Tie

        credits := credits

    end if

    put " "
    next := getchar

    cls

    % User Input (Continue)
    if credits > 0 then

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "You have ", credits, " credit(s)."
        put " "
        put "Would you like to race again? (Y) or (N)"
        put " "

        get continue : *

        cls

        % User Input (Yes or No)
        if (continue = "N") or (continue = "n") or (continue = "No") or (continue = "no") then

            exit

        end if

    end if

    % User Input (Restart)
    if credits = 0 then

        put " " : 26, "Welcome to Andrew's Race Way"
        put " " : 25, "------------------------------"
        put " "
        put "You have no more credits."
        put " "
        put "Would you like to restart? (Y) or (N)"
        put " "

        get restart : *

        cls

        % User Input (Yes or No)
        if (restart = "Y") or (restart = "y") or (restart = "Yes") or (restart = "yes") then

            % Start Credits
            loop

                put " " : 26, "Welcome to Andrew's Race Way"
                put " " : 25, "------------------------------"
                put " "
                put "How many credit(s) would you like to start with? (1-1000)"
                put " "

                get startcredits

                if (startcredits >= 1) and (startcredits <= 1000) then

                    cls

                    exit

                end if

            end loop

            credits := startcredits

            cls

            put " " : 26, "Welcome to Andrew's Race Way"
            put " " : 25, "------------------------------"
            put " "
            put "You now have ", startcredits, " credit(s)."
            put " "
            put "Press any key to continue."
            put " "

            next := getchar

            cls

        else

            exit

        end if

    end if

    cls

end loop

put " " : 26, "Welcome to Andrew's Race Way"
put " " : 25, "------------------------------"
put " "
put "Thanks for coming out!"
put " "
put "Hope to see you again!"
put " "
put "You are leaving with ", credits, " credit(s)."



Can someone please help me make a code so that the dots go in a figure eight. Thanks for your help.

Mod Edit: killing my eyes with the non-code-tagged text...fixed it now
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Mar 26, 2004 3:06 pm   Post subject: (No subject)

maybe you should ask Andrew Gunn or John Baker , seeing as it is their program and not yours Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AsianSensation




PostPosted: Fri Mar 26, 2004 4:07 pm   Post subject: Re: HELP NEEDED PLEASE!

Jaxter wrote:
I have a school project and I need to pick a game and change it.


When they say that, I'm assuming they want you to get a concept from a game and then make your own variation, or are is someone just retarded and want you to copy a game and change it's variable names?

I don't believe I have met a teacher that allowed plagiarizing before...therefore, that rules out the teacher being retarded....
the_short1




PostPosted: Fri Mar 26, 2004 7:11 pm   Post subject: (No subject)

also... if yo8u read the anouncement... do not make topics I NEED HELP!
second...please post as an attachment if its over 1 page long.... its anoying to scroll...

i agree with asian... ur teacher wants u to take an already writen code and modify to make it something else... hmm .... thats not cool... plagurism sucks .. Naughty .... I Kill ur Teacher (if thats the case) Sniper Sniper
Delos




PostPosted: Fri Mar 26, 2004 8:42 pm   Post subject: (No subject)

Well...either way. Making a game requires a bit of knowledge. Firstly, if and when posting code, please use the [code] tags.
Will make life easier.

Otherwise, read yourself up on such tutorials as:
Collision detection (stops cars from going outside track)
Input.KeyDown stuff
Arrays (for all sorts of stuff)
Records (for other stuff)
sport




PostPosted: Sat Mar 27, 2004 7:07 pm   Post subject: (No subject)

Hey you should grab the understanding of how the game is done and do the game yourself, and the original game as a help file.
Jaxter




PostPosted: Mon Apr 05, 2004 12:21 pm   Post subject: (No subject)

bump! = bits taken.
not_l33t




PostPosted: Mon Apr 05, 2004 1:17 pm   Post subject: (No subject)

So they told you to modify such a complex program? Are you sure dude they want you to do that? Why would they want you to modify a program like this?

A little more explaination would get someone to help you and trust you maybe.
Dan




PostPosted: Mon Apr 05, 2004 3:54 pm   Post subject: (No subject)

Where did u find this game any way?
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
the_short1




PostPosted: Mon Apr 05, 2004 6:23 pm   Post subject: (No subject)

its off compsci... Andrews Raceway...... i will post my MOd of it soon... it involves car pictures.. and a little bit better interface... (i did that at start of compsci year....) added a dodge truck... a viper... and another car tahat i forget,... instaed of circles.... so yea...Razz
Jaxter




PostPosted: Wed Apr 07, 2004 1:57 pm   Post subject: (No subject)

Yah..srry for putting my topic named "Help Needed", didn't read everything for this forum. Yah I know it's kind of weird, I thought that myself but all my teacher wants us to do is to find a turing game somewhere, use that as a guide and modify it to make it look and play better (no offense to Andrew). And I'm having problems with making the dots go in a figure 8 track instead of going in a straight line so if anyone could help me do that, it would be greatly appreciated! Smile
Jaxter




PostPosted: Mon Apr 12, 2004 5:17 pm   Post subject: (No subject)

bump! anyone??
Tony




PostPosted: Mon Apr 12, 2004 5:48 pm   Post subject: (No subject)

eh... can't you pick some other path for which you could write a function? like a circle or oval... Would be easier to plot the path then something like figure 8 Confused
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AsianSensation




PostPosted: Mon Apr 12, 2004 5:58 pm   Post subject: (No subject)

if all else fails, use whatdotcolor. That's basicly if you have nothing else you could possibly try. Then whatdotcolor it up.
Jaxter




PostPosted: Tue Apr 13, 2004 12:32 pm   Post subject: (No subject)

well, my teacher wants me to make it in a figure eight, but I guess a circle or oval would be a good start instead of it just going in a straight line.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: