home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Czarina.dxr / Internal_4.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  797 b   |  28 lines

  1. global stock, foundation, reserve, waste, points
  2.  
  3. on prepareFrame me
  4.   stock = new(script("card pile"))
  5.   stock.cards = shuffle()
  6.   foundation = [:]
  7.   reserve = [:]
  8.   points = 0
  9.   waste = new(script("card pile"))
  10. end
  11.  
  12. on shuffle
  13.   ranks = ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
  14.   suits = ["hearts", "diamonds", "clubs", "spades"]
  15.   unshuffledCards = []
  16.   shuffledCards = []
  17.   repeat with rank in ranks
  18.     repeat with suit in suits
  19.       unshuffledCards.add([#rank: rank, #suit: suit])
  20.     end repeat
  21.   end repeat
  22.   repeat while unshuffledCards.count > 0
  23.     shuffledCards.add(unshuffledCards[random(unshuffledCards.count)])
  24.     unshuffledCards.deleteOne(shuffledCards[shuffledCards.count])
  25.   end repeat
  26.   return shuffledCards
  27. end
  28.