01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package eg.bowling.fixtures;
04:
05: import fitnesse.fixtures.TableFixture;
06: import eg.bowling.*;
07:
08: public class SimpleScoreGame extends TableFixture {
09: private Bowling game;
10:
11: protected void doStaticTable(int rows) {
12: game = new BowlingGame();
13: doRolls();
14: doScores();
15: }
16:
17: private void doRolls() {
18: for (int i = 0; i < 21; i++) {
19: if (!blank(0, i)) {
20: int pins = getInt(0, i);
21: game.roll(pins);
22: }
23: }
24: }
25:
26: private void doScores() {
27: for (int frame = 1; frame <= 10; frame++) {
28: int column = frame - 1;
29: int expected = getInt(1, column);
30: int actual = game.score(frame);
31: if (actual == expected)
32: right(1, column);
33: else
34: wrong(1, column, "" + actual);
35: }
36: }
37: }
|