View.Set ("graphics:600,300;position:center,center;nocursor") var lgTahoma : int := Font.New ("tahoma:16") var smTahoma : int := Font.New ("tahoma:10") var chars : array char of boolean proc Intro (var players : int) drawfill (0, 0, green, green) Font.Draw ("Welcome to the D'OC Racetrack!", 170, 275, lgTahoma, yellow) loop exit when hasch delay (50) end loop Input.Flush locate (5, 1) colorback (green) color (yellow) loop put "How many players?" get players exit when players <= 4 and players >= 1 if players > 4 then put "4 players maximum." elsif players <= 0 then put "Must have at least one player" end if end loop cls end Intro proc updateHUD (money : array 1 .. * of int) drawfillbox (10, 250, 120, 280, green) for i : 1 .. upper (money) Font.Draw ("Player " + intstr (i) + ": $" + intstr (money (i)), 10, 260 - (i * 15), smTahoma, yellow) end for end updateHUD proc newRace (var money : array 1 .. * of int, horses : array 1 .. 6 of int, var betAmount : array 1 .. * of int, var horseNum : array 1 .. * of int) Font.Draw ("The D'OC Racetrack", 180, 275, lgTahoma, yellow) updateHUD (money) for i : 1 .. 6 drawfillbox (375, 100 + (i * 24), 400, 100 + (i * 24) + 25, i) drawbox (374, 100 + (i * 24) - 1, 401, 100 + (i * 24) + 26, black) Font.Draw (intstr (i), 385, 107 + (i * 24), smTahoma, white) end for for i : 1 .. upper (money) drawfillbox (420, 245, 500, 265, green) Font.Draw ("Player " + intstr (i) + ", choose a horse:", 420, 250, smTahoma, yellow) loop Input.KeyDown (chars) if chars ('1') then horseNum (i) := 1 elsif chars ('2') then horseNum (i) := 2 elsif chars ('3') then horseNum (i) := 3 elsif chars ('4') then horseNum (i) := 4 elsif chars ('5') then horseNum (i) := 5 elsif chars ('6') then horseNum (i) := 6 end if end loop end for end newRace % ------------------------------ MAIN PROGRAM LOOP ---------------------------- var racing : boolean := false var players : int var horses : array 1 .. 6 of int := init (1, 2, 3, 4, 5, 6) Intro (players) var money : array 1 .. players of int var bet, horseChoice : array 1 .. players of int for i : 1 .. upper (money) bet (i) := 0 horseChoice (i) := 0 locate (5, 1) colorback (green) color (yellow) put "How much money does player ", i, " have? $" .. get money (i) cls end for newRace (money, horses, bet, horseChoice)