Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+4 votes
asked in CSC201 by (8 points)

1 Answer

+1 vote

The Board class can't see the X drawn on a card, but each card has an instance variable matched that stores True if the card was matched (ie. an X was drawn) and False if the card has not been matched.

Using a variable of type Card (officially a Card object or instance of the Card class), the method getMatched from the Card class is called and its return value True/False gives the information needed for that card.

It is only when all of the cards on the game board return True from getMatched that the entire board must be filled with matched cards.

Note: getMatched is a method and so must be called using card object.getMatched()

answered by (8 points)
edited by