All pastes #229265 Raw Edit

fears gay

public text v1 · immutable
#229265 ·published 2006-10-30 15:46 UTC
rendered paste body
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)
var Change : int := Pic.FileNew ("Change.jpg")

process playmusic
    Music.PlayFile ("rocky.mp3")
end 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
randomize




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%main line



    var horses : array 1 .. 6 of int
    put "name", "           ", "cash amount", "           ", "bet amount", "           ", "Hobo betting 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)
    fork playmusic
    
    loop
        
        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)
        Pic.Draw (Change, 920, 320, picCopy)
        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 ("Hobo " + intstr (die) + " is the winner!", 400, 350, font, black)
    delay (1000)
    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", "           ", "Hobo 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 
%Music.PlayFileStop