
-----------------------------------
person
Wed Jan 12, 2005 5:33 pm

need help to simplify
-----------------------------------
I typed this code for my horse race betting game to determine the winner. This part of the code is supposed to figure out which of the five horses gets first place, second place, third place, fourth... (horse one has the biggest odds of getting first). I made a code to figure it out but it takes Turing a little bit longer than forever to read it. Can u help me simplify it? Thanks

var s1, s2, s3, s4, s5, as, bs, cs, ds, es : int
    as := Rand.Int (1, 100)
    bs := Rand.Int (1, 100)
    cs := Rand.Int (1, 100)
    ds := Rand.Int (1, 100)
    es := Rand.Int (1, 100)
    if as >= 1 and as = 51 and as = 76 and as = 90 and as = 1 and bs  50 then
            s1 := 20
            exit
        elsif bs >= 51 and bs  75) then
            s2 := 20
            exit
        elsif bs >= 76 and bs  89) then
            s3 := 20
            exit
        elsif bs >= 90 and bs  96) then
            s4 := 20
            exit
        elsif bs >= 97 and bs = 1 and cs  50 and bs > 50 then
            s1 := 30
            exit
        elsif cs >= 51 and cs  75) and (bs < 51 or bs > 75) then
            s2 := 30
            exit
        elsif cs >= 76 and cs  89) and (bs < 76 or bs > 89) then
            s3 := 30
            exit
        elsif cs >= 90 and cs  96) and (bs < 90 or bs > 96) then
            s4 := 30
            exit
        elsif cs >= 97 and cs = 1 and ds  50 and bs > 50 and cs > 50 then
            s1 := 40
            exit
        elsif ds >= 51 and ds  75) and (bs < 51 or bs > 75) and (cs < 51 or cs > 75) then
            s2 := 40
            exit
        elsif ds >= 76 and ds  89) and (bs < 76 or bs > 89) and (cs < 76 or cs > 89) then
            s3 := 40
            exit
        elsif ds >= 90 and ds  96) and (bs < 90 or bs > 96) and (cs < 90 or cs > 96) then
            s4 := 40
            exit
        elsif ds >= 97 and ds  97 and bs > 97 and cs > 97 then
            s5 := 40
            exit
        else
            ds := Rand.Int (1, 100)
        end if
    end loop
    loop
        if es >= 1 and es  50 and bs > 50 and cs > 50 and ds > 50 then
            s1 := 50
            exit
        elsif es >= 51 and es  75) and (bs < 51 or bs > 75) and (cs < 51 or cs > 75) and (ds < 51 or ds > 75) then
            s2 := 50
            exit
        elsif es >= 76 and es  89) and (bs < 76 or bs > 89) and (cs < 76 or cs > 89) and (ds < 76 or ds > 89) then
            s3 := 50
            exit
        elsif es >= 90 and es  96) and (bs < 90 or bs > 96) and (cs < 90 or cs > 96) and (ds < 90 or ds > 96) then
            s4 := 50
            exit
        elsif es >= 97 and es  97 and bs > 97 and cs > 97 and ds > 97 then
            s5 := 50
            exit
        else
            es := Rand.Int (1, 100)
        end if
    end loop

-----------------------------------
Tony
Wed Jan 12, 2005 7:44 pm


-----------------------------------

put "Hourse number #", Rand.Int(1,5), " is the winner!"


I have no idea what you're doing there..

-----------------------------------
Neo
Wed Jan 12, 2005 9:40 pm


-----------------------------------
Your code appears to do nothing. :?

-----------------------------------
TheXploder
Wed Jan 12, 2005 9:49 pm


-----------------------------------
I do remember all of Paul's games exactly, he had this thread a while ago I think it'll help. http://www.compsci.ca/v2/viewtopic.php?t=3338&highlight=pauls+horse+betting

-----------------------------------
Paul
Wed Jan 12, 2005 10:23 pm


-----------------------------------
w00t, that was long ago. Yep, my old messy style.

-----------------------------------
sport
Wed Jan 12, 2005 11:41 pm


-----------------------------------
if you explain what 
var s1, s2, s3, s4, s5, as, bs, cs, ds, es : int
are I'll help you
