{"id":16746985,"url":"https://github.com/selfup/rps_cli","last_synced_at":"2025-10-04T18:50:55.030Z","repository":{"id":71266612,"uuid":"86264725","full_name":"selfup/rps_cli","owner":"selfup","description":"rock paper scissors!","archived":false,"fork":false,"pushed_at":"2017-03-26T21:22:55.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T02:27:06.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selfup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-26T21:02:23.000Z","updated_at":"2017-03-26T21:02:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"1559bcb4-a9d1-4bbf-8aea-5dae804462c4","html_url":"https://github.com/selfup/rps_cli","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"976657497b25e6a0faa085b36341da86a58b7d80"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/selfup/rps_cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Frps_cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Frps_cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Frps_cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Frps_cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selfup","download_url":"https://codeload.github.com/selfup/rps_cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfup%2Frps_cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278358477,"owners_count":25973949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T02:08:49.302Z","updated_at":"2025-10-04T18:50:54.974Z","avatar_url":"https://github.com/selfup.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rock Paper Scissors\n\n### Setup\n\n`bundle`\n\n### Tests\n\nAll (similar to a rake task): `mrspec`\n\n### Gameplay\n\n3 Modes!\n\n#### Favorite: `ruby lib/game.rb favorite`\n\nThis strategy waits until you play 4 times to have some confidence that you actually have a favorite.\n\nFor example, if you pick: 'r', 's', and 'p', the computer could not know your favorite answer. If you pick 'r', 's', 'p', and 's', the computer will play your favorite move ('s').\n\nThe reason I chose to have the computer play the favorite move instead of beating it, is that the game can run a bit longer, and the tie would more than likely make the player think twice about their next move.\n\n#### Last Move: `ruby lib/game.rb last`\n\nThe last move strategy plays a random move at first, and then plays the move that would beat the last move, not the current move.\n\n#### Complex: `ruby lib/game.rb complex`\n\nThis strategy plays a random move for 5 turns, and then alternates between the favorite move and last move strategy.\n\nThis potentially enables the player to establish a 'most favorite' prior to the computer playing against the favorite or last move strategies.\n\nFor example, if the player plays: 'r' three times, and 'p' two times (while not losing to the random generator) the computer will play the 'r' move!\n\n#### In the code\n\nThere are examples of how the computer will behave above the three strategy methods inside of the `GameLogic` class.\n\nThe three methods to look for are:\n\n* `play_complex`\n* `play_favorite`\n* `play_last`\n\n### Notes\n\n* Developed with ruby 2.3.0.\n\n* Tested on Ubuntu Linux (14.04 - 15.10) with ruby 2.2.3, 2.2.4, and 2.3.0.\n\n* Tested on OSX El Capitain with ruby 2.0.0p648 and 2.3.0\n\n### Extra Notes\n\n* Test coverage is at 97.97% according to SimpleCov\n* It is quite difficult to test a REPL so some monkeypatching was needed\n* Patched the `exit` method from the `Kernel` to keep the tests running\n* Patched `run_game` to ensure that the REPL would not go in a recursive loop\n* The `game_test.rb` file accounts for Operating Systems, and will not run on BSD or Windows since backticks might not execute/can not execute\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfup%2Frps_cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfup%2Frps_cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfup%2Frps_cli/lists"}