+52
| var lib = require './index', | ||
| progression = [ | ||
| ['8'], | ||
| ['81'], | ||
| ['81','9'], | ||
| ['81','9/'], | ||
| ['81','9/','9'], | ||
| ['81','9/','9-'], | ||
| ['81','9/','9-','7'], | ||
| ['81','9/','9-','71'], | ||
| ['81','9/','9-','71','x'], | ||
| ['81','9/','9-','71','x','f'], | ||
| ['81','9/','9-','71','x','f8'], | ||
| ['81','9/','9-','71','x','f8','X'], | ||
| ['81','9/','9-','71','x','f8','X','0'], | ||
| ['81','9/','9-','71','x','f8','X','0/'], | ||
| ['81','9/','9-','71','x','f8','X','0/','3'], | ||
| ], | ||
| rolls = ['8','1','9','-','9','/', | ||
| '7','1','9','-','X', | ||
| '9','0','7','0','x', | ||
| '7','-']; | ||
| console.log(tt([['name', '1', '2', '3'],['tom', '9/', 'X', '3/'],['', '20','40','']],{align:['l','r','r','r']})) | ||
| [['name', '1', '2', '3'],['tom', '9/', 'X', '3/'],['', '20','40',''],['nee', '9/', 'X', '3/'],['', '20','40','']] | ||
| process.stdout.write('\033[2J') | ||
| function Game(){ | ||
| this.frames = []; | ||
| } | ||
| Game.prototype.addRoll = function(roll){ | ||
| var currentFrame; | ||
| if(this.frames.length === 0){ | ||
| currentFrame = []; | ||
| }else{ | ||
| currentFrame = this.frames[this.frames.length-1]; | ||
| } | ||
| currentFrame.push(roll); | ||
| } | ||
| rolls.forEach(function(roll){ | ||
| game.push(roll); | ||
| }); |
+5
-0
| 1.2.1 / 2014-04-13 | ||
| ================== | ||
| * test/testling, pkg, readme updates | ||
| 1.2.0 / 2014-04-12 | ||
@@ -3,0 +8,0 @@ ================== |
+21
-5
| { | ||
| "name": "bowling", | ||
| "version": "1.2.0", | ||
| "description": "bowling scorekeeping module", | ||
| "version": "1.2.1", | ||
| "description": "ten-pin bowling scorekeeping module", | ||
| "main": "index.js", | ||
@@ -18,8 +18,8 @@ "directories": { | ||
| "scoresheet", | ||
| "tenpin", | ||
| "ten-pin", | ||
| "bowling", | ||
| "score", | ||
| "scoring", | ||
| "sport", | ||
| "strike", | ||
| "spare" | ||
| "sport" | ||
| ], | ||
@@ -39,3 +39,19 @@ "author": { | ||
| "tap-spec": "^0.1.8" | ||
| }, | ||
| "testling": { | ||
| "files": "test.js", | ||
| "browsers": [ | ||
| "ie/8..latest", | ||
| "firefox/17..latest", | ||
| "firefox/nightly", | ||
| "chrome/22..latest", | ||
| "chrome/canary", | ||
| "opera/12..latest", | ||
| "opera/next", | ||
| "safari/5.1..latest", | ||
| "ipad/6.0..latest", | ||
| "iphone/6.0..latest", | ||
| "android-browser/4.2..latest" | ||
| ] | ||
| } | ||
| } |
+11
-4
| # node-bowling | ||
| apply scoring logic to bowling results | ||
| apply scoring logic to ten-pin bowling results. handles both incomplete and complete games. | ||
@@ -10,2 +10,4 @@ [](https://travis-ci.org/tphumeml/node-bowling) | ||
| [](https://ci.testling.com/tphummel/node-bowling) | ||
| # install | ||
@@ -21,9 +23,13 @@ | ||
| var bowl = require("bowling"), | ||
| game = ['81','9-','9/','71','9-','X','90','70','x','7-'], | ||
| var bowl = require('bowling'); | ||
| var aCompleteGame = ['81','9-','9/','71','9-','X','90','70','x','7-'], | ||
| result; | ||
| result = bowl(game); | ||
| result = bowl(aCompleteGame); | ||
| console.log(result); | ||
| /* | ||
| [ | ||
@@ -41,2 +47,3 @@ {outcome: '81', cumulative: 9, score: 9}, | ||
| ] | ||
| */ | ||
@@ -43,0 +50,0 @@ # notes |
+19
-0
@@ -139,2 +139,21 @@ var test = require('tape'), | ||
| test('a complete game with all zero-spares', function(t){ | ||
| var gm1 = ['0/','-/','0/','-/','-/','-/','-/','-/','-/','-/-']; | ||
| var result = lib(gm1); | ||
| var expected = [ | ||
| {outcome: '-/', cumulative: 10, score: 10}, | ||
| {outcome: '-/', cumulative: 20, score: 10}, | ||
| {outcome: '-/', cumulative: 30, score: 10}, | ||
| {outcome: '-/', cumulative: 40, score: 10}, | ||
| {outcome: '-/', cumulative: 50, score: 10}, | ||
| {outcome: '-/', cumulative: 60, score: 10}, | ||
| {outcome: '-/', cumulative: 70, score: 10}, | ||
| {outcome: '-/', cumulative: 80, score: 10}, | ||
| {outcome: '-/', cumulative: 90, score: 10}, | ||
| {outcome: '-/-', cumulative: 100, score: 10} | ||
| ]; | ||
| t.deepEqual(result, expected); | ||
| t.end(); | ||
| }); | ||
| test('zero frame', function(t){ | ||
@@ -141,0 +160,0 @@ var gm1 = ['--']; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17084
17.77%9
12.5%382
17.9%52
15.56%0
-100%