Skip to content

mhdtwl/rps.game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

RockPaperScissors Game

This is a simple Rock-Paper-Scissors game implemented in Java. The game allows a user to play against the computer as well as another player, which randomly selects its move. It also allows for multiple rounds of play and keeps track of the score.

Note that:

I structured the code myself, focusing on clarity and maintainability of the classes/files.

Features

  • Play against the computer or another player
  • Multiple rounds of play
  • Score tracking
  • User-friendly interface Console application
  • Random move selection for the computer player
  • Input validation for user choices
  • Option to exit the game

Code Structure

  • model: Contains the entities, value object classes for the game.
  • ui: Contains the user interface classes for interacting with the player.
  • repository: Contains the classes for managing game data.
  • service: Contains the service classes for handling game operations and player interactions.

Technical

  • openjdk java 23
  • JUnit 5.13 for unit testing
  • Maven for dependency management
  • Git for version control + GitHub for repository.repository hosting
  • IntelliJ IDEA as the IDE for local development

How to Run Locally

  1. Ensure you have Java installed on your machine.
  2. Clone the repository link or download the source code (zip file).
  3. Open a terminal or command prompt.
  4. Navigate to the directory where the source code is located.
  5. Run the game using the command, Build the project first using Maven:
    `mvn clean install`
     ## in case to run using .jar -> $(which java) -jar target/Game-1.0-SNAPSHOT.jar
     $(which java) -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath target/classes RockPaperScissors 

How to Play

  1. Choose to play against the computer or another player.
  2. Select your move: Rock, Paper, or Scissors. Note that you can also use the emojis representations:
    • Rock: ✊
    • Paper: ✋
    • Scissors: ✌️ and You can even use the first letter of each (r, p, s) as well.
  3. The computer or the other player will randomly select its move.
  4. The game will determine the winner based on the rules of Rock-Paper-Scissors:
    • Rock beats Scissors
    • Scissors beats Paper
    • Paper beats Rock
    • If both players choose the same move, it is a tie.
    • The game will display the result of each round and update the score accordingly.

Future Improvements

  • Implement a graphical user interface (GUI) for a more interactive experience.
  • Implement a tutorial mode for new players.
  • Add more game modes or Currently only { Easy and Hard }.
  • Add sound effects and animations for a more engaging experience.
  • Implement a multiplayer mode over a network and Implement a leaderboard.
  • Add Localization support for different languages.
  • Implement a save/load feature to continue games later.

About

Jave console game for Rock Paper Scissors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages