View.Set ("graphics:max,max")
var font1, font2, font4 : int
font2 := Font.New ("blizzardD:60:bold")
font4 := Font.New ("Copperplate Gothic Bold:24:bold")
font1 := Font.New ("Palatino:12:bold")
proc intro
var horseracing : int := Pic.FileNew ("horseracing10.jpg")
var name : string
var horsenumber : int
var mx, my, mb : int
Pic.Draw (horseracing, 100, 100 div 2, picCopy)
Font.Draw ("WELCOME TO ", 450, 550, font2, blue)
Font.Draw ("HORSE RACING ", 100, 100, font2, blue)
Font.Draw ("Click Here to", 550, 300, font4, blue)
Font.Draw ("Place Your Bets", 550, 275, font4, blue)
loop
mousewhere (mx, my, mb)
if mb = 1 and mx > 550 and mx < 850 and my < 320 and my > 275 then
exit
end if
end loop
cls
end intro
proc loadhorsepics (var horsenames : array 1 .. * of int)
for i : 1 .. upper (horsenames)
horsenames (i) := Pic.FileNew ("horse" + intstr (i) + ".jpg")
end for
end loadhorsepics
proc horseshow (horsenames : array 1 .. * of int)
for i : 1 .. upper (horsenames)
Font.Draw (intstr (i), i * 100, 350, font4, blue)
Pic.Draw (horsenames (i), i * 100, 400, picCopy)
end for
end horseshow
proc GetBet (var betname : array 1 .. 4 of string, var horsenum_bet : array 1 .. 4 of int, var betnum : array 1 .. 4 of int, var money : array 1 .. * of int)
Font.Draw ("WELCOME TO THE BETTING BOARD", 200,600, font4, blue)
Font.Draw ("FOUR PLAYERS CAN BET", 250, 550, font4, blue)
Font.Draw ("Choose From Any 6 Horses...", 100,470, font4, blue)
for i : 1 .. 4
locate (25, 3)
put "Enter Name ", i
get betname (i)
put "Enter Horse Nubmer ", i
get horsenum_bet (i)
put "Enter Amount of Bet ", i, " you have ", money (i)
get betnum (i)
money (i) := money (i) - betnum (i)
locate (25, 3)
put ""
put ""
put ""
put ""
put ""
put ""
end for
end GetBet
proc race (horsenames : array 1 .. * of int, var horsenum_bet : array 1 .. 4 of int, var betname : array 1 .. 4 of string, var betnum : array 1 .. 4 of int, var money : array 1 .. * of int)
var rollcount : array 1 .. 6 of int := init (0, 0, 0, 0, 0, 0)
var horse : int
cls
for i : 1 .. 10000
randint (horse, 1, 6)
rollcount (horse) := rollcount (horse) +1 delay(1)
drawfillbox (0, horse * 80, rollcount (horse) - 1, horse * 80 + 50, white)
Pic.Draw (horsenames (horse), rollcount (horse), horse * 80, picCopy)
drawline (950, 0, 950, maxy, red)
locate (2, 110)
put "FINISH LINE"
delay (1)
exit when rollcount (horse) = 888
end for
delay (1000)
cls
for i : 1 .. 4
locate (i * 2, 1)
put betname (i)
if horsenum_bet (i) = horse then
locate (i * 2, 10)
put "Winner"
money (i) := money (i) + betnum (i) * 6
else
locate (i * 2, 10)
put "Loser"
end if
locate (i * 2, 20)
put "Your money is now:"
locate (i * 2, 50)
put money (i)
end for
end race
%proc outroscreen (var horse : int, )
%for i : 1 .. 4
% locate (i * 2, 1)
% put betname (i)
%
% if horsenum_bet (i) = horse then
% locate (i * 2, 10)
% put "Winner"
% money (i) := money (i) + betnum (i) * 6
% else
% locate (i * 2, 10)
% put "Loser"
%
%end if
%locate (i * 2, 20)
% put "Your money is now:"
%locate (i * 2, 50)
%put money (i)
%end for
%end outroscreen
%%%%%%%%%%mainline%%%%%%
var horsenames : array 1 .. 6 of int
var horse : int
var betname : array 1 .. 4 of string
var horsenum_bet : array 1 .. 4 of int
var betnum : array 1 .. 4 of int
var money : array 1 .. 4 of int := init (200, 200, 200, 200)
intro
loadhorsepics (horsenames)
horseshow (horsenames)
GetBet (betname, horsenum_bet, betnum, money)
race (horsenames, horsenum_bet, betname, betnum, money)
%outroscreen