● Project Description:
The game program called Stick, Water, Fire - is a version of the game Rock, Paper, Scissors. The user plays against the computer. The program uses conditional expressions in several ways in this project. Using Java’s Randomclass the program generates random outcomes that are then used in the game as the computer’s choice. The Random class can be seeded so that development and testing can be more easily done. Another aspect of this project is the use of a private method in a class.
● Project Goals:
-> Work with multi-file Java projects.
-> Write instance variables and methods.
-> Use a private method in a class.
-> Work with conditionals.
-> Work with the Random class.
-> Learn and use String methods
-> Practice testing and debugging.
● Project Background
The goal is to make a fun and interactive game for users. The user will be able to enter their choice of Stick, Water, or Fire. The computer will also make a choice, and the winner will be chosen based on the following three rules:
-
Stick beats Water by floating on top of it
-
Water beats Fire by putting it out
-
Fire beats Stick by burning it
The user is prompted to enter S, W or F (Note that the input can be upper or lower case). The computer then makes its choice (randomly generated) and the program applies the game rules to the user and computer’s choices. The user and computer’s scores are recorded as well as the number of rounds played. Ties result in no increase in either user or computer scores, but the round is counted.
● Code Structure:
This project contains the following important folders:
-> src: This is the source folder which consists of a java file that implements the algorithm of the game and an main file to run the game.
● Contributing
If you want to contribute to this project and make it better with new ideas, your pull request is very welcomed. If you find any issue just put it in the repository issue section, thank you.