TOC
- prev
- next
- javadoc tree
2.2. Strategy concept
A Strategy is the participating programmer's contribution to the
game, and the means by which he competes.
At the start of a game, each Player is bound to a Strategy, and the
Strategy controls its Player.
A Strategy is represented by a class (or set of classes) which
implements the
Strategy interface.
A Strategy receives this information from the conductor:
- at the start of a game, a reference to the Game object.
From this, the Strategy can obtain game-constants, the Board object,
PlayerView objects for each player, and can see the owner of a
Route.
- at the start of a game, a PlayerView object representing the
Strategy's Player.
- at the end of the game, the player-index of the winner.
- the player-index of a player who purchases a Right-of-Way,
whenever that happens.
- notification that another player has paid a fare to the Strategy's
player.
- the route-index of a route which changes ownership (either by
purchase or sale), whenever that happens.
- notification that the Strategy's player's turn has begun.
- notification that the Strategy's player's turn has ended.
- the Strategy's player's Destination choices, at the start of each
delivery.
- notification that the Strategy's player has arrived at his
Destination, whenever that happens.
- notification that the Strategy's player is Bankrupt, when that
happens.
But once a player is Bankrupt, the Strategy will receive only the
bankrupt-notification, the ensuing end-of-turn notification, and the
end-of-game notification.
A Strategy may make these decisions:
- on arrival at a Junction: which Segment to follow.
(But if that Junction is the Destination, the decision is made
next turn, after the new Destination is chosen.)
- on arrival at a Destination: what, if anything, to purchase.
- after paying fares, and thereby having negative cash: which Route to
sell. (If the player has no Routes to sell, he is Bankrupt, and is
so notified instead.)
In each case, a Strategy is given the opportunity to choose, even
when there is only one legal choice.
The pseudo-choice serves as a notification.
A Strategy may make those decisions, but is not required to make
them.
If not, the conductor will choose.
TOC
- prev
- next
- javadoc tree