A simple ruby program for randomly grading the affection level between two partners. This project is part of the programming tasks for beginners series.
The program is a game of chance that takes the names of two partner's and assign them a random love grade. It then displays an accompanying message based on the assigned grade. For instance, in the image above, the user enters their name and their partner's name, they got a love grade of 90% and their display is as follow: Jackie Chan and Angie Jolie, your love is 90% strong. Awwwn... You both seem to always be in each other's thoughts. Never let go!
The program also has a cheat feature that let's a user put their names and their partner's in two separate arrays. It then returns 100% whenever two names from these arrays are paired for a grading.
- Ruby programming language
- RSpec
To set up a local version of this project, a collection of steps have been put together to help guide you from installations to usage. Simply follow the guide below and you'll be up and running in no time.
- Install git
- Install the Ruby programming language, if you haven't already.
- Open Terminal
- Navigate to the preferred location/folder you want the game on your local machine. Use
cd <file-path>
for this. - Run
git clone https://github.com/Moreneecoder/love-calculator.git
to download the game source file.
-
Rubocop: This is a tool for checking code quality and ensuring they meet the requirements. Don’t worry about this if you’re not a developer. Microverse provides a wonderful setup guide for rubocop here.
-
RSpec: This is a tool for testing the effectiveness of the program's logic at every step. Again, don’t worry about this if you’re not a developer. To set up RSpec:
- run
gem install rspec
in your terminal. This should install rspec globally on your local machine. - run
rspec --version
. This should display your rspec version if successfully installed. - run
rspec
to see passing and failing tests.
- run
At this point, you now have everything you need to properly run the program (source code, ruby, rspec, rubocop). If not, refer back to the setup section of this documentation.
To get the game running, follow the instructions below:
- run
bin/main.rb
in the terminal. You should make sure your terminal is navigated to the current directory of the program. Now you should see a message that says Love Calculator and a prompt to enter your name.
NOTE: You may have been used to using the
ruby main.rb
bash command - where main.rb is your file name - to run ruby codes. But we use thebin/main.rb
command here because our file has been made executable.
- Enter your name and hit enter. You should now get a second prompt requesting your partner's name.
- Enter your partner's name and hit enter as well.
- You should now get a random grade and an accompanying message for you and your partner's love or whatever the program think it is, haha.
-
To use the program's cheat feature:
- open the projects calculator.rb file (you can find this in the lib folder).
- Go to the #assign_score method and replace the names in the cheat_usernames array with some of your names. Replace the names in the cheat_partner_names with your partner's as well.
- run
bin/main.rb
again. - Enter one of your names as is in the array and one of your partner's name too.
- This time it should always give a grade of 100% whenever either of your names in the arrays are paired.
-
That's it! Happy Testing!
👤 ** Morenikeji Fuad Bello**
- GitHub: @Moreneecoder
- Twitter - @mo_bello19
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
- Micoverse for the rubocop setup link
- Commander Coriander for the ruby executable link
This project is MIT licensed.