MemoryGame Story Notes
Story 12: Game GUI
The Game GUI should rely on the model to do the game logic and maintain
the game data structures. The GUI may maintain "gui" state such as if
we are showing the play screen or the welcome screen. The GUI should
also hold the specifics about visual representations (images and gui
components).but it relies upon the model to obtain game/card state.
There should be a Continue button
that lets the user signal to the game that it is time to process the
cards that have been flipped. Pressing the Continue button should send
a message to the model just as pressing the card buttons does. The
Continue button should only be enabled when it makes sense (gui should
verify with model and enable only when appropriate)
Story 70: Welcome/Credits/Help
The "Welcome/Credits" screen should mention the team and members by
name and show the team picture. Pictures are available here:
teamAddy, teamDemd, teamKojo, teamKyan
If you can summarize the game rules in a few lines, you can place the
help information here as well. A more detailed help screen is a low
priority at this point.
Story 80: Scores - Counting Mistakes
Follows the guiding principle that a mistake results if a known card is
flipped without making it match. In other words, if you had a perfect
memory the only reason you would flip a known card would be to form a
match This means that since one turn flips 2 cards, we might have from
0 to 2 mistakes during a single turn. The mistakes count is not updated
on the interface until after the Continue button is pressed. An example
JUnit test was given in a handout.
public void testCountMistakes() {
MatchGameModel model = new
MatchGameModel();
int gameSize = 8;
model.setGameSize(gameSize);
int[] defaultPos = { 0, 1, 2, 3,
4, 5, 6, 7 };
model.setPositions(defaultPos);
int[][] card1Card2Mistakes = { { 0,
3, 0 }, // 2 unseen cards
{ 0, 3, 2}, //
flip the exact same cards -> 2 mistakes
{ 1, 0, 2}, //
match a pair unseen & seen -> no additional mistake
{ 2, 5, 2}, //
2 unseen cards -> no additional mistakes
{ 4, 2, 3}, //
1 unseen and 1 repeat -> 1 more mistake
{ 3, 2, 3}, //
match 2 seen cards -> no additional mistakes
{ 6, 7, 3}, //
2 unseen cards match -> no additional mistakes
{ 5, 4,
3} // last pair match -> no additional mistakes
};
int n = card1Card2Mistakes.length;
assertEquals("Expected mistakes
at start", 0, model.getNumMistakes());
for (int m=0; m<n; m++) {
int mistakes = model.getNumMistakes();
model.pickCardByPos(card1Card2Mistakes[m][0]);
assertEquals("no change after 1st
card", mistakes, model.getNumMistakes());
model.pickCardByPos(card1Card2Mistakes[m][1]);
assertEquals("no change after 2nd
card", mistakes, model.getNumMistakes());
model.doContinue();
assertEquals("Mistakes updated
after continue", card1Card2Mistakes[m][2], model.getNumMistakes());
}
model.doContinue();
assertEquals("New Game again,
expect no mistakes", 0, model.getNumMistakes());
}
Story 100: Take Back
The player is allowed to make one take back move per turn of the card
most recently played (1st or 2nd card). To perform a take back, the
player picks the card just played (there
is no special "take back" button). The game treats the
card as if that first flip did not occur. (See HO for expected
behavior).
Story 110: Magic Match
By holding the control key down while clicking on a card, the player is
protected from not making a match. If possible (because it doesn't
contradict what the player has seen), a matching card will be swapped
to the location of the second card pick. If this would result in a
contradiction, the game will refuse to allow that position to be
picked. (See HO for expected behavior).