
-----------------------------------
Artimes
Tue Nov 04, 2003 8:17 pm

Dot Racing Game
-----------------------------------
I just wanted to say hi, I'm new to this forum. I'm in grade 10, and I attend Ander C. V. I. in Whitby Ontario Canada.

This is my Dot Racing Game, quite fun!

(I just used the name "Andrew's Race Way")


% Andrew's Race Way
% Created by: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  0 and wager = 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 = 1) and (startcredits  0 and wager = 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 