In this, you will create a Java game using recursion. The game includes three recursive stages “Hit the Bell,” “Reach the Goal,” and ”Loss the Game.” -- 2
Budget: ₹1,500 – ₹12,500 INR
Objective:
Implement appropriate algorithms for the given problem.
Problem Specifications
In this, you will create a Java game using recursion. The game includes three recursive stages “Hit the Bell,” “Reach the Goal,” and ”Loss the Game.” The game starts by asking the player to enter a number between 30 and 100 inclusive (you should validate the input before proceeding in the game). The entered value will be the parameter N to the “Hit the Bell” stage. You should generate a sequence of numbers using Hailstone Sequences in this stage. If the sequence reaches 58, the player moves to the “Reach the Goal” stage. Otherwise, the sequence ends with one and the player moves to the “Loss the Game” stage. For more details about each stage, check the following sections.
Remember, you will not get any score if you did not use recursion to implement the methods called in the three stages.
Hit the Bell Stage
You will write a Hailstone Sequence method to generate a hailstone sequence of numbers. The sequence starts with positive integer n and always ends with one by following the rules below
- If n is 1, then the sequence ends.
- If n is an even number, then the next number in the sequence is n/2
- If n is an odd number, then the next number in the sequence is (3 * n) + 1
Reach the Goal Stage
In this stage, you will write a recursive method called the Winner Fractal Pattern method that generates a Fractal pattern. The method accepts a positive integer numberOfLetters that is equal to the user’s entered number divided by 8 to generate the pattern. In the following example numberOfLetters is 8.
Loss the Game Stage
In this stage, you will write a recursive method called the Looser Message that generates a repeated message. The method accepts a positive integer numberOfMessages that is equal to the user’s entered number divided by 10 to generate the pattern. In the following example, numberOfMessages is equal to 5.
Rest of the program
You should divide your program into methods called by the main method and the other methods to complete the game as specified above. The program should continue asking the player if they would like to play the game again or not.
Use JavaFX to implement UI of the game.
Implement appropriate algorithms for the given problem.
Problem Specifications
In this, you will create a Java game using recursion. The game includes three recursive stages “Hit the Bell,” “Reach the Goal,” and ”Loss the Game.” The game starts by asking the player to enter a number between 30 and 100 inclusive (you should validate the input before proceeding in the game). The entered value will be the parameter N to the “Hit the Bell” stage. You should generate a sequence of numbers using Hailstone Sequences in this stage. If the sequence reaches 58, the player moves to the “Reach the Goal” stage. Otherwise, the sequence ends with one and the player moves to the “Loss the Game” stage. For more details about each stage, check the following sections.
Remember, you will not get any score if you did not use recursion to implement the methods called in the three stages.
Hit the Bell Stage
You will write a Hailstone Sequence method to generate a hailstone sequence of numbers. The sequence starts with positive integer n and always ends with one by following the rules below
- If n is 1, then the sequence ends.
- If n is an even number, then the next number in the sequence is n/2
- If n is an odd number, then the next number in the sequence is (3 * n) + 1
Reach the Goal Stage
In this stage, you will write a recursive method called the Winner Fractal Pattern method that generates a Fractal pattern. The method accepts a positive integer numberOfLetters that is equal to the user’s entered number divided by 8 to generate the pattern. In the following example numberOfLetters is 8.
Loss the Game Stage
In this stage, you will write a recursive method called the Looser Message that generates a repeated message. The method accepts a positive integer numberOfMessages that is equal to the user’s entered number divided by 10 to generate the pattern. In the following example, numberOfMessages is equal to 5.
Rest of the program
You should divide your program into methods called by the main method and the other methods to complete the game as specified above. The program should continue asking the player if they would like to play the game again or not.
Use JavaFX to implement UI of the game.
Related categories:
Business, Accounting, Human Resources & Legal
Algorithm
JavaFX
C++ Programming
Java Tutoring