Need help writing a card matching game
<p>I am  trying to write a program that plays a memory matching game. When it start, the program prompts the user for the number of rows and columns for the game board that contains the cards. The total number of cards must be even. The board dimensions are at most 8 by 9 or 9 by 8. The cards must be numbered from 1 through (number of rows * number of columns) / 2. My program allow the player to specify the cards that she/he  would like to select through a coordinate system. All the cards that are face down are indicated by *.</p>

<p>For this program I am using  three classes: Card, Deck and Game. Card stores both the card's value and face (to indicate if it is up or down). Deck contains the cards needed for the game. It will contain among its methods a method to deal a card, another for shuffling the deck, and a method that returns number of cards left in the deck. The class Game simulates playing a single game and represents the interaction between the user and the other classes. Its instance members store a 2D list (of card objects) representing the game board where the cards are placed, number of rows and number of columns of the game board. Among the instance methods of the Game class:  play(), which simulates playing the game; isGameOver(), which checks whether or not the game is over; displayBoard(), which displays the board; populateBoard(), which creates the initial 2D list of identical pairs of cards with all the cards facing down.   </p>

<p>An example of output would look something like this. </p>

<pre><code>  &gt;&gt;&gt; main()
  Enter number of rows 3
  Enter number of columns 2
  * *
  * *
  * *
  Enter coordinates for first card 1, 1
  Enter coordinates for second card 2, 1
  3 *
  3 *
  * *
  Enter coordinates for first card 1, 2
  Enter coordinates for second card 3, 1
  Not an identical pair
  3 *
  3 *
  * *
  Enter coordinates for first card 1, 2
  Enter coordinates for second card 3, 2
  3 2
  3 *
  * 2
  Enter coordinates for first card 2, 2
  Enter coordinates for second card 3, 1
  3 2
  3 1
  1 2
  &gt;&gt;&gt;   
</code></pre>

<p>My code looks something like this.  </p>



<pre><code>import random

class Card(object):
    """ A card object with a suit and rank."""

    RANKS = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)

    SUITS = ('Spades', 'Diamonds', 'Hearts', 'Clubs')

    def __init__(self, rank, suit):
        """Creates a card with the given rank and suit."""
        self.rank = rank
        self.suit = suit

    def __str__(self):
        """Returns the string representation of a card."""
        if self.rank == 1:
            rank = 'Ace'
        elif self.rank == 11:
            rank = 'Jack'
        elif self.rank == 12:
            rank = 'Queen'
        elif self.rank == 13:
            rank = 'King'
        else:
            rank = self.rank
        return str(rank) + ' of ' + self.suit.lower()


class Deck(object):
    """ A deck containing 52 cards."""

    def __init__(self):
        """Creates a full deck of cards."""
        self._cards = []
        for suit in Card.SUITS:
            for rank in Card.RANKS:
                c = Card(rank, suit)
                self._cards.append(c)

    def shuffle(self):
        """Shuffles the cards."""
        random.shuffle(self._cards)

    def deal(self):
        """Removes and returns the top card or None 
        if the deck is empty."""
        if len(self) == 0:
           return None
        else:
           return self._cards.pop(0)

    def __len__(self):
       """Returns the number of cards left in the deck."""
       return len(self._cards)

    def __str__(self): 
        """Returns the string representation of a deck."""
        result = ''
        for c in self._cards:
            result = result + str(c) + '\n'
        return result

class Game(object):

    def __init__(self, rows, columns):
        self._rows = rows
        self._columns = columns
        self._deck = Deck()
        self._deck.shuffle()

    def play(self):

    def isGameOver(self):

    def displayBoard(self):

    def populateBoard(self):
        board = [["*" for _ in range(self._rows)]for _ in range(self._columns)]
        for f in board:
            print " "
            for s in f:
                print s


def main():
    while True:
        while True:
            rows = raw_input("Enter number of rows ")
            if rows.isdigit() and ( 1 &lt;= int(rows) &lt;= 9):
                rows = int(rows)
                break
            else:
                print "    ***Number of columns must be between 1 and 9! Try again.***   "  
        while True:
            columns = raw_input("Enter number of columns ")
            if columns.isdigit() and ( 1 &lt;= int(columns) &lt;= 9):
                columns = int(columns)
                break
            else:
                print "    ***Number of columns must be between 1 and 9! Try again.***"

        if rows * columns % 2 == 0:
            break
        else:
            print "    ***The value of rows X columns must be even. Try again.***"

        game = Game(rows, columns)
        game.play()
</code></pre>

<p>In the game class I was wondering how  I should start the play method,assign a number to the cards to have identical pairs, and how i should create the initial 2d list of identical pairs of cards with them facing down in the populateBoard method?</p>
