home *** CD-ROM | disk | FTP | other *** search
- on shuffle
- templist1 = []
- templist2 = []
- repeat with rank in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
- repeat with suit in ["hearts", "clubs", "spades", "diamonds"]
- templist1.add([#rank: rank, #suit: suit])
- end repeat
- end repeat
- repeat while templist1.count > 0
- tempholder = templist1[random(templist1.count)]
- templist2.add(tempholder)
- templist1.deleteOne(tempholder)
- end repeat
- repeat with i = 1 to templist2.count
- repeat with n in ["ace_hearts", "two_hearts", "four_diamonds", "six_clubs", "eight_spades", "two_diamonds", "three_clubs", "four_spades"]
- if (templist2[i].getProp(#rank) & "_" & templist2[i].getProp(#suit)) <> n then
- next repeat
- end if
- templist2.deleteAt(i)
- if i > templist2.count then
- exit repeat
- end if
- end repeat
- end repeat
- return templist2
- end
-
- on reshuffle wasted
- tempist2 = []
- repeat with i = 1 to wasted.count
- tempist2.add([#rank: wasted[i].rank, #suit: wasted[i].suit])
- end repeat
- wasted.deleteAll()
- sprite(4).visible = 0
- return tempist2
- end
-
- on checkwin
- global deals, win, pootimer, waste, stock
- po = 0
- if stock.cards.count = 0 then
- repeat with i = 1 to 4
- if member("ftext" & string(i)).text <> "C" then
- exit repeat
- end if
- po = po + 1
- if po < 4 then
- next repeat
- end if
- win = "yes"
- if not (the timeOutList).findPos(timeout("poo")) then
- pootimer = timeout("poo").new(150, #gotoit)
- end if
- exit
- end repeat
- po = 0
- if (stock.cards.count = 0) and (waste.count = 0) then
- repeat with i = 1 to 4
- if waste[waste.count].rankvalue = value(member("ftext" & string(i)).text) then
- exit repeat
- end if
- po = po + 1
- if po < 4 then
- next repeat
- end if
- win = "no"
- pootimer = timeout("poo").new(150, #gotoit)
- exit
- end repeat
- end if
- end if
- end
-
- on gotoit
- global pootimer
- pootimer.forget()
- go("gameover")
- end
-