PLEASE USE JAVA AND JFRAME GUI) Game rules: The game consists of a two-dimensional field of size m × n (game field). Each element of the game field is a button with a number assigned to it. Initialization of the game: • The numbers on the buttons of the game field are set to a random digit between 0 and 9 • The target value is displayed above the game field • The current sum of the numbers displayed on the buttons of the game field is printed below the game field • The number of moves to completion is displayed in the upper right corner above the game field. Playing: The first move is determined by the player by selecting any button (button A) on the game field. 1. The player is allowed to choose a second button (button B) located in the column or row of the previously selected button (A). 2. Upon selecting the second button (B), the value of button (A) is updated according to the following formula: A = (AoperationB)mod10. 3. The operation for the basic game will be +. 4. Decrement the number of moves and repeat from step 1, using the previously selected button (B) as the current button (A). Continue until the move counter is greater than 0. Goal of the game: The sum of the numbers on the buttons of the game field should be as close as possible to the target value displayed above the game field. If at the end of the move counter, the sum of the numbers on the buttons of the game field is greater than the target value, the player has lost the game. Task requires: (points in parentheses): • development of a user interface that allows playing (a different game field each time), with each new game launch we get a new arrangement (random) • development of a user interface that saves the game field to a file (during play, allows selection of the game field arrangement from the file) • game control menu (new game, setting the size of the game field, setting the number of moves, setting the target value) • upgrade of the game control menu: the option to choose the difficulty level (easy, medium, hard), the set difficulty should affect the target value and the number of moves to completion. • upon the expiration of the move counter, the graphical user interface should show the player if they have lost the game, or show the difference in points from the target value. • current mathematical operation - add a component to the right side of the game field that displays the current mathematical operation. The current mathematical operation is used in step Playing 2 instead of the + operation. The current mathematical operation only applies for one move, and after the move a new mathematical operation is randomly selected that will be evaluated in the next move. Choose from the following mathematical operations: +, −, ∗, / • upgrade of current mathematical operation - the next m mathematical operations are displayed on the right side of the game field, and the current operation is highlighted. ATTENTION! • Pay attention to the correct use of basic elements of object-oriented programming - static methods are forbidden, define individual modules of the program as standalone classes. • Pay attention to correct use of contracts!
(PLEASE USE JAVA AND JFRAME GUI)
Game rules:
The game consists of a two-dimensional field of size m × n (game field). Each element of
the game field is a button with a number assigned to it.
Initialization of the game:
• The numbers on the buttons of the game field are set to a random digit between 0
and 9
• The target value is displayed above the game field
• The current sum of the numbers displayed on the buttons of the game field is printed
below the game field
• The number of moves to completion is displayed in the upper right corner above the
game field.
Playing:
The first move is determined by the player by selecting any button (button A) on the
game field.
1. The player is allowed to choose a second button (button B) located in the column
or row of the previously selected button (A).
2. Upon selecting the second button (B), the value of button (A) is updated according
to the following formula: A = (AoperationB)mod10.
3. The operation for the basic game will be +.
4. Decrement the number of moves and repeat from step 1, using the previously selected
button (B) as the current button (A). Continue until the move counter is greater
than 0.
Goal of the game:
The sum of the numbers on the buttons of the game field should be as close as possible
to the target value displayed above the game field. If at the end of the move counter, the
sum of the numbers on the buttons of the game field is greater than the target value, the
player has lost the game.
Task requires: (points in parentheses):
• development of a user interface that allows playing (a different game field each time),
with each new game launch we get a new arrangement (random)
• development of a user interface that saves the game field to a file (during play, allows
selection of the game field arrangement from the file)
• game control menu (new game, setting the size of the game field, setting the number
of moves, setting the target value)
• upgrade of the game control menu: the option to choose the difficulty level (easy,
medium, hard), the set difficulty should affect the target value and the number of
moves to completion.
• upon the expiration of the move counter, the graphical user interface should show
the player if they have lost the game, or show the difference in points from the target
value.
• current mathematical operation - add a component to the right side of the game
field that displays the current mathematical operation. The current mathematical
operation is used in step Playing 2 instead of the + operation. The current mathematical operation only applies for one move, and after the move a new mathematical
operation is randomly selected that will be evaluated in the next move. Choose from
the following mathematical operations: +, −, ∗, /
• upgrade of current mathematical operation - the next m mathematical operations
are displayed on the right side of the game field, and the current operation is highlighted.
ATTENTION!
• Pay attention to the correct use of basic elements of object-oriented programming -
static methods are forbidden, define individual modules of the program as standalone
classes.
• Pay attention to correct use of contracts!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 13 images