Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Memory Memory is a single player game during which players attempt to find all of the matching pairs of cards in the fewest moves
Memory Memory is a single player game during which players attempt to find all of the matching pairs of cards in the fewest moves possible. A deck of cards contains two of each unique card. The cards are shuffled and placed face down into a configuration of rows and columns. The player makes moves by choosing cards one at a time to flip face up. If two face up cards match, they are removed from the board. If two face up cards do not match, they are placed face down again. The game ends when all of the cards have been removed from the board. Use the MemoryCLI to start a game and play a few moves. Take a few minutes to examine the Memory model and command line interface that have been provided to you, including: O MemoryException O Card Move Memory O MemoryCLI Answer the following questions: O How are moves made? What happens when an invalid move is made? How does the CLI know which player's turn it is? remember which card is hiding where? Flip to match a picture poir! -No reading skills needed ANI ANA matching Game The classic game of visual recall! You will be implementing a JavaFX GUI that one person can use to play a game of Memory. Problem Solving 1 >> move 0 1 Moves: 2 Score: 0 [D][ ][ ][ ] ] [I][ ][ ] [ [][][][] [ ][ ][ ][ ] [ ][ ][ ][ ] >> move 02 2 3 Problem Solving 2 Using the example to the right, work with your team to design a rough layout for your Memory GUI on paper, a whiteboard, or the slide that follows this one. Try to indicate the type of JavaFX node used, i.e. layouts, buttons, etc. Your GUI must include at least the following features: Memory can be played with any even number of cards, but for this exercise use a 4x5 board. Indicate what kind of control you will use to display the cards, which may be face up, face down, or empty. Some means to make a move by selecting a card. A place to display a status message, e.g. feedback after a move. There must be a means to quit or restart the game. "Login" VBox "Username" (Text Field) "Password" (Text Field) HBox "OK" (Button) "Cancel" (Button) An example of a simple dialog to log in with a username and password. Color is only used to more easily tell the different controls apart. Use this example as a reference when designing your Connect Four GUI on paper, a whiteboard, or the next slide. Problem Solving 2: GUI Design 4 5 Problem Solving 3 Use the space to the left to write a factory method that will create and return the JavaFX control that a player will use to represent a card on the board. Do not worry about event handling at this time. Consider: How will you know which card was selected? What happens is the move is invalid? Be as detailed as you can, including any customization. Problem Solving 4 Like Reversi, you will need to upgrade the Memory model to implement an Observer Pattern so that your GUI can update when cards are flipped or removed. Unlike Reversi, there is no Square class that can be observed directly. Instead, the subject will be the Memory game itself. In the space to the top right, define an interface for an observer that will be notified when a card at a specific location on the board has changed, e.g. from face down to face up. In the space to the bottom right, write an event handler that will update the JavaFX control in your GUI that represents one of the spaces on the board. You may assume that any variables that you need are in scope. // observer interface // event handler 7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started