home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / BetsyRoss.dxr / 00065.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.0 KB  |  79 lines

  1. on shuffle
  2.   templist1 = []
  3.   templist2 = []
  4.   repeat with rank in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
  5.     repeat with suit in ["hearts", "clubs", "spades", "diamonds"]
  6.       templist1.add([#rank: rank, #suit: suit])
  7.     end repeat
  8.   end repeat
  9.   repeat while templist1.count > 0
  10.     tempholder = templist1[random(templist1.count)]
  11.     templist2.add(tempholder)
  12.     templist1.deleteOne(tempholder)
  13.   end repeat
  14.   repeat with i = 1 to templist2.count
  15.     repeat with n in ["ace_hearts", "two_hearts", "four_diamonds", "six_clubs", "eight_spades", "two_diamonds", "three_clubs", "four_spades"]
  16.       if (templist2[i].getProp(#rank) & "_" & templist2[i].getProp(#suit)) <> n then
  17.         next repeat
  18.       end if
  19.       templist2.deleteAt(i)
  20.       if i > templist2.count then
  21.         exit repeat
  22.       end if
  23.     end repeat
  24.   end repeat
  25.   return templist2
  26. end
  27.  
  28. on reshuffle wasted
  29.   tempist2 = []
  30.   repeat with i = 1 to wasted.count
  31.     tempist2.add([#rank: wasted[i].rank, #suit: wasted[i].suit])
  32.   end repeat
  33.   wasted.deleteAll()
  34.   sprite(4).visible = 0
  35.   return tempist2
  36. end
  37.  
  38. on checkwin
  39.   global deals, win, pootimer, waste, stock
  40.   po = 0
  41.   if stock.cards.count = 0 then
  42.     repeat with i = 1 to 4
  43.       if member("ftext" & string(i)).text <> "C" then
  44.         exit repeat
  45.       end if
  46.       po = po + 1
  47.       if po < 4 then
  48.         next repeat
  49.       end if
  50.       win = "yes"
  51.       if not (the timeOutList).findPos(timeout("poo")) then
  52.         pootimer = timeout("poo").new(150, #gotoit)
  53.       end if
  54.       exit
  55.     end repeat
  56.     po = 0
  57.     if (stock.cards.count = 0) and (waste.count = 0) then
  58.       repeat with i = 1 to 4
  59.         if waste[waste.count].rankvalue = value(member("ftext" & string(i)).text) then
  60.           exit repeat
  61.         end if
  62.         po = po + 1
  63.         if po < 4 then
  64.           next repeat
  65.         end if
  66.         win = "no"
  67.         pootimer = timeout("poo").new(150, #gotoit)
  68.         exit
  69.       end repeat
  70.     end if
  71.   end if
  72. end
  73.  
  74. on gotoit
  75.   global pootimer
  76.   pootimer.forget()
  77.   go("gameover")
  78. end
  79.