{"id":26849664,"url":"https://github.com/ziming/bowling-game","last_synced_at":"2025-03-30T21:37:16.721Z","repository":{"id":42939946,"uuid":"114479284","full_name":"ziming/bowling-game","owner":"ziming","description":"For a job interview test. Asked to upload to Github public link","archived":false,"fork":false,"pushed_at":"2023-07-22T01:34:49.000Z","size":304,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-21T11:45:36.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ziming.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-16T17:44:31.000Z","updated_at":"2023-02-06T08:57:35.000Z","dependencies_parsed_at":"2022-09-24T09:33:27.466Z","dependency_job_id":null,"html_url":"https://github.com/ziming/bowling-game","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fbowling-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fbowling-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fbowling-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziming%2Fbowling-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziming","download_url":"https://codeload.github.com/ziming/bowling-game/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246385406,"owners_count":20768668,"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":"2025-03-30T21:37:15.171Z","updated_at":"2025-03-30T21:37:16.711Z","avatar_url":"https://github.com/ziming.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bowling Game Test\n\n## Setup\n- Just make sure PHP 7 is installed. \n- To be safe be on PHP 7.1.12 or above since that's the version on my machine\n- Make sure composer is installed and run `composer install` in project directory\n\n## Example Commands\n\n```\nphp artisan bowling:play \"[[5,2],[8,1],[6,4],[10],[0,5],[2,6],[8,1],[5,3],[6,1],[10,2,6]]\"\nphp artisan bowling:play \"[[10],[10],[10],[10],[10],[10],[10],[10],[10],[10,10,10]]\"\nphp artisan bowling:play \"[[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1]]\"\n\nphp artisan help bowling:play\n\n```\n\n## Running the tests\n\n```\nphpunit\n\nphpunit --testdox\n```\n\n## Main Files Location\n\n```\napp/Console/Commands/PlayGame.php\napp/BowlingGame.php\ntests/Features/SetInputFramesTest.php\ntests/Features/ViewScoreHistoryTest.php\n```\n\n## Requirements\nThis test is to write a program for a ten-pin bowling game.\n\nA bowler has ten frames to knock down pins. In each of 1 to 9 frames, the bowler makes 1 or 2 throws while the tenth \nframe has up to three throws.\n\nYou program should be able to receive an array of arrays of pins knocked down by each throw as an\ninput. Each number should always be an integer between 0 and 10. Each sub-array represents one\nframe of a game.\n\nThe basic rules of this bowling game are:\n\n- No additional score for a spare.\n\n-  If a bowler knocks down all ten pins on the first throw, it’s a strike. A strike is worth 10, plus\nthe score in the next frame if the next frame is not a strike. If the next frame is also a strike,\nwhich means the bowler has made two strikes, then the score from the third frame is also\nadded to the first frame.\n\nEx. 10 (first frame) +10 (second frame) +10 (third frame) results in the first frame with a score\nof 30.\n\nEx. 10 (first frame) +6 (second frame) results in the first frame with a score of 16.\n\n- If a strike is not made in a frame, the score of the frame is just the sum of pins knocked\ndown.\n\n- The last frame has up to three throws. If a bowler had a strike on the first throw, the bowler is\nallowed to have one additional throw. So the bowler has three throws in total. If the bowler\nmade two strikes he will still be able to do the last throw\n\nYour program should display a list of integers representing the total scores at the end of each frame.\n\nExample:\n\nInput: [[5,2],[8,1],[6,4],[10],[0,5],[2,6],[8,1],[5,3],[6,1],[10,2,6]]\nOutput: [7, 16, 26, 41, 46, 54, 63, 71, 78, 96]\n\nAs long as the above basic rules of this bowling games are followed, the functionality is ok even if it\ndiffers from typical rules of a bowling game.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziming%2Fbowling-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziming%2Fbowling-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziming%2Fbowling-game/lists"}