View.Set ("graphics:max,max") var rollcount : array 1 .. 6 of int := init (0, 0, 0, 0, 0, 0) var font : int := Font.New ("sans serif:18:bold") var die : int var mx, my, mb : int var spot : int := 0 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) process playmusic Music.PlayFile ("360.mp3") end playmusic fork playmusic proc loadhorses (var horses : array 1 .. 6 of int) for i : 1 .. upper (horses) horses (i) := Pic.FileNew ("horse" + 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) amounts (i) := 1000 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%main line var horses : array 1 .. 6 of int put "name", " ", "cash amount", " ", "bet amount", " ", "horse beting on" names (name) amount (amounts) spend (spends) bet (bets) randomize loadhorses (horses) loop drawfillbox (0, 0, maxx, maxy, green) drawline (900, 0, 900, 620, black) drawline (899, 0, 899, 620, black) drawline (898, 0, 898, 620, black) drawline (700, 0, 700, 0, brown) for i : 1 .. 6 rollcount (i) := 0 end for loop mousewhere (mx, my, mb) if mb = 1 then spot := my div 80 end if if mb = 1 and spot <= 6 and my < 500 then rollcount (spot) += 10 end if delay (4) randint (die, 1, 6) rollcount (die) := rollcount (die) + 1 Pic.Draw (horses (die), rollcount (die), die * 80, picCopy) drawfillbox (0, die * 80, rollcount (die), die * 80 + 50, green) Font.Draw ("finish", 870, 625, font, black) Font.Draw (intstr (die), 10, die * 80, font, black) exit when rollcount (die) >= 850 end loop Font.Draw ("Fatty " + intstr (die) + " is the winner!", 400, 350, font, black) delay (800) 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) end for for i : 1 .. 6 locate (1 + i, 37) get spends (i) locate (1 + i, 59) get bets (i) end for end loop