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 FinalScore extends TableFixture {
09: private Bowling game;
10:
11: protected void doStaticTable(int rows) {
12: game = new BowlingGame();
13: doRolls();
14: doScore();
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 doScore() {
27: int expected = getInt(0, 21);
28: int actual = game.score(10);
29: if (actual == expected)
30: right(0, 21);
31: else
32: wrong(0, 21, "" + actual);
33: }
34: }
|