BeginnerProjects icon indicating copy to clipboard operation
BeginnerProjects copied to clipboard

Feature/rps improvements

Open Bhoomi070 opened this issue 2 months ago • 0 comments

Hello! This Pull Request refactors the Rock Paper Scissor game to improve code organization and maintainability.

  1. Object-Oriented Refactor: The entire game logic has been moved from main.cpp into a dedicated RockPaperScissor class (rockpaperscissor.hpp and rockpaperscissor.cpp).
    • This cleans up main.cpp significantly (now only a few lines).
    • It separates concerns and makes the code easier to test and extend.
  2. Added Makefile: A standard Makefile is included to simplify building and running the project on Unix-like systems (Linux, macOS, WSL).
    • make build compiles the code.
    • make run compiles and executes the game.
  3. Improved RNG: The Random Number Generator (rand()) is properly seeded using std::srand and std::time in the constructor to ensure different outcomes on subsequent runs.
  4. Updated README: The build instructions in README.md are updated to reflect the use of the Makefile and the new compilation command.

This is a meaningful contribution for Hacktoberfest! Let me know if you have any feedback.

Bhoomi070 avatar Oct 31 '25 17:10 Bhoomi070