All pastes #211812 Raw Edit

pilesss

public text v1 · immutable
#211812 ·published 2006-10-20 14:28 UTC
rendered paste body
View.Set ("graphics:max,max")
var rollcount : array 1 .. 6 of int := init (0, 0, 0, 0, 0, 0)

var die : int
var mx, my, mb : int
var spot : int := 0


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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

var horses : array 1 .. 6 of int

randomize




loadhorses (horses)
drawfillbox (0, 0, maxx, maxy, green)
drawline (1000, 0, 1000, maxy, red)
loop
    mousewhere (mx, my, mb)
    if mb = 1 then
        spot := mx div 80
    end if
    if mb = 1 and spot <= 6 and my < 500 then
        rollcount (spot) += 1
    end if
    delay (10)
    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)
    exit when rollcount (die) >= maxx - 70
end loop

put "Horse Number ", die, " is the winner"