{"id":18700922,"url":"https://github.com/rabestro/last-pencil-java","last_synced_at":"2025-11-08T22:30:43.168Z","repository":{"id":184019967,"uuid":"671177859","full_name":"rabestro/last-pencil-java","owner":"rabestro","description":"Educational project from Hyperskill.org site","archived":false,"fork":false,"pushed_at":"2023-07-26T18:13:18.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-28T05:25:21.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rabestro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-26T18:07:11.000Z","updated_at":"2023-07-26T18:07:17.000Z","dependencies_parsed_at":"2023-07-26T19:38:37.687Z","dependency_job_id":null,"html_url":"https://github.com/rabestro/last-pencil-java","commit_stats":null,"previous_names":["rabestro/last-pencil-java"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabestro%2Flast-pencil-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabestro%2Flast-pencil-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabestro%2Flast-pencil-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabestro%2Flast-pencil-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rabestro","download_url":"https://codeload.github.com/rabestro/last-pencil-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239565650,"owners_count":19660154,"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","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-11-07T11:39:47.153Z","updated_at":"2025-11-08T22:30:43.125Z","avatar_url":"https://github.com/rabestro.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Pencil Game\n\nThis project is an implementation of an educational project from Hyperskill.org.  This is the pencil game, where the user plays against the bot. In the game, players take turns to remove 1, 2, or 3 pencils from a pile. The player who takes the last pencil loses.\n\n\nThe bot is implemented with a winning strategy for specific numbers of pencils left on the table. If the bot is not in a winning position, it follows a random pattern.\n\n### How to Play\n\n1. Choose the number of pencils to use in the game.\n2. Select who will play first: the user (John) or the bot (Jack).\n3. If it's the bot's turn, the program will print the bot's move.\n4. If it's the user's turn, input the number of pencils to take (1, 2, or 3).\n5. The game continues until all pencils are taken, and the player who takes the last pencil loses.\n\nSee example games below:\n\n#### Example 1\n\n```plaintext\nHow many pencils would you like to use:\n\u003e 10\nWho will be the first (John, Jack):\n\u003e Jack\n||||||||||\nJack's turn:\n1\n|||||||||\nJohn's turn!\n\u003e 2\n|||||||\nJack's turn:\n2\n|||||\nJohn's turn!\n\u003e 1\n||||\nJack's turn:\n3\n|\nJohn's turn!\n\u003e 1\nJack won!\n```\n\n#### Example 2\n\n```plaintext\nHow many pencils would you like to use:\n\u003e 6\nWho will be the first (John, Jack):\n\u003e John\n||||||\nJohn's turn!\n\u003e 1\n|||||\nJack's turn:\n2\n|||\nJohn's turn!\n\u003e 2\n|\nJack's turn:\n1\nJohn won!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabestro%2Flast-pencil-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frabestro%2Flast-pencil-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabestro%2Flast-pencil-java/lists"}