TOC - prev - next - javadoc tree

2.3. Game and conductor concepts

A Game is a game of BusRider.

A Game has:

A Game is represented by the Game class.

A Strategy can see all of the above aspects of a Game, although the players are visible only through PlayerView objects. A Strategy can also query the Game object, to see which player owns a Route.

The conductor

The BusRider Applet does more than just keep game information. It also conducts the game: sequencing player-turns, updating players, informing Strategies, accepting decisions from Strategies, and providing default choices for Strategies. That aspect of the Applet is called the conductor.

When a Strategy fails to make a choice, the conductor makes the choice on behalf of the Strategy:

The Segment-choosing code is in the Router class, and is listed here. In effect, the conductor finds a least-cost path, assuming that

  1. no rails will change ownership during the player's delivery, and
  2. the opportunity cost of the unit distance is $1/8.
(There may be more than one least-cost path; one such is picked arbitrarily.) The conductor chooses the first Segment of that path.

Admittedly, the assumptions are severe. An optimal router would take into account the distribution of the player's rolls (and therefore his speed), and even the likelyhood that a Route be purchased during the trip. It is therefore a difficult problem of graph theory, statistics, and behavioural analysis. Perhaps the programmer will prefer to forgive the occasional misdirection of the conductor.

A Strategy can see which Segment the conductor would pick by calling the Router's method. (Having done so and accepted the choice, it is more efficient to return that choice, than to return null and make the conductor recalculate.)


TOC - prev - next - javadoc tree