View.Set ("graphics:max,max")
proc loadhorses (var horses : array 1 .. 6 of int)
for i : 1 .. upper (horses)
horses (i) := Pic.FileNew ("h" + intstr (i) + ".jpg")
end for
end loadhorses
proc names (var name : array 1 .. 6 of string)
for i : 1 .. upper (name)
get name (i)
end for
end names
proc bet (var bets : array 1 .. 6 of int)
for i : 1 .. upper (bets)
locate (1 + i, 59)
get bets (i)
end for
end bet
proc amount (var amounts : array 1 .. 6 of int)
for i : 1 .. upper (amounts)
end for
end amount
proc spend (var spends : array 1 .. 6 of int)
for i : 1 .. upper (spends)
locate (1 + i, 37)
get spends (i)
end for
end spend
%%%%%%%%%%%%%%%Mainline %%%%%%%%%%%%%%%%%%%55
var rollcount : array 1 .. 6 of int := init (0, 0, 0, 0, 0, 0)
var die : int
var fin : int := Pic.FileNew ("finish.jpg")
var horses : array 1 .. 6 of int
var name : array 1 .. 6 of string
var bets : array 1 .. 6 of int
var spends : array 1 .. 6 of int
var amounts : array 1 .. 6 of int := init (1000, 1000, 1000, 1000, 1000, 1000)
var font : int
drawfillbox (0, 0, maxx, maxy, green)
Pic.Draw (fin, maxx - 200, 0, picCopy)
font := Font.New ("sans serif:18:bold")
put "name", " ", "cash amount", " ", "bet amount", " ", "horse beting on"
names (name)
amount (amounts)
spend (spends)
bet (bets)
loadhorses (horses)
loop
randint (die, 1, 6)
rollcount (die) := rollcount (die) + 2
Pic.Draw (horses (die), rollcount (die), die * 100 - 100, picCopy)
drawfillbox (0, die * 100 - 100, rollcount (die), die * 100, green)
delay (5)
exit when rollcount (die) >= maxx - 200
end loop
Font.Draw ("HORSE" + intstr (die) + "WON!", 500, 500, font, black)
delay(10)
cls
for i : 1 .. 6
amounts (i) := amounts (i) - spends (i)
if bets (i) = die then
amounts (i) := amounts (i) + spends (i) * 2
end if
end for
put "name", " ", "cash amount", " ", "bet amount", " ", "horse beting on"
for i : 1 .. 6
locate (1 + i, 1)
put name (i)
locate (1 + i, 16)
put amounts (i)
locate (1 + i, 37)
put spends (i)
locate (1 + i, 59)
put bets (i)
end for