[Edu-sig] Cards n stuff...

Jeffrey Elkner jeff@elkner.net
13 Mar 2001 11:58:37 -0500


Thanks, Guido, but PySol is *WAY* too difficult for 1st year students.
The GUI isn't seperated from the logic, so they would need to
have a good understanding of TkInter to be able to make any
sense of it.  They are getting their first exposure to OOP, so I wanted
and example that was simple.

Here is what I gave them:

class Card:
  def __init__(self, suite, rank):
    self.suite = suite
    self.rank = rank

class Deck:
  def __init__(self):
    self.cards = []
    for suite in range(4):
      for rank in range(1, 14):
        newCard = Card(suite, rank)
        self.cards.append(newCard)

The game will be text based, so what I am looking for is
a simple example with shuffle methods, etc.

On 13 Mar 2001 07:27:52 -0500, Guido van Rossum wrote:
>> Hi All!
>> 
>> Could anyone point me to some good examples of classes for
>> cards and decks, with shuffle methods, etc.
>> 
>> I have a student writing a blackjack program, so the info
>> would be a big help.  Thanks.
>> 
>> jeff
> 
> Try PySol.
> 
> http://wildsau.idv.uni-linz.ac.at/mfx/pysol/
> 
> --Guido van Rossum (home page: http://www.python.org/~guido/)