Lab 3 (Multi-Level Undo Redo)
Learning Objectives
The purpose of this lab is to give you an opportunity to learn the following skills:
- Refactoring existing code if necessary.
- Learning how to implement multi-level undo redo.
- Applying object-oriented design principles to develop an elegant solution.
Implementing Multi-Level Undo and Redo in the FreeCell Game
For this lab, please do the following activities:
- If necessary, refactor/redesign your initial solution based on the design principles you’ve seen in the lectures and labs.
- Make a plan how you are going to implement undo and redo. Discuss your plan with the lab instructor and make sure that you understand the requirements of the multi-level undo redo features. Being able to design an elegant solution is one of this lab’s main objectives, so please put significant effort to come up with a good design.
- Add the multi-level undo and redo features to your FreeCell implementation. Please ask questions if you need clarification.
Evaluation Criteria
This lab has a total of 100 marks and is worth 6% of your final grade. The marks will be allocated as follows:
- 70%: the correctness of your solution.
- 20%: the overall quality of your solution.
- 10%: documentation using Javadoc
Submission
Submit your complete source code (i.e., ZIP your project folder) to Blackboard before the due date.
Example (user input is underlined):
F0: []
F1: []
F2: []
F3: []
H0: []
H1: []
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠, 8♠, A♣]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠, A♥]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): T0 H0
F0: []
F1: []
F2: []
F3: []
H0: [A♣]
H1: []
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠, 8♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠, A♥]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): T3 H1
F0: []
F1: []
F2: []
F3: []
H0: [A♣]
H1: [A♥]
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠, 8♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): T0 F0
F0: [8♠]
F1: []
F2: []
F3: []
H0: [A♣]
H1: [A♥]
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): U
F0: []
F1: []
F2: []
F3: []
H0: [A♣]
H1: [A♥]
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠, 8♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): U
F0: []
F1: []
F2: []
F3: []
H0: [A♣]
H1: []
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠, 8♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠, A♥]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): R
F0: []
F1: []
F2: []
F3: []
H0: [A♣]
H1: [A♥]
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠, 8♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): R
F0: [8♠]
F1: []
F2: []
F3: []
H0: [A♣]
H1: [A♥]
H2: []
H3: []
T0: [6♦, Q♠, 8♥, 3♠, A♠]
T1: [10♦, J♥, 9♣, 4♣, 8♦, Q♦, J♣]
T2: [4♦, J♠, 5♦, 5♠, 2♠, 9♥, 6♣]
T3: [K♣, 8♣, 4♠, 7♣, K♦, 10♠]
T4: [Q♣, 6♥, 4♥, 10♥, 7♥, 7♠]
T5: [3♣, K♥, 3♦, 2♥, 10♣, Q♥]
T6: [A♦, 9♦, 5♥, K♠, 7♦, J♦]
T7: [6♠, 2♦, 9♠, 3♥, 2♣, 5♣]
Your move <from to> (0 to exit, U to undo, R to redo): R
Nothing to redo.
Your move <from to> (0 to exit, U to undo, R to redo):