diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..c99d2e73 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..41df210d --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# gem "rails" + +gem "rspec", "~> 3.12" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..2cfabf80 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,26 @@ +GEM + remote: https://rubygems.org/ + specs: + diff-lcs (1.5.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) + +PLATFORMS + arm64-darwin-21 + +DEPENDENCIES + rspec (~> 3.12) + +BUNDLED WITH + 2.4.12 diff --git a/Makers_README.md b/Makers_README.md new file mode 100644 index 00000000..15dc4762 --- /dev/null +++ b/Makers_README.md @@ -0,0 +1,65 @@ +Bowling Challenge in Ruby +================= + +* Feel free to use google, your notes, books, etc. but work on your own +* If you refer to the solution of another coach or student, please put a link to that in your README +* If you have a partial solution, **still check in a partial solution** +* You must submit a pull request to this repo with your code by 9am Monday week + +## The Task + +**THIS IS NOT A BOWLING GAME, IT IS A BOWLING SCORECARD PROGRAM. DO NOT GENERATE RANDOM ROLLS. THE USER INPUTS THE ROLLS.** + +Count and sum the scores of a bowling game for one player. For this challenge, you do _not_ need to build a web app with a UI, instead, just focus on the logic for bowling (you also don't need a database). Next end-of-unit challenge, you will have the chance to translate the logic to Javascript and build a user interface. + +A bowling game consists of 10 frames in which the player tries to knock down the 10 pins. In every frame the player can roll one or two times. The actual number depends on strikes and spares. The score of a frame is the number of knocked down pins plus bonuses for strikes and spares. After every frame the 10 pins are reset. + +As usual please start by + +* Forking this repo + +* Finally submit a pull request before Monday week at 9am with your solution or partial solution. However much or little amount of code you wrote please please please submit a pull request before Monday week at 9am. + +___STRONG HINT, IGNORE AT YOUR PERIL:___ Bowling is a deceptively complex game. Careful thought and thorough diagramming — both before and throughout — will save you literal hours of your life. + +## Focus for this challenge +The focus for this challenge is to write high-quality code. + +In order to do this, you may pay particular attention to the following: +* Using diagramming to plan your approach to the challenge +* TDD your code +* Focus on testing behaviour rather than state +* Commit often, with good commit messages +* Single Responsibility Principle and encapsulation +* Clear and readable code + +## Bowling — how does it work? + +### Strikes + +The player has a strike if he knocks down all 10 pins with the first roll in a frame. The frame ends immediately (since there are no pins left for a second roll). The bonus for that frame is the number of pins knocked down by the next two rolls. That would be the next frame, unless the player rolls another strike. + +### Spares + +The player has a spare if the knocks down all 10 pins with the two rolls of a frame. The bonus for that frame is the number of pins knocked down by the next roll (first roll of next frame). + +### 10th frame + +If the player rolls a strike or spare in the 10th frame they can roll the additional balls for the bonus. But they can never roll more than 3 balls in the 10th frame. The additional rolls only count for the bonus not for the regular frame count. + + 10, 10, 10 in the 10th frame gives 30 points (10 points for the regular first strike and 20 points for the bonus). + 1, 9, 10 in the 10th frame gives 20 points (10 points for the regular spare and 10 points for the bonus). + +### Gutter Game + +A Gutter Game is when the player never hits a pin (20 zero scores). + +### Perfect Game + +A Perfect Game is when the player rolls 12 strikes (10 regular strikes and 2 strikes for the bonus in the 10th frame). The Perfect Game scores 300 points. + +In the image below you can find some score examples. + +More about ten pin bowling here: http://en.wikipedia.org/wiki/Ten-pin_bowling + +![Ten Pin Score Example](images/example_ten_pin_scoring.png) diff --git a/README.md b/README.md index 15dc4762..ba2600bf 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,39 @@ -Bowling Challenge in Ruby -================= +# Bowling Challenge in Ruby -* Feel free to use google, your notes, books, etc. but work on your own -* If you refer to the solution of another coach or student, please put a link to that in your README -* If you have a partial solution, **still check in a partial solution** -* You must submit a pull request to this repo with your code by 9am Monday week +This is a solution to the bowling challenge in Ruby. The challenge is to write a program that calculates the score of a bowling game. -## The Task +## How to use -**THIS IS NOT A BOWLING GAME, IT IS A BOWLING SCORECARD PROGRAM. DO NOT GENERATE RANDOM ROLLS. THE USER INPUTS THE ROLLS.** +Clone this repo and run bundle install to install the dependencies. -Count and sum the scores of a bowling game for one player. For this challenge, you do _not_ need to build a web app with a UI, instead, just focus on the logic for bowling (you also don't need a database). Next end-of-unit challenge, you will have the chance to translate the logic to Javascript and build a user interface. +To run the tests, run rspec from the command line. -A bowling game consists of 10 frames in which the player tries to knock down the 10 pins. In every frame the player can roll one or two times. The actual number depends on strikes and spares. The score of a frame is the number of knocked down pins plus bonuses for strikes and spares. After every frame the 10 pins are reset. +To run the program: -As usual please start by +run irb from the command line and require the game file. -* Forking this repo +OR -* Finally submit a pull request before Monday week at 9am with your solution or partial solution. However much or little amount of code you wrote please please please submit a pull request before Monday week at 9am. +run ruby game.rb from the command line. -___STRONG HINT, IGNORE AT YOUR PERIL:___ Bowling is a deceptively complex game. Careful thought and thorough diagramming — both before and throughout — will save you literal hours of your life. +## Diagram -## Focus for this challenge -The focus for this challenge is to write high-quality code. +INSERT DIAGRAM -In order to do this, you may pay particular attention to the following: -* Using diagramming to plan your approach to the challenge -* TDD your code -* Focus on testing behaviour rather than state -* Commit often, with good commit messages -* Single Responsibility Principle and encapsulation -* Clear and readable code +## Classes -## Bowling — how does it work? +### Game -### Strikes +The main class that controls the flow of the game. It has an `initialize` method that sets up the game with a new Frame and a new Scorecard. It also has a `roll` method which calls the roll method on the current frame and updates the Scorecard. The game continues until all frames are played. -The player has a strike if he knocks down all 10 pins with the first roll in a frame. The frame ends immediately (since there are no pins left for a second roll). The bonus for that frame is the number of pins knocked down by the next two rolls. That would be the next frame, unless the player rolls another strike. +### Frame -### Spares +Controls the rolls in a frame. It has a `roll` method that adds the score to the frame and checks if the frame is over. It also has methods to check if the frame is a strike or a spare. A frame is considered over if it's a strike or has two rolls. -The player has a spare if the knocks down all 10 pins with the two rolls of a frame. The bonus for that frame is the number of pins knocked down by the next roll (first roll of next frame). +### Scorecard -### 10th frame +Controls the score. It has an `update` method that adds the score to the total score and calculates the bonus scores for strikes and spares, updating the frame scores accordingly. It also has a method to show the scorecard, which prints the score in a readable format. -If the player rolls a strike or spare in the 10th frame they can roll the additional balls for the bonus. But they can never roll more than 3 balls in the 10th frame. The additional rolls only count for the bonus not for the regular frame count. +### Roll - 10, 10, 10 in the 10th frame gives 30 points (10 points for the regular first strike and 20 points for the bonus). - 1, 9, 10 in the 10th frame gives 20 points (10 points for the regular spare and 10 points for the bonus). - -### Gutter Game - -A Gutter Game is when the player never hits a pin (20 zero scores). - -### Perfect Game - -A Perfect Game is when the player rolls 12 strikes (10 regular strikes and 2 strikes for the bonus in the 10th frame). The Perfect Game scores 300 points. - -In the image below you can find some score examples. - -More about ten pin bowling here: http://en.wikipedia.org/wiki/Ten-pin_bowling - -![Ten Pin Score Example](images/example_ten_pin_scoring.png) +Records the score of the roll and feeds it to the Frame and Scorecard classes. \ No newline at end of file diff --git a/bowling_challenge_diagram.excalidraw b/bowling_challenge_diagram.excalidraw new file mode 100644 index 00000000..a835fb7c --- /dev/null +++ b/bowling_challenge_diagram.excalidraw @@ -0,0 +1,3549 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://marketplace.visualstudio.com/items?itemName=pomdtr.excalidraw-editor", + "elements": [ + { + "type": "text", + "version": 96, + "versionNonce": 1184092574, + "isDeleted": false, + "id": "mamRv_bvq2Ye7R0-TXcY4", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 307.9140625, + "y": 173.51953125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 230.52389526367188, + "height": 35, + "seed": 764026628, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015102, + "link": null, + "locked": false, + "fontSize": 28, + "fontFamily": 1, + "text": "Bowling Challenge", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Bowling Challenge", + "lineHeight": 1.25, + "baseline": 25 + }, + { + "type": "text", + "version": 110, + "versionNonce": 2055348034, + "isDeleted": false, + "id": "Xg34rjO4XBYC1V6KK9mr3", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 309.7890625, + "y": 236.484375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 119.99989318847656, + "height": 25, + "seed": 1562612668, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015103, + "link": null, + "locked": false, + "fontSize": 20, + "fontFamily": 1, + "text": "Ruby Version", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Ruby Version", + "lineHeight": 1.25, + "baseline": 18 + }, + { + "type": "text", + "version": 575, + "versionNonce": 2107895262, + "isDeleted": false, + "id": "KKVp53w_00Vi9Po29TkTl", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 302.359375, + "y": 627.06640625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 1319.0391845703125, + "height": 200, + "seed": 249747516, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015104, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Focus on:\n\n- Using diagramming to plan your approach to the challenge\n- TDD your code\n- Focus on testing behaviour rather than state \n(means that instead of testing the internal state of a system, you should test its external behavior or outputs)\n- Commit often, with good commit messages\n- Single Responsibility Principle and encapsulation\n(SRP is when a class or module should have only one responsibility, encapsulation is the practice of hiding implementation details and exposing a well-defined interface)\n- Clear and readable code", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Focus on:\n\n- Using diagramming to plan your approach to the challenge\n- TDD your code\n- Focus on testing behaviour rather than state \n(means that instead of testing the internal state of a system, you should test its external behavior or outputs)\n- Commit often, with good commit messages\n- Single Responsibility Principle and encapsulation\n(SRP is when a class or module should have only one responsibility, encapsulation is the practice of hiding implementation details and exposing a well-defined interface)\n- Clear and readable code", + "lineHeight": 1.25, + "baseline": 194 + }, + { + "type": "text", + "version": 356, + "versionNonce": 289466114, + "isDeleted": false, + "id": "lqxirN87sVBEs3dC0WxxP", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 308.95703125, + "y": 297.77734375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 1018.3514404296875, + "height": 300, + "seed": 574530236, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015104, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Task:\n\nDevelop a program that counts and sums the scores of a bowling game for one player.\n\nThe program should be designed for a bowling scorecard, not a game simulator.\n\nThe user should input the rolls, and random rolls should not be generated.\n\nThe program should not include a UI or database.\n\nA bowling game consists of 10 frames, and in every frame, the player can roll one or two times, depending on strikes and spares.\n\nThe score of a frame is the number of knocked down pins plus bonuses for strikes and spares.\n\nAfter every frame, the 10 pins are reset.", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Task:\n\nDevelop a program that counts and sums the scores of a bowling game for one player.\n\nThe program should be designed for a bowling scorecard, not a game simulator.\n\nThe user should input the rolls, and random rolls should not be generated.\n\nThe program should not include a UI or database.\n\nA bowling game consists of 10 frames, and in every frame, the player can roll one or two times, depending on strikes and spares.\n\nThe score of a frame is the number of knocked down pins plus bonuses for strikes and spares.\n\nAfter every frame, the 10 pins are reset.", + "lineHeight": 1.25, + "baseline": 294 + }, + { + "type": "ellipse", + "version": 454, + "versionNonce": 828891780, + "isDeleted": false, + "id": "7HfFcvp3bVlnW2pVPgHxb", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 561.1773727514892, + "y": 163.75832016588137, + "strokeColor": "#000000", + "backgroundColor": "#12b886", + "width": 53.65242375025061, + "height": 52.22996108411863, + "seed": 1617876412, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "ellipse", + "version": 587, + "versionNonce": 1667266492, + "isDeleted": false, + "id": "YzdlSaRS6UmqpXW3Akk_d", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 583.9614773687234, + "y": 184.30784253172467, + "strokeColor": "#000000", + "backgroundColor": "#000000", + "width": 6.085664587074322, + "height": 5.819706868570971, + "seed": 1467747460, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "ellipse", + "version": 503, + "versionNonce": 1523642884, + "isDeleted": false, + "id": "YTs68q0SkrC_WphKsouUI", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 585.9029113687249, + "y": 172.44181039815, + "strokeColor": "#000000", + "backgroundColor": "#000000", + "width": 6.085664587074322, + "height": 5.819706868570971, + "seed": 957019580, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "ellipse", + "version": 486, + "versionNonce": 745676860, + "isDeleted": false, + "id": "IrZp4lfEiFhorWbcnDct0", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 575.1190785939382, + "y": 175.13275052168626, + "strokeColor": "#000000", + "backgroundColor": "#000000", + "width": 6.085664587074322, + "height": 5.819706868570971, + "seed": 1771394052, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "diamond", + "version": 459, + "versionNonce": 594284932, + "isDeleted": false, + "id": "kE3VlmqBjCV0NiZZ84xfh", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 437.046875, + "y": 226.77927547932225, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 59.49237705000718, + "height": 43.612925641474746, + "seed": 887126204, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "line", + "version": 357, + "versionNonce": 641382588, + "isDeleted": false, + "id": "xqDrjVCHmNEvo4IpjTcEL", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 439.42890496528383, + "y": 248.257956608324, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 27.60101450819987, + "height": 5.733934525292214, + "seed": 1472010372, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 27.60101450819987, + 5.733934525292214 + ] + ] + }, + { + "type": "line", + "version": 341, + "versionNonce": 2054635780, + "isDeleted": false, + "id": "qVKvZUTOLIOuUFhzCVj4e", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 466.0577997986789, + "y": 254.23211470221702, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 28.46986049930719, + "height": 5.792306607382111, + "seed": 1891203588, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 28.46986049930719, + -5.792306607382111 + ] + ] + }, + { + "type": "line", + "version": 358, + "versionNonce": 2086420796, + "isDeleted": false, + "id": "EwhMQmDrpbKqdqk7wf7IO", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 466.40803229121826, + "y": 227.94896220120052, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 0.5388192192913591, + "height": 25.67024563907251, + "seed": 1406611332, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + -0.5388192192913591, + 25.67024563907251 + ] + ] + }, + { + "type": "line", + "version": 322, + "versionNonce": 930119812, + "isDeleted": false, + "id": "F1cclpJ_FTIJ3abtfTg2E", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 465.9028892731327, + "y": 268.1201800794518, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 0.08306796297408454, + "height": 12.716133575276078, + "seed": 507824572, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + -0.08306796297408454, + -12.716133575276078 + ] + ] + }, + { + "type": "line", + "version": 366, + "versionNonce": 372816316, + "isDeleted": false, + "id": "6-hGKQWcZ84YeS0A3beer", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 466.7111181020698, + "y": 229.56766493915495, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 16.22294866083067, + "height": 21.216006759597267, + "seed": 1212111364, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 16.22294866083067, + 21.216006759597267 + ] + ] + }, + { + "type": "line", + "version": 356, + "versionNonce": 303419396, + "isDeleted": false, + "id": "29myg4M9BFP6RIC-BLxZw", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 467.6181304545435, + "y": 228.82678851262946, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 16.200497860026868, + "height": 19.792625988635926, + "seed": 583393468, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + -16.200497860026868, + 19.792625988635926 + ] + ] + }, + { + "type": "line", + "version": 335, + "versionNonce": 519184956, + "isDeleted": false, + "id": "Fo8QC4n2A2PCJ3tQtL4Pb", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 452.4481243514114, + "y": 250.8510241011637, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 12.880024421143863, + "height": 17.516114787129936, + "seed": 1822816060, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 12.880024421143863, + 17.516114787129936 + ] + ] + }, + { + "type": "line", + "version": 351, + "versionNonce": 442838916, + "isDeleted": false, + "id": "Fp40DWIN48ZNGZ8id74cg", + "fillStyle": "solid", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 482.20217065669624, + "y": 251.04859114823716, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 13.434559200997887, + "height": 17.035667649928474, + "seed": 1861247036, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419922, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + -13.434559200997887, + 17.035667649928474 + ] + ] + }, + { + "type": "rectangle", + "version": 298, + "versionNonce": 225082044, + "isDeleted": false, + "id": "IrDGonIPRNy69wxDz-Ujh", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 502.12890625, + "y": 935.2578125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 195, + "height": 50, + "seed": 238475908, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "ccOsCPDJd_KJALWeJ2oja" + }, + { + "id": "uGtoe_NNXSihCV_g-GQtc", + "type": "arrow" + } + ], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 269, + "versionNonce": 1290175006, + "isDeleted": false, + "id": "ccOsCPDJd_KJALWeJ2oja", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 519.3249588012695, + "y": 950.2578125, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 160.60789489746094, + "height": 20, + "seed": 115472772, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015105, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Get Input for Roll 1", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "IrDGonIPRNy69wxDz-Ujh", + "originalText": "Get Input for Roll 1", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 518, + "versionNonce": 742638396, + "isDeleted": false, + "id": "EHcZuqT0EMF0OC_mCUnop", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 292.12890625, + "y": 934.2109375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 152, + "height": 50, + "seed": 1818812548, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "DXAfpUdanbWGAgwufq6Mi" + }, + { + "id": "tOtfXnt5atEhdgHqAMQVb", + "type": "arrow" + } + ], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 464, + "versionNonce": 1011922626, + "isDeleted": false, + "id": "DXAfpUdanbWGAgwufq6Mi", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 310.4409484863281, + "y": 949.2109375, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 115.37591552734375, + "height": 20, + "seed": 326523324, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015105, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Start Program", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "EHcZuqT0EMF0OC_mCUnop", + "originalText": "Start Program", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 415, + "versionNonce": 568327100, + "isDeleted": false, + "id": "o1AM8Mqt76F1unR7c4SQR", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 757.33984375, + "y": 936.28125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 200, + "height": 50, + "seed": 1337989820, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "rgxErKOHUx1fwQTsRe22V" + }, + { + "id": "uGtoe_NNXSihCV_g-GQtc", + "type": "arrow" + }, + { + "id": "rqaexRcMPL_SungbmClim", + "type": "arrow" + } + ], + "updated": 1682266419922, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 362, + "versionNonce": 2001505886, + "isDeleted": false, + "id": "rgxErKOHUx1fwQTsRe22V", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 773.5078964233398, + "y": 951.28125, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 167.6638946533203, + "height": 20, + "seed": 535887620, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015105, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Get Input for Roll 2", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "o1AM8Mqt76F1unR7c4SQR", + "originalText": "Get Input for Roll 2", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 397, + "versionNonce": 2019632188, + "isDeleted": false, + "id": "qHPgIWrxHcot3dz1THbrk", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1020.453125, + "y": 935.67578125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 205, + "height": 50, + "seed": 381160964, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "vgMqMBXD6vs607yRQXQCx" + }, + { + "id": "EjdgSb7EsRCBmYgVs5Z5_", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 364, + "versionNonce": 1548783234, + "isDeleted": false, + "id": "vgMqMBXD6vs607yRQXQCx", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1033.5291748046875, + "y": 950.67578125, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 178.847900390625, + "height": 20, + "seed": 1528480828, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015105, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Calculate Frame Score", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "qHPgIWrxHcot3dz1THbrk", + "originalText": "Calculate Frame Score", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 353, + "versionNonce": 631848124, + "isDeleted": false, + "id": "NMgOxJDLEM2B8T3TUUGwg", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1279.93359375, + "y": 935.55859375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 173, + "height": 50, + "seed": 204203324, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "_4XvEE01xJqacePwdUg6Q" + }, + { + "id": "jwx7g11QxzkbWNysGGVvO", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 339, + "versionNonce": 967250590, + "isDeleted": false, + "id": "_4XvEE01xJqacePwdUg6Q", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1302.4336395263672, + "y": 950.55859375, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 127.99990844726562, + "height": 20, + "seed": 148708484, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015105, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Check for Strike", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "NMgOxJDLEM2B8T3TUUGwg", + "originalText": "Check for Strike", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 302, + "versionNonce": 324683068, + "isDeleted": false, + "id": "cKGz06wZLtoN5oeTau-tk", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1514.05078125, + "y": 1037.140625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 144, + "height": 50, + "seed": 1985661828, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "Qyw-04y4DyfL-pckuu-TT" + }, + { + "id": "cP0JH7aFXw69aSqEKPcz6", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 316, + "versionNonce": 1711238722, + "isDeleted": false, + "id": "Qyw-04y4DyfL-pckuu-TT", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1521.690818786621, + "y": 1052.140625, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 128.7199249267578, + "height": 20, + "seed": 1244438204, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015106, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Calculate Bonus", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "cKGz06wZLtoN5oeTau-tk", + "originalText": "Calculate Bonus", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 424, + "versionNonce": 651574716, + "isDeleted": false, + "id": "urrVPkgcK8Ry7lPEo04hF", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1511.232421875, + "y": 932.529296875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 138, + "height": 50, + "seed": 204203324, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "jKQMH-Pf5V046RE_Af8Cy" + }, + { + "id": "cP0JH7aFXw69aSqEKPcz6", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 449, + "versionNonce": 245829342, + "isDeleted": false, + "id": "jKQMH-Pf5V046RE_Af8Cy", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1517.1204681396484, + "y": 947.529296875, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 126.22390747070312, + "height": 20, + "seed": 148708484, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015106, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Check for Spare", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "urrVPkgcK8Ry7lPEo04hF", + "originalText": "Check for Spare", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 376, + "versionNonce": 1228875324, + "isDeleted": false, + "id": "qOC0hCrawAyJFJx8rwu6I", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1279.255859375, + "y": 1037.232421875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 177, + "height": 50, + "seed": 1985661828, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "_fF5G4745oaILHQdx07Ku" + }, + { + "id": "EfdSeLkJpo6gZ4mTwYie_", + "type": "arrow" + }, + { + "id": "4W9WFBjr2dU4eDs_me5FD", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 457, + "versionNonce": 1581012482, + "isDeleted": false, + "id": "_fF5G4745oaILHQdx07Ku", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1287.363899230957, + "y": 1052.232421875, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 160.78392028808594, + "height": 20, + "seed": 1244438204, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015106, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Update Total Score", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "qOC0hCrawAyJFJx8rwu6I", + "originalText": "Update Total Score", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 420, + "versionNonce": 1870069436, + "isDeleted": false, + "id": "C1AJSqFz3zHamLsPJ2g7U", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1008.263671875, + "y": 1038.279296875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 224, + "height": 50, + "seed": 718200196, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "K-vHX_w0i1d1H9zw4tdzK" + }, + { + "id": "4W9WFBjr2dU4eDs_me5FD", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 421, + "versionNonce": 1927119646, + "isDeleted": false, + "id": "K-vHX_w0i1d1H9zw4tdzK", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1028.0237274169922, + "y": 1053.279296875, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 184.47988891601562, + "height": 20, + "seed": 1413131452, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015106, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Check for End of Game", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "C1AJSqFz3zHamLsPJ2g7U", + "originalText": "Check for End of Game", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 527, + "versionNonce": 572507964, + "isDeleted": false, + "id": "KIAv6mGB-Xv7BFvZcDJeR", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 754.130859375, + "y": 1040.716796875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 206, + "height": 50, + "seed": 1066686468, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "vxFP7Mh_SBbjUpKlti588" + }, + { + "id": "Jq3xl7cYvGRGh457hJGnA", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 546, + "versionNonce": 1443251650, + "isDeleted": false, + "id": "vxFP7Mh_SBbjUpKlti588", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 783.0109024047852, + "y": 1055.716796875, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 148.2399139404297, + "height": 20, + "seed": 1954552380, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015106, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Display Final Score", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "KIAv6mGB-Xv7BFvZcDJeR", + "originalText": "Display Final Score", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 601, + "versionNonce": 94076860, + "isDeleted": false, + "id": "ukne3XnDXsN0sUFLuYbWG", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 562.142578125, + "y": 1037.908203125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 133, + "height": 50, + "seed": 1558069820, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "gKkoj_R8qEqp5gXC3CWAx" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 631, + "versionNonce": 683372382, + "isDeleted": false, + "id": "gKkoj_R8qEqp5gXC3CWAx", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 581.2986145019531, + "y": 1052.908203125, + "strokeColor": "#000000", + "backgroundColor": "#c92a2a", + "width": 94.68792724609375, + "height": 20, + "seed": 415960964, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015106, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "End program", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "ukne3XnDXsN0sUFLuYbWG", + "originalText": "End program", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "line", + "version": 25, + "versionNonce": 1644963900, + "isDeleted": false, + "id": "KBI29up2Q8KAt91D7ClGF", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 508.70703125, + "y": 355.8828125, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 50.2421875, + "height": 0.87109375, + "seed": 1456578876, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 50.2421875, + 0.87109375 + ] + ] + }, + { + "type": "line", + "version": 34, + "versionNonce": 844532100, + "isDeleted": false, + "id": "vG3CgfAHPGrB4hCRqeVx0", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 604.75390625, + "y": 355.66015625, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 34.4921875, + "height": 0.46875, + "seed": 540998404, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 34.4921875, + -0.46875 + ] + ] + }, + { + "type": "line", + "version": 213, + "versionNonce": 726909116, + "isDeleted": false, + "id": "GlzzNwd1qcoUa_TvO5usO", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 677.4765624999999, + "y": 397.86328125, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 70.79296875, + "height": 0.38671875, + "seed": 2003202820, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 70.79296875, + -0.38671875 + ] + ] + }, + { + "type": "line", + "version": 99, + "versionNonce": 894613764, + "isDeleted": false, + "id": "4WxrV9iYFLY3DbuyfMMUh", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 522.62109375, + "y": 438.28124999999994, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 32.25, + "height": 0.63671875, + "seed": 1226502076, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 32.25, + 0.63671875 + ] + ] + }, + { + "type": "line", + "version": 42, + "versionNonce": 152324412, + "isDeleted": false, + "id": "x7znDkaMFUMGkcLytcoXf", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 553.22265625, + "y": 517.60546875, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 47.22265625, + "height": 0.71875, + "seed": 1973211012, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 47.22265625, + 0.71875 + ] + ] + }, + { + "type": "line", + "version": 48, + "versionNonce": 2015164548, + "isDeleted": false, + "id": "BScu4MP3prbMNb0z3SiZj", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1177.80078125, + "y": 521.12890625, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 48.03515625, + "height": 0.1484375, + "seed": 1459185028, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 48.03515625, + -0.1484375 + ] + ] + }, + { + "type": "line", + "version": 58, + "versionNonce": 1588576700, + "isDeleted": false, + "id": "y1WEsOHmLO9-OamwUSi98", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1273.9453125, + "y": 521.30078125, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 48.34375, + "height": 0.17578125, + "seed": 1447623172, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 48.34375, + -0.17578125 + ] + ] + }, + { + "type": "line", + "version": 44, + "versionNonce": 1987266564, + "isDeleted": false, + "id": "dplHsigVmqcGi6XpdTGgh", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 813.94921875, + "y": 558.6640625, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 57.69140625, + "height": 1.1796875, + "seed": 1610877956, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 57.69140625, + -1.1796875 + ] + ] + }, + { + "type": "line", + "version": 30, + "versionNonce": 1397238332, + "isDeleted": false, + "id": "C0T0ks9xp_mToyvjaPdH1", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 592.04296875, + "y": 600.83203125, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 49.28515625, + "height": 0.6875, + "seed": 962292996, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 49.28515625, + 0.6875 + ] + ] + }, + { + "type": "arrow", + "version": 35, + "versionNonce": 72591236, + "isDeleted": false, + "id": "tOtfXnt5atEhdgHqAMQVb", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 444.96875, + "y": 957.73828125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 58.58984375, + "height": 0.90625, + "seed": 787933060, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "EHcZuqT0EMF0OC_mCUnop", + "focus": -0.10166709927166351, + "gap": 1 + }, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 58.58984375, + 0.90625 + ] + ] + }, + { + "type": "arrow", + "version": 32, + "versionNonce": 1505723068, + "isDeleted": false, + "id": "uGtoe_NNXSihCV_g-GQtc", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 699.4375, + "y": 958.484375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 55.07421875, + "height": 0, + "seed": 515150652, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "IrDGonIPRNy69wxDz-Ujh", + "focus": -0.07093750000000001, + "gap": 2.30859375 + }, + "endBinding": { + "elementId": "o1AM8Mqt76F1unR7c4SQR", + "focus": 0.111875, + "gap": 2.828125 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 55.07421875, + 0 + ] + ] + }, + { + "type": "arrow", + "version": 71, + "versionNonce": 1174148868, + "isDeleted": false, + "id": "rqaexRcMPL_SungbmClim", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 958.3203125, + "y": 959.01171875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 62.79296875, + "height": 2.68359375, + "seed": 1196344964, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "o1AM8Mqt76F1unR7c4SQR", + "focus": -0.22495095760505762, + "gap": 1 + }, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 62.79296875, + 2.68359375 + ] + ] + }, + { + "type": "arrow", + "version": 44, + "versionNonce": 951569212, + "isDeleted": false, + "id": "EjdgSb7EsRCBmYgVs5Z5_", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1226.9765625, + "y": 959.23828125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 53.75390625, + "height": 1.41796875, + "seed": 2137206076, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "qHPgIWrxHcot3dz1THbrk", + "focus": 0.04716038195195845, + "gap": 1.5234375 + }, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 53.75390625, + -1.41796875 + ] + ] + }, + { + "type": "arrow", + "version": 30, + "versionNonce": 669685380, + "isDeleted": false, + "id": "jwx7g11QxzkbWNysGGVvO", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1454.7734375, + "y": 959.95703125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 57.84765625, + "height": 0.21875, + "seed": 1912674364, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "NMgOxJDLEM2B8T3TUUGwg", + "focus": -0.010562077411089691, + "gap": 1.83984375 + }, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 57.84765625, + -0.21875 + ] + ] + }, + { + "type": "arrow", + "version": 90, + "versionNonce": 311624636, + "isDeleted": false, + "id": "cP0JH7aFXw69aSqEKPcz6", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1582.3046875, + "y": 985.5859375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 1.66015625, + "height": 48.8828125, + "seed": 2025420732, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "urrVPkgcK8Ry7lPEo04hF", + "focus": -0.01602608854870374, + "gap": 3.056640625 + }, + "endBinding": { + "elementId": "cKGz06wZLtoN5oeTau-tk", + "focus": -0.015733167842761287, + "gap": 2.671875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 1.66015625, + 48.8828125 + ] + ] + }, + { + "type": "arrow", + "version": 64, + "versionNonce": 1457333764, + "isDeleted": false, + "id": "EfdSeLkJpo6gZ4mTwYie_", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1514.11328125, + "y": 1062.84375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 56.796875, + "height": 0.53125, + "seed": 430857092, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": { + "elementId": "qOC0hCrawAyJFJx8rwu6I", + "focus": -0.02933380138655149, + "gap": 1.060546875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -56.796875, + -0.53125 + ] + ] + }, + { + "type": "arrow", + "version": 46, + "versionNonce": 1836264508, + "isDeleted": false, + "id": "4W9WFBjr2dU4eDs_me5FD", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1278.09765625, + "y": 1062.15625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 44.1328125, + "height": 0.35546875, + "seed": 434850692, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": { + "elementId": "qOC0hCrawAyJFJx8rwu6I", + "focus": -0.025122955973422, + "gap": 1.158203125 + }, + "endBinding": { + "elementId": "C1AJSqFz3zHamLsPJ2g7U", + "focus": -0.09243743608871931, + "gap": 1.701171875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -44.1328125, + -0.35546875 + ] + ] + }, + { + "type": "arrow", + "version": 52, + "versionNonce": 936494468, + "isDeleted": false, + "id": "Jq3xl7cYvGRGh457hJGnA", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1008.703125, + "y": 1061.58203125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 47.01953125, + "height": 2.45703125, + "seed": 1790923324, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": { + "elementId": "KIAv6mGB-Xv7BFvZcDJeR", + "focus": 0.12460291499868748, + "gap": 1.552734375 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -47.01953125, + 2.45703125 + ] + ] + }, + { + "type": "arrow", + "version": 88, + "versionNonce": 993674428, + "isDeleted": false, + "id": "oVHSe7pqsFG4WFER8qU8O", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 756.47265625, + "y": 1063.203125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 61.5859375, + "height": 0.6953125, + "seed": 431816508, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419923, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -61.5859375, + -0.6953125 + ] + ] + }, + { + "type": "text", + "version": 52, + "versionNonce": 1719418242, + "isDeleted": false, + "id": "x1lkgZG_6lpK_gdoganyY", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 292.21484375, + "y": 883.8515625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 203.2638397216797, + "height": 20, + "seed": 1545739140, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015107, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Program Flowchart Draft:", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Program Flowchart Draft:", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "text", + "version": 40, + "versionNonce": 2089931678, + "isDeleted": false, + "id": "U0VKkmOhxbNkf_l-ShY5V", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 293.3828125, + "y": 1168.29296875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 133.6638946533203, + "height": 20, + "seed": 5407804, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015107, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Classes Required", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Classes Required", + "lineHeight": 1.25, + "baseline": 14 + }, + { + "type": "rectangle", + "version": 205, + "versionNonce": 217658500, + "isDeleted": false, + "id": "3hUUFSpQywC1AAaD9znsb", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 594.66796875, + "y": 1184.30859375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 192.453125, + "height": 230, + "seed": 706052996, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "KKk8y1z3c4oDOr9d9A7pa" + }, + { + "id": "4brcBNlJPDMn9hK0l3EOI", + "type": "arrow" + }, + { + "id": "Rdt3q82KiKhy-dMkWxLEk", + "type": "arrow" + } + ], + "updated": 1682266419923, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 344, + "versionNonce": 752696642, + "isDeleted": false, + "id": "KKk8y1z3c4oDOr9d9A7pa", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 600.4785842895508, + "y": 1189.30859375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 180.83189392089844, + "height": 220, + "seed": 266157884, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015107, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Game\n\n- main class that \nuses other classes\n- integration test for \nthis\n- initialises the game\n- determines when \ngame is over\n- gets inputs and puts\noutputs", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "3hUUFSpQywC1AAaD9znsb", + "originalText": "Game\n\n- main class that uses other classes\n- integration test for this\n- initialises the game\n- determines when game is over\n- gets inputs and puts outputs", + "lineHeight": 1.25, + "baseline": 214 + }, + { + "type": "rectangle", + "version": 404, + "versionNonce": 476578820, + "isDeleted": false, + "id": "Sg69oll13sCu5bzLw6V2r", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1078.84765625, + "y": 1424.24609375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 192.453125, + "height": 210, + "seed": 1802929156, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "3xvPWi7DN0f4g_IAPOImL" + } + ], + "updated": 1682266419924, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 488, + "versionNonce": 143765470, + "isDeleted": false, + "id": "3xvPWi7DN0f4g_IAPOImL", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1086.7222747802734, + "y": 1429.24609375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 176.70388793945312, + "height": 200, + "seed": 270970428, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015107, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Frame\n\n- calculates score for\na frame\n- calculates bonuses \nfor that frame\n- adding rolls to the \nframe\n- checking if frame \ncomplete", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "Sg69oll13sCu5bzLw6V2r", + "originalText": "Frame\n\n- calculates score for a frame\n- calculates bonuses for that frame\n- adding rolls to the frame\n- checking if frame complete", + "lineHeight": 1.25, + "baseline": 194 + }, + { + "type": "rectangle", + "version": 413, + "versionNonce": 72409988, + "isDeleted": false, + "id": "UVsyGG6wnQIYomSMwwAOL", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 387.953125, + "y": 1462.35546875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 192.453125, + "height": 151.125, + "seed": 1791315772, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "gt9pdXB9gItP_4DIzzwzS" + }, + { + "id": "tsMthlCTj6NyATUROu_fy", + "type": "arrow" + }, + { + "id": "k7xqlIgXJ0i23qG5jjazm", + "type": "arrow" + } + ], + "updated": 1682266419924, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 456, + "versionNonce": 1183335682, + "isDeleted": false, + "id": "gt9pdXB9gItP_4DIzzwzS", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 393.0437469482422, + "y": 1487.91796875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 182.27188110351562, + "height": 100, + "seed": 174543492, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015107, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Roll\n\n- stores the number of\npins knocked over for \na roll", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "UVsyGG6wnQIYomSMwwAOL", + "originalText": "Roll\n\n- stores the number of pins knocked over for a roll", + "lineHeight": 1.25, + "baseline": 94 + }, + { + "type": "rectangle", + "version": 383, + "versionNonce": 1257362180, + "isDeleted": false, + "id": "PUW6PlLEz0vLQzb0iKvHl", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 790.5546875, + "y": 1446.14453125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 192.453125, + "height": 190, + "seed": 2001699204, + "groupIds": [], + "roundness": { + "type": 3 + }, + "boundElements": [ + { + "type": "text", + "id": "mdsZPdzv3zJFn66ndqhTc" + }, + { + "id": "4brcBNlJPDMn9hK0l3EOI", + "type": "arrow" + } + ], + "updated": 1682266419924, + "link": null, + "locked": false + }, + { + "type": "text", + "version": 489, + "versionNonce": 2026636318, + "isDeleted": false, + "id": "mdsZPdzv3zJFn66ndqhTc", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 797.0373001098633, + "y": 1451.14453125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 179.48789978027344, + "height": 180, + "seed": 143018172, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015108, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Scorecard\n\n- keeps track of the \nscore for each frame\n- updates the \nscorecard with new \nrolls and frames\n- calculates the total\nscore for the game", + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "PUW6PlLEz0vLQzb0iKvHl", + "originalText": "Scorecard\n\n- keeps track of the score for each frame\n- updates the scorecard with new rolls and frames\n- calculates the total score for the game", + "lineHeight": 1.25, + "baseline": 174 + }, + { + "type": "line", + "version": 47, + "versionNonce": 2127090308, + "isDeleted": false, + "id": "_jG0si5-IOSNWVojjssGW", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 847.36328125, + "y": 357.9609375, + "strokeColor": "#c92a2a", + "backgroundColor": "transparent", + "width": 32.3203125, + "height": 2.12890625, + "seed": 1688489988, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": null, + "points": [ + [ + 0, + 0 + ], + [ + 32.3203125, + -2.12890625 + ] + ] + }, + { + "type": "arrow", + "version": 377, + "versionNonce": 1288079292, + "isDeleted": false, + "id": "Rdt3q82KiKhy-dMkWxLEk", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 589.41796875, + "y": 1300.2109375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 105.72265625, + "height": 162.50390625, + "seed": 30121988, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": { + "elementId": "3hUUFSpQywC1AAaD9znsb", + "focus": 0.14977271774764553, + "gap": 5.25 + }, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -93.92578125, + 19.5546875 + ], + [ + -105.72265625, + 162.50390625 + ] + ] + }, + { + "type": "arrow", + "version": 418, + "versionNonce": 781443588, + "isDeleted": false, + "id": "4brcBNlJPDMn9hK0l3EOI", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 790.18359375, + "y": 1296.9339414013127, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 104.28774041094925, + "height": 146.54262109868728, + "seed": 2088555196, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": { + "elementId": "3hUUFSpQywC1AAaD9znsb", + "focus": -0.16998600200077021, + "gap": 3.0625 + }, + "endBinding": { + "elementId": "PUW6PlLEz0vLQzb0iKvHl", + "focus": 0.15698514489638274, + "gap": 2.66796875 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 92.87890625, + 19.233589352850913 + ], + [ + 104.28774041094925, + 146.54262109868728 + ] + ] + }, + { + "type": "arrow", + "version": 144, + "versionNonce": 513159228, + "isDeleted": false, + "id": "_CzU4Bj-N7cbReLISIQmz", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 982.59765625, + "y": 1521.15625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 99.25390625, + "height": 1.5390625, + "seed": 491434244, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 99.25390625, + -1.5390625 + ] + ] + }, + { + "type": "arrow", + "version": 221, + "versionNonce": 1632698756, + "isDeleted": false, + "id": "gVM7ZKTgq50C7_PptLdgv", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1019.73828125, + "y": 1518.5234375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 59.66015625, + "height": 35.98828125, + "seed": 1419023292, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 4.80078125, + -32.03515625 + ], + [ + 59.66015625, + -35.98828125 + ] + ] + }, + { + "type": "arrow", + "version": 177, + "versionNonce": 1499252924, + "isDeleted": false, + "id": "lClaERq02EGoITFG310N6", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1020.578125, + "y": 1520.83984375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 59.640625, + "height": 39.578125, + "seed": 146108860, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 7.70703125, + 34.88671875 + ], + [ + 59.640625, + 39.578125 + ] + ] + }, + { + "type": "arrow", + "version": 242, + "versionNonce": 238956804, + "isDeleted": false, + "id": "tsMthlCTj6NyATUROu_fy", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 482.5703125, + "y": 1403.33984375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 44.3604578561459, + "height": 58.015625, + "seed": 1156494596, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": { + "elementId": "UVsyGG6wnQIYomSMwwAOL", + "focus": -0.5392806877566573, + "gap": 1 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -36.62890625, + 11.26953125 + ], + [ + -44.3604578561459, + 58.015625 + ] + ] + }, + { + "type": "arrow", + "version": 254, + "versionNonce": 549212476, + "isDeleted": false, + "id": "k7xqlIgXJ0i23qG5jjazm", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 483.5546875, + "y": 1404.453125, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 42.008318177422325, + "height": 55.76953125, + "seed": 1573627708, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": null, + "endBinding": { + "elementId": "UVsyGG6wnQIYomSMwwAOL", + "focus": 0.45246993785837336, + "gap": 2.1328125 + }, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + 39.66796875, + 8.55078125 + ], + [ + 42.008318177422325, + 55.76953125 + ] + ] + }, + { + "type": "text", + "version": 1060, + "versionNonce": 1291605186, + "isDeleted": false, + "id": "Esd1Iud99DlZBr2UUHagC", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 312.03125, + "y": 2248.46484375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 761.2794799804688, + "height": 200, + "seed": 32390276, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015108, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "TDD\n\n1. game.rb and game_spec.rb created\n2. test if the game is initialised correctly\n3. create scorecard, frame and roll classes so initialise works\n4. amend scorecard output so it looks better using puts statement in test as I make changes\n5. initialise integration test works for game.rb, commit point \n6. roll tests working for game.rb, bonuses not implemented\n7. game_test showing two frames for one two rolls, fixed and committed\n8. first bonus to implement is strikes, working on scorecard and frames ", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "TDD\n\n1. game.rb and game_spec.rb created\n2. test if the game is initialised correctly\n3. create scorecard, frame and roll classes so initialise works\n4. amend scorecard output so it looks better using puts statement in test as I make changes\n5. initialise integration test works for game.rb, commit point \n6. roll tests working for game.rb, bonuses not implemented\n7. game_test showing two frames for one two rolls, fixed and committed\n8. first bonus to implement is strikes, working on scorecard and frames ", + "lineHeight": 1.25, + "baseline": 194 + }, + { + "type": "arrow", + "version": 79, + "versionNonce": 1410779580, + "isDeleted": false, + "id": "KtkNSV0FryFQ6GPlEBDLR", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1350.01171875, + "y": 708.48046875, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 113.5078125, + "height": 23.28125, + "seed": 1815915140, + "groupIds": [], + "roundness": { + "type": 2 + }, + "boundElements": [], + "updated": 1682266419924, + "link": null, + "locked": false, + "startBinding": { + "elementId": "12Io7E3NuWgwqlGyJc9OB", + "focus": 0.14415142293203434, + "gap": 8.74609375 + }, + "endBinding": null, + "lastCommittedPoint": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "points": [ + [ + 0, + 0 + ], + [ + -113.5078125, + 23.28125 + ] + ] + }, + { + "type": "text", + "version": 172, + "versionNonce": 1328664670, + "isDeleted": false, + "id": "12Io7E3NuWgwqlGyJc9OB", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 1273.140625, + "y": 659.734375, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 539.9996948242188, + "height": 40, + "seed": 1028197692, + "groupIds": [], + "roundness": null, + "boundElements": [ + { + "id": "KtkNSV0FryFQ6GPlEBDLR", + "type": "arrow" + } + ], + "updated": 1682278015108, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Once you have verified that objects are being created \nand initialized correctly, you can move on to testing their behavior. ", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Once you have verified that objects are being created \nand initialized correctly, you can move on to testing their behavior. ", + "lineHeight": 1.25, + "baseline": 34 + }, + { + "type": "text", + "version": 201, + "versionNonce": 1373138050, + "isDeleted": false, + "id": "VxCd3BnCQ51QlvmdIA-JV", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 307.453125, + "y": 1698.5390625, + "strokeColor": "#000000", + "backgroundColor": "transparent", + "width": 2015.61474609375, + "height": 460, + "seed": 299418756, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682278015109, + "link": null, + "locked": false, + "fontSize": 16, + "fontFamily": 1, + "text": "Special scores\n\nStrikes:\nRegular frame: 10 points for the strike + the total number of pins knocked down in the next two rolls.\nExample: If the player rolls a strike in the first frame and then knocks down 8 and 1 pins in the next frame, their score for the first frame would be 19 (10 for the strike, plus 8 and 1 for the next two rolls).\n\nSpares:\nRegular frame: 10 points for the spare + the number of pins knocked down in the next roll.\nExample: If the player rolls a spare in the second frame by knocking down 7 and 3 pins and then knocks down 5 pins in the next roll, their score for the second frame would be 15 (10 for the spare, plus 5 for the next roll).\n\n10th Frame Bonus Rolls:\nStrike: 10 points for the strike + the total number of pins knocked down in the next two rolls (up to 3 rolls in total).\nSpare: 10 points for the spare + the number of pins knocked down in the next roll (up to 3 rolls in total).\nNo strike or spare: The total number of pins knocked down in the frame (up to 3 rolls in total).\nExample: If the player rolls a strike in the first and second balls of the 10th frame and then knocks down 8 pins on the third ball, their score for the 10th frame would be 28 (10 for the first strike, 10 for the second strike, and 8 for the third ball).\n\nGutter Game:\n0 points for each roll.\nExample: If the player rolls 20 gutter balls, their total score would be 0.\n\nPerfect Game:\n10 points for each regular strike, plus the total number of pins knocked down in the bonus rolls (up to 3 rolls in the 10th frame).\nExample: If the player rolls 12 strikes in a row, their score for each frame would be 30 (10 for the regular strike, plus 10 for each of the two bonus strikes in the 10th frame). ", + "textAlign": "left", + "verticalAlign": "top", + "containerId": null, + "originalText": "Special scores\n\nStrikes:\nRegular frame: 10 points for the strike + the total number of pins knocked down in the next two rolls.\nExample: If the player rolls a strike in the first frame and then knocks down 8 and 1 pins in the next frame, their score for the first frame would be 19 (10 for the strike, plus 8 and 1 for the next two rolls).\n\nSpares:\nRegular frame: 10 points for the spare + the number of pins knocked down in the next roll.\nExample: If the player rolls a spare in the second frame by knocking down 7 and 3 pins and then knocks down 5 pins in the next roll, their score for the second frame would be 15 (10 for the spare, plus 5 for the next roll).\n\n10th Frame Bonus Rolls:\nStrike: 10 points for the strike + the total number of pins knocked down in the next two rolls (up to 3 rolls in total).\nSpare: 10 points for the spare + the number of pins knocked down in the next roll (up to 3 rolls in total).\nNo strike or spare: The total number of pins knocked down in the frame (up to 3 rolls in total).\nExample: If the player rolls a strike in the first and second balls of the 10th frame and then knocks down 8 pins on the third ball, their score for the 10th frame would be 28 (10 for the first strike, 10 for the second strike, and 8 for the third ball).\n\nGutter Game:\n0 points for each roll.\nExample: If the player rolls 20 gutter balls, their total score would be 0.\n\nPerfect Game:\n10 points for each regular strike, plus the total number of pins knocked down in the bonus rolls (up to 3 rolls in the 10th frame).\nExample: If the player rolls 12 strikes in a row, their score for each frame would be 30 (10 for the regular strike, plus 10 for each of the two bonus strikes in the 10th frame). ", + "lineHeight": 1.25, + "baseline": 454 + }, + { + "type": "freedraw", + "version": 22, + "versionNonce": 34617404, + "isDeleted": false, + "id": "Xic7CxWPTdl5vewk5wAiO", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 778.09375, + "y": 676.7109375, + "strokeColor": "#2b8a3e", + "backgroundColor": "transparent", + "width": 31.13671875, + "height": 20.19921875, + "seed": 1902874372, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682266422077, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 0.35546875, + 0 + ], + [ + 0.7109375, + 0 + ], + [ + 1.421875, + 0.359375 + ], + [ + 1.77734375, + 0.359375 + ], + [ + 3.19921875, + 1.43359375 + ], + [ + 3.5546875, + 2.1484375 + ], + [ + 4.62109375, + 3.22265625 + ], + [ + 5.33203125, + 3.58203125 + ], + [ + 5.6875, + 3.94140625 + ], + [ + 5.6875, + 3.5859375 + ], + [ + 7.109375, + 2.51953125 + ], + [ + 12.2109375, + -2.08984375 + ], + [ + 17.8984375, + -6.640625 + ], + [ + 21.95703125, + -9.68359375 + ], + [ + 27.58203125, + -13.76953125 + ], + [ + 28.29296875, + -14.48046875 + ], + [ + 29.71484375, + -15.19140625 + ], + [ + 30.42578125, + -15.90234375 + ], + [ + 31.13671875, + -16.2578125 + ], + [ + 31.13671875, + -16.2578125 + ] + ], + "lastCommittedPoint": null, + "simulatePressure": true, + "pressures": [] + }, + { + "type": "freedraw", + "version": 130, + "versionNonce": 1612852156, + "isDeleted": false, + "id": "1DDlS8ixAyG98AV1R9Q2q", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 450.283203125, + "y": 702.427734375, + "strokeColor": "#2b8a3e", + "backgroundColor": "transparent", + "width": 31.13671875, + "height": 20.19921875, + "seed": 1902874372, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682266432744, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 0.35546875, + 0 + ], + [ + 0.7109375, + 0 + ], + [ + 1.421875, + 0.359375 + ], + [ + 1.77734375, + 0.359375 + ], + [ + 3.19921875, + 1.43359375 + ], + [ + 3.5546875, + 2.1484375 + ], + [ + 4.62109375, + 3.22265625 + ], + [ + 5.33203125, + 3.58203125 + ], + [ + 5.6875, + 3.94140625 + ], + [ + 5.6875, + 3.5859375 + ], + [ + 7.109375, + 2.51953125 + ], + [ + 12.2109375, + -2.08984375 + ], + [ + 17.8984375, + -6.640625 + ], + [ + 21.95703125, + -9.68359375 + ], + [ + 27.58203125, + -13.76953125 + ], + [ + 28.29296875, + -14.48046875 + ], + [ + 29.71484375, + -15.19140625 + ], + [ + 30.42578125, + -15.90234375 + ], + [ + 31.13671875, + -16.2578125 + ], + [ + 31.13671875, + -16.2578125 + ] + ], + "lastCommittedPoint": null, + "simulatePressure": true, + "pressures": [] + }, + { + "type": "freedraw", + "version": 99, + "versionNonce": 1228128188, + "isDeleted": false, + "id": "cs65EJTOLGkFsUdz7gs-F", + "fillStyle": "hachure", + "strokeWidth": 1, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "angle": 0, + "x": 648.099609375, + "y": 762.517578125, + "strokeColor": "#2b8a3e", + "backgroundColor": "transparent", + "width": 31.13671875, + "height": 20.19921875, + "seed": 1902874372, + "groupIds": [], + "roundness": null, + "boundElements": [], + "updated": 1682266442313, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 0.35546875, + 0 + ], + [ + 0.7109375, + 0 + ], + [ + 1.421875, + 0.359375 + ], + [ + 1.77734375, + 0.359375 + ], + [ + 3.19921875, + 1.43359375 + ], + [ + 3.5546875, + 2.1484375 + ], + [ + 4.62109375, + 3.22265625 + ], + [ + 5.33203125, + 3.58203125 + ], + [ + 5.6875, + 3.94140625 + ], + [ + 5.6875, + 3.5859375 + ], + [ + 7.109375, + 2.51953125 + ], + [ + 12.2109375, + -2.08984375 + ], + [ + 17.8984375, + -6.640625 + ], + [ + 21.95703125, + -9.68359375 + ], + [ + 27.58203125, + -13.76953125 + ], + [ + 28.29296875, + -14.48046875 + ], + [ + 29.71484375, + -15.19140625 + ], + [ + 30.42578125, + -15.90234375 + ], + [ + 31.13671875, + -16.2578125 + ], + [ + 31.13671875, + -16.2578125 + ] + ], + "lastCommittedPoint": null, + "simulatePressure": true, + "pressures": [] + } + ], + "appState": { + "gridSize": null, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/game_test.rb b/game_test.rb new file mode 100644 index 00000000..bc6d5a4c --- /dev/null +++ b/game_test.rb @@ -0,0 +1,8 @@ +require_relative 'lib/game' + +game = Game.new +game.roll(5) +game.roll(5) +game.roll(6) +game.roll(4) +puts game.scorecard.to_s diff --git a/lib/frame.rb b/lib/frame.rb new file mode 100644 index 00000000..fd9dab34 --- /dev/null +++ b/lib/frame.rb @@ -0,0 +1,9 @@ +class Frame + attr_reader :rolls + attr_accessor :total + + def initialize + @rolls = [] + @total = nil + end +end diff --git a/lib/game.rb b/lib/game.rb new file mode 100644 index 00000000..ace9c584 --- /dev/null +++ b/lib/game.rb @@ -0,0 +1,30 @@ +require_relative 'scorecard' +require_relative 'frame' +require_relative 'roll' + +class Game + attr_reader :scorecard, :current_frame, :frames, :roll_count + + def initialize + @scorecard = Scorecard.new + @current_frame = Frame.new + @frames = [@current_frame] + @roll_count = 0 + end + + def roll(pins) + roll = Roll.new(pins) + @current_frame.rolls << roll + @scorecard.update(@current_frame, @frames) + update_frame + end + + def update_frame + @roll_count += 1 + + if @current_frame.rolls.size == 2 || @current_frame.rolls.map(&:score).sum >= 10 + @current_frame = Frame.new + @frames << @current_frame + end + end +end \ No newline at end of file diff --git a/lib/roll.rb b/lib/roll.rb new file mode 100644 index 00000000..674c4164 --- /dev/null +++ b/lib/roll.rb @@ -0,0 +1,7 @@ +class Roll + attr_reader :score + + def initialize(score) + @score = score + end +end \ No newline at end of file diff --git a/lib/scorecard.rb b/lib/scorecard.rb new file mode 100644 index 00000000..5735e284 --- /dev/null +++ b/lib/scorecard.rb @@ -0,0 +1,32 @@ +class Scorecard + attr_reader :frames + + def initialize + @frames = [] + end + + def update(frame, frames) + frame.total = frame.rolls.sum(&:score) + if frame.rolls.size == 2 || frame.rolls.map(&:score).sum >= 10 + @frames << frame + end + end + + def to_s + scorecard_str = "" + score = 0 + @frames.each_with_index do |frame, index| + score += frame.total + scorecard_str += format_frame(index, frame, score) + end + scorecard_str + end + + private + + def format_frame(index, frame, score) + frame_info = "FRAME #{index + 1}:" + rolls_info = frame.rolls.each_with_index.map { |roll, r_index| "ROLL #{r_index + 1}: #{roll.score}" }.join(' ') + "#{frame_info} #{rolls_info} | TOTAL: #{frame.total} | SCORE: #{score}\n" + end +end \ No newline at end of file diff --git a/spec/frame_spec.rb b/spec/frame_spec.rb new file mode 100644 index 00000000..4ef26a34 --- /dev/null +++ b/spec/frame_spec.rb @@ -0,0 +1,10 @@ +require 'frame' + +RSpec.describe Frame do + describe '#initialize' do + it 'creates a new frame with an empty roll array' do + frame = Frame.new + expect(frame.rolls).to eq([]) + end + end +end diff --git a/spec/game_spec.rb b/spec/game_spec.rb new file mode 100644 index 00000000..d68a287f --- /dev/null +++ b/spec/game_spec.rb @@ -0,0 +1,49 @@ +require 'game' + +RSpec.describe Game do + describe '#initialize' do + it 'creates a new scorecard, current frame, frames array, and roll count' do + game = Game.new + + expect(game.scorecard).to be_a(Scorecard) + expect(game.current_frame).to be_a(Frame) + expect(game.frames).to eq([game.current_frame]) + expect(game.roll_count).to eq(0) + end + end + + describe '#roll' do + it 'adds the roll to the current frame' do + game = Game.new + game.roll(3) + + expect(game.current_frame.rolls[0].score).to eq(3) + end + + it 'updates the scorecard' do + game = Game.new + game.roll(5) + game.roll(1) + + expect(game.scorecard.frames[0].rolls[0].score).to eq(5) + expect(game.scorecard.frames[0].rolls[1].score).to eq(1) + end + + it 'updates the roll count' do + game = Game.new + game.roll(5) + + expect(game.roll_count).to eq(1) + end + + it 'creates a new frame if the current frame is full' do + game = Game.new + game.roll(5) + game.roll(5) + game.roll(5) + + expect(game.current_frame.rolls[0].score).to eq(5) + expect(game.frames.length).to eq(2) + end + end +end \ No newline at end of file diff --git a/spec/roll_spec.rb b/spec/roll_spec.rb new file mode 100644 index 00000000..c7437d71 --- /dev/null +++ b/spec/roll_spec.rb @@ -0,0 +1,10 @@ +require 'roll' + +RSpec.describe Roll do + describe '#initialize' do + it 'creates a new roll with a score' do + roll = Roll.new(5) + expect(roll.score).to eq(5) + end + end +end diff --git a/spec/scorecard_spec.rb b/spec/scorecard_spec.rb new file mode 100644 index 00000000..2c3e2112 --- /dev/null +++ b/spec/scorecard_spec.rb @@ -0,0 +1,41 @@ +require 'scorecard' +require 'frame' +require 'roll' + +RSpec.describe Scorecard do + describe '#update' do + it 'updates the scorecard with the score for a frame' do + scorecard = Scorecard.new + frame = Frame.new + rolls = [Roll.new(3), Roll.new(5)] + frame.instance_variable_set(:@rolls, rolls) + frames = [frame] + scorecard.update(frame, frames) + + # puts statement is to see what the scorecard looks like as I build it + puts scorecard.to_s + + expected_scorecard = "FRAME 1: ROLL 1: 3 ROLL 2: 5 | TOTAL: 8 | SCORE: 8\n" + + expect(scorecard.to_s).to eq(expected_scorecard) + end + end + + describe 'strike bonus' do + it 'calculates the strike bonus correctly' do + game = Game.new + + # Roll a strike + game.roll(10) + + # Roll two more rolls + game.roll(3) + game.roll(4) + + expected_scorecard = "FRAME 1: ROLL 1: 10 | TOTAL: 17 | SCORE: 17\n" \ + "FRAME 2: ROLL 1: 3 ROLL 2: 4 | TOTAL: 7 | SCORE: 24\n" + + expect(game.scorecard.to_s).to eq(expected_scorecard) + end + end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 00000000..c80d44b9 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,98 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # This allows you to limit a spec run to individual examples or groups + # you care about by tagging them with `:focus` metadata. When nothing + # is tagged with `:focus`, all examples get run. RSpec also provides + # aliases for `it`, `describe`, and `context` that include `:focus` + # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + config.filter_run_when_matching :focus + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = "doc" + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end