BeginnerProjects
BeginnerProjects copied to clipboard
Feature/rps improvements
Hello! This Pull Request refactors the Rock Paper Scissor game to improve code organization and maintainability.
-
Object-Oriented Refactor: The entire game logic has been moved from
main.cppinto a dedicatedRockPaperScissorclass (rockpaperscissor.hppandrockpaperscissor.cpp).- This cleans up
main.cppsignificantly (now only a few lines). - It separates concerns and makes the code easier to test and extend.
- This cleans up
-
Added Makefile: A standard
Makefileis included to simplify building and running the project on Unix-like systems (Linux, macOS, WSL).-
make buildcompiles the code. -
make runcompiles and executes the game.
-
-
Improved RNG: The Random Number Generator (
rand()) is properly seeded usingstd::srandandstd::timein the constructor to ensure different outcomes on subsequent runs. -
Updated README: The build instructions in
README.mdare updated to reflect the use of theMakefileand the new compilation command.
This is a meaningful contribution for Hacktoberfest! Let me know if you have any feedback.