Starting from:

$40

CS3733- Assignment IP. Part 1 And 2 Solved

Individual Project 
Your task is to develop a small standalone application in Java to enable a user to play a mathematical game on a 3x3 grid of tiles where each tile can contain a positive integer.

The goal is to reduce 9 integers into a single value in the center of the grid, using a sequence of moves. Each move consists of a starting tile containing a number and a target tile containing a number. If the move is valid, the starting tile is cleared and the target tile is recomputed, as follows:

Move Right to add: Move 1 right to 7, to add 1 to 7, resulting in 1+7 = 8

Move Left to subtract: Move 4 left to 6, to subtract 4 from 6, resulting in 6 - 4 = 2

Move Up to multiply: Move 5 up to 7, to multiply 7 by 5, resulting in 5 x 7 = 35

Move Down to divide: Move 1 down to 2, to divide 1 into 2, resulting in 2 ¸ 1 = 2; valid only if the result is an integer

One solution above is: Move 3 Right, Move 2 Up, Move 2 Right, Move 5 Up, Move 8 Up, Move 4 Down, Move 18 Left, Move 9 Down. Solution!

When you start your application, the puzzle will be in its initial state. Note there are four possible starting configurations, and each student will be assigned one for this project (see initial configurations in Canvas).

From this initial state, the user can quit the application or reset the puzzle to its original configuration.

Moving a tile is a two-step operation. First, the user uses the mouse to select a starting tile by clicking on it. Next the user requests to move the tile either up, down, left, or right one square (this could be done by

https://canvas.wpi.edu/courses/22068/assignments/142719                                                                                                                                          1/2

detecting the key press of one of the arrow keys, or you could have four buttons for up, down, left, or right, or you could do a drag/swipe action which is a bit complicated in Java). Naturally only valid moves should be allowed.

When only the center tile contains a value, the user has won, and should be congratulated! If the user has not won and is unable to make a valid move, the user has lost, and should be consoled.

2
In the final implementation, you must ensure that:

You draw empty tiles by filling color in a solid color, such as gray, with no value visible.
When just a single tile remains in the center square with a value, it must be filled with a different color (such as yellow).
Upon a request to close the application window, the user must be prompted with a dialog window to confirm the request.
The second deliverable contains a fully operational implementation of this project. I expect you will create an Eclipse project, in which to place your code, and you will zip up and submit the entire workspace  project containing your solution.

This deliverable will contain:

Fully operational code that meets all requirements

Fully tested using JUnit test cases that demonstrates 80% code coverage of the src/ folder

Initial Configuration
Based on the last digit of your student ID, select one of the four puzzles to start as your initial configuration.

Final Notes
If the graders are unable to compile your code because of an incompatible Java version or operating system, they will be instructed to "try to get things to run" but only within reason. You are responsible for making sure that your code will run on a different computer. This is a useful exercise in any software engineering class! Note: if you use a different development environment, such as IntelliJ, be advised that the graders may not have this tool installed. As much as possible, try to avoid unexpected and arbitrary dependencies on special software frameworks or artifacts located only on your computer.

You may be receive a penalty if the effort to get your code to compile is too high.

Sample Solutions
Here are four possible solutions that yield "11" in the center location. The formatting is condensed, and describes the board "row by row" as I hope you can see. The final solution appears each time after eight moves.

Initial position (0 1)
[7, 2, 8][1, 4, 9][6, 3, 5]

[0, 9, 8][1, 4, 9][6, 3, 5]

[0, 1, 0][1, 4, 9][6, 3, 5]

[0, 0, 0][1, 4, 9][6, 3, 5]

[0, 0, 0][0, 5, 9][6, 3, 5]

[0, 0, 0][0, 5, 9][0, 9, 5]

[0, 0, 0][0, 5, 9][0, 4, 0]

[0, 0, 0][0, 20, 9][0, 0, 0]

[0, 0, 0][0, 11, 0][0, 0, 0]

Initial position (2 3 4)
[5, 9, 6][8, 7, 3][4, 2, 1]

[0, 14, 6][8, 7, 3][4, 2, 1]

[0, 8, 0][8, 7, 3][4, 2, 1]

[0, 8, 0][8, 7, 3][0, 6, 1]

[0, 8, 0][8, 7, 3][0, 6, 0]

[0, 8, 0][8, 4, 0][0, 6, 0]

[0, 8, 0][8, 24, 0][0, 0, 0]

[0, 0, 0][8, 3, 0][0, 0, 0]

[0, 0, 0][0, 11, 0][0, 0, 0]

Initial position (5, 6)
[3, 6, 8][9, 1, 2][4, 5, 7]

[0, 6, 8][3, 1, 2][4, 5, 7]

[0, 0, 14][3, 1, 2][4, 5, 7]

[0, 0, 14][3, 1, 2][0, 9, 7]

[0, 0, 14][3, 9, 2][0, 0, 7]

[0, 0, 14][0, 12, 2][0, 0, 7]

[0, 0, 14][0, 12, 14][0, 0, 0]

[0, 0, 0][0, 12, 1][0, 0, 0]

[0, 0, 0][0, 11, 0][0, 0, 0]

Initial position (7 8 9)
[1, 4, 3][7, 2, 5][9, 8, 6]

[0, 4, 3][7, 2, 5][9, 8, 6]

[0, 1, 0][7, 2, 5][9, 8, 6]

[0, 0, 0][7, 2, 5][9, 8, 6]

[0, 0, 0][7, 2, 5][0, 17, 6]

[0, 0, 0][7, 34, 5][0, 0, 6]

[0, 0, 0][0, 41, 5][0, 0, 6]

[0, 0, 0][0, 41, 30][0, 0, 0]

[0, 0, 0][0, 11, 0][0, 0, 0]

 

 

More products