# homework-3-tdd-basic-bowling-1 **Repository Path**: haohaolee/homework-3-tdd-basic-bowling-1 ## Basic Information - **Project Name**: homework-3-tdd-basic-bowling-1 - **Description**: The first homework for TDD training. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2022-12-05 - **Last Updated**: 2022-12-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TDD 作业 请以 TDD 的方式完成的 Story 1 和 Story 2。要求: * 必须按照端到端的方式拆分 Task。 * 必须在代码中使用业务语言。 * 每一个 Story 的每一个 AC 都有可能有多种业务场景。因此每一个 AC 都有可能拆分成多个 Task,形成多个业务场景的测试。 * 测试必须端到端!但是必须保持单元测试的特点,不得使用和环境相关的内容(例如,网络、特定的文件系统等等。当然这个题应该用不着)。 * 必须严格按照之前的要求,先写测试,失败,再写实现。一个测试 + 一个实现 = 一次提交。不得迈大步,不得几个测试共同生成一个大的提交。 * 测试提交的 commit message 必须使用语义化 commit message。其格式为:`#{story number} {semantic commit message}`。例如:`#1 feat: should display empty score board for a new game.` * 不限语言,可以选择你最擅长的语言。但不得使用开发框架(例如 MvC)。 # Bowling Ball (Tenpins) - USBC Rules ## Rule 2 - The Game ### 2a. Definition A game of American Tenpins consists of ten (*10*) frames. A player delivers two balls in each of the first nine frames unless a strike is scored. In the 10th frame, a player delivers three balls if a strike or spare is scored. Every frame must be completed by each player bowling in regular order. ### 2b. How Scored Except when a strike is scored, the number of pins knocked down by the player’s first delivery is to be marked next to the small square in the upper right-hand corner of that frame, and the number of pins knocked down by the player’s second delivery is to be marked inside the small square. The count for the two deliveries in the frame shall be recorded immediately. ### 2c. Strike A strike is made when the full setup of ten (*10*) pins is knocked down with the first delivery in a frame. It is marked by an (*x*) in the small square in the upper right-hand corner of the frame where it was made. The count for one strike is *10* plus the number of pins knocked down on the player’s next two deliveries. ### 2d. Double Two consecutive strikes is a double. The count for the first strike is *20* plus the number of pins knocked down with the first delivery following the second strike. ### 2e. Triple or Turkey Three successive strikes is a triple or turkey. The count for the first strike is 30. To bowl the maximum score of 300, the player must bowl 12 strikes in succession. ### 2f. Spare A spare is scored when pins left standing after the first delivery are knocked down with the second delivery in that frame. It is marked by a (/) in the small square in the upper right-hand corner of the frame. The count for a spare is 10 plus the number of pins knocked down by the player’s next delivery. ### 2g. Open An open is recorded when a player fails to knock down all 10 pins after two deliveries in a frame. # Story Split ## Story 1 - Display empty score board * **As** a player * I **would like** an empty score board displayed before a game, * **So that**, I can ensure this is a new game and I can start deliverying. ### AC 1 Display empty score board * **Given** a brand new game. * **When** no ball is delivered. * **Then** the score board printer should print an empty score board. An empty score board is made up by the following graphs: ``` [,][,][,][,][,][,][,][,][,][,,] ``` ## Story 2 - Record pin knocked down on the score board * **As** a player * I **would like** to record the pin knocked down by each frame. * **So that**, I can know the history of my performance. > Note that the incorrect knocking down count is out of scope of this acceptance critaria. We can assume that all the input should be correct. > > Also, extra input at the end of the game is also out of scope of the AC. ### AC 1 Record the pin knocked down for strike * **Given** a game * **When** the player delivers a strike * **Then** we should record the knocked down number on the correct place. * For the 1st-9th frame, when the delivery is a strike, an `x` should be recorded on the right part: e.g. `[,x]`. And there will be no other delivery in this frame. * For the last frame. However, the strike should appear on the correspond position. E.g. `[x,x,x]`, `[x,9,/]`, `[9,/,x]` ### AC 2 Record the pin knocked down for spare * **Given** a game * **When** the player delivers a spare * **Then** we should record the knocked down number on the correct place. * For the 1st-10th frame, when the frame is a spare, then the second delivery should be recorded as a `/`. E.g. `[7,/]`, `[7,/,]`, `[x,9,/]` ### AC 3 Record the pin knocked down for open * **Given** a game * **When** the player delivers an open * **Then** we should record the knocked down number on the correct place. * For the 1st-10th frame, when the frame is an open, then the number should be recorded in the correspond delivery field. E.g. `[6,3]`, `[6,3,]`, `[6,/,9]`, `[x,6,3]` ### AC 4 Record the pin knocked down in progress * **Given** a game * **When** the player make a delivery, but it does not complete the frame. * **Then** we should record the kocked down number on the correct place.