Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 having trouble with betting system in my slot machine
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
j_mysterr




PostPosted: Wed Jan 23, 2013 8:59 pm   Post subject: having trouble with betting system in my slot machine

What is the problem you are having?
whenever i get 2 or 3 identical pictures, it subtracts the bet instead of addin coins (betting section n lines



Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<setscreen ("graphics:max,max")

var pic1, pic2, pic3, pic4, pic5, pic6, s1, s2, s3, r1, r2, r3, bet, coin, z : int

coin := 6
const row := 5
const col := 38
const h := maxy div 1.5
const gap := h div 10
const w_w := h div 3.04
const w := 4 * gap + 3 * w_w

var x, y : int

x := (maxx - w) div 2
y := (maxy - h) div 2


const a := x + gap + w_w
const a1 := y + h - gap - w_w
const b := x + gap
const b1 := y + h - gap
const c := x + 2 * gap + w_w
const c1 := y + h - gap - w_w
const d := x + 2 * gap + 2 * w_w
const d1 := y + h - gap
const e := x + 3 * gap + 2 * w_w
const e1 := y + h - gap - w_w
const f := x + 3 * gap + 3 * w_w
const f1 := y + h - gap

drawfillbox (x, y, x + w, y + h, 114)

drawfillbox (a, a1, b, b1, white)
drawfillbox (c, c1, d, d1, white)
drawfillbox (e, e1, f, f1, white)


pic1 := Pic.FileNew ("buf.jpg")     %1 - 9
pic2 := Pic.FileNew ("den.jpg")     %10 - 18
pic3 := Pic.FileNew ("min.jpg")     %19 - 25
pic4 := Pic.FileNew ("saints.jpg")     %26 - 29
pic5 := Pic.FileNew ("nfll.jpg")     % 30
pic6 := Pic.FileNew ("loser.jpg")


randomize

for i : 1..60


    locate (row, col)
    put "Coins: " ..
    put coin

    locate (row, col + 70)
    put "Bet: " ..
    get bet

    coin := coin - bet
    locate (row, col + 7)
    put coin

    randint (r1, 1, 30)
    randint (r2, 1, 30)
    randint (r3, 1, 30)
    exit when z = 60


    if z < 20 then

        if r1 < 10 then
            Pic.Draw (pic1, a - w_w, a1, picCopy)
            delay (40)
        elsif r1 < 19 then
            Pic.Draw (pic2, a - w_w, a1, picCopy)
            delay (40)
        elsif r1 < 26 then
            Pic.Draw (pic3, a - w_w, a1, picCopy)
            delay (40)
        elsif r1 < 30 then
            Pic.Draw (pic4, a - w_w, a1, picCopy)
            delay (40)
        elsif r1 = 30 then
            Pic.Draw (pic5, a - w_w, a1, picCopy)
            delay (40)
        end if

    elsif z = 20 then

        if s1 < 10 then
            Pic.Draw (pic1, a - w_w, a1, picCopy)
            delay (40)
        elsif s1 < 19 then
            Pic.Draw (pic2, a - w_w, a1, picCopy)
            delay (40)
        elsif s1 < 26 then
            Pic.Draw (pic3, a - w_w, a1, picCopy)
            delay (40)
        elsif s1 < 30 then
            Pic.Draw (pic4, a - w_w, a1, picCopy)
            delay (40)
        elsif s1 = 30 then
            Pic.Draw (pic5, a - w_w, a1, picCopy)
            delay (40)
        end if
    end if

    if z < 40 then

        if r2 < 10 then
            Pic.Draw (pic1, c, a1, picCopy)
            delay (40)
        elsif r2 < 19 then
            Pic.Draw (pic2, c, a1, picCopy)
            delay (40)
        elsif r2 < 26 then
            Pic.Draw (pic3, c, a1, picCopy)
            delay (40)
        elsif r2 < 30 then
            Pic.Draw (pic4, c, a1, picCopy)
            delay (40)
        elsif r2 = 30 then
            Pic.Draw (pic5, c, a1, picCopy)
            delay (40)
        end if

    elsif z = 40 then

        if s2 < 10 then
            Pic.Draw (pic1, c, a1, picCopy)
            delay (40)
        elsif s2 < 19 then
            Pic.Draw (pic2, c, a1, picCopy)
            delay (40)
        elsif s2 < 26 then
            Pic.Draw (pic3, c, a1, picCopy)
            delay (40)
        elsif s2 < 30 then
            Pic.Draw (pic4, c, a1, picCopy)
            delay (40)
        elsif s2 = 30 then
            Pic.Draw (pic5, c, a1, picCopy)
            delay (40)
        end if
    end if

    if z < 60 then

        if r3 < 10 then
            Pic.Draw (pic1, e, a1, picCopy)
            delay (40)
        elsif r3 < 19 then
            Pic.Draw (pic2, e, a1, picCopy)
            delay (40)
        elsif r3 < 26 then
            Pic.Draw (pic3, e, a1, picCopy)
            delay (40)
        elsif r3 < 30 then
            Pic.Draw (pic4, e, a1, picCopy)
            delay (40)
        elsif r3 = 30 then
            Pic.Draw (pic5, e, a1, picCopy)
            delay (40)
        end if

    elsif z = 60 then

        if s3 < 10 then
            Pic.Draw (pic1, e, a1, picCopy)
            delay (40)
        elsif s3 < 19 then
            Pic.Draw (pic2, e, a1, picCopy)
            delay (40)
        elsif s3 < 26 then
            Pic.Draw (pic3, e, a1, picCopy)
            delay (40)
        elsif s3 < 30 then
            Pic.Draw (pic4, e, a1, picCopy)
            delay (40)
        elsif s3 = 30 then
            Pic.Draw (pic5, e, a1, picCopy)
            delay (40)
        end if

        if r1 = r2 and r1 = r3 then
            coin := coin + (bet * 4)
        elsif r1 = r2 or r1 = r3 or r2 = r3 then
            coin := coin + (bet * 2)
        end if

        locate (row, col + 15)
        put coin

        if coin <= 0 then
            drawfillbox (x - 1000, y, x + (w * 2), y + (h * 2), 43)

            Pic.Draw (pic6, a, c1 div 1.5, picCopy)
        end if

    end if
end loop>



Please specify what version of Turing you are using

4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jan 23, 2013 10:13 pm   Post subject: Re: having trouble with betting system in my slot machine

j_mysterr @ Wed Jan 23, 2013 8:59 pm wrote:
Describe what you have tried to solve this problem
<Answer Here>


I particularly like the feature where I can bet a negative amount to invert my odds Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: