Due date: 3/10 : 11PM
Objective: (1) to implement several player strategies for
Ingenious; (2) to design and implement a game administrator; and (3) to
design and implement a "strategy evaluation farm"
Playing Ingenious: You have designed and implemented a
data representation for the board, a turn proxy, and an automated
player---just the mechanics. It is time to implement some strategies and
to evaluate them.
Task 1: Design and implement a game administrator.
Informally, an administrator is a function from the number of
participating players to a service that, once created, provides three
pieces of functionality:
It can accept a player's registration, which consists of a name and an
object that lives up to your player interface.
It can answer the question whether enough players have registered to play
It can run a complete game of Ingenious with the registered
players. The result is a ranking of surviving players in
descending order. A ranking is a list of ranking
records, each of which includes at least an ordinal number and
the player's name; you may wish to include the
player's score, too.
Note 1: The administrator creates 120 random tiles at the beginning of
a game. They are arranged in a fixed order and handed out according to
Note 2: If a player fails to live up to the rules of the game or fails
because its code is broken, the player is eliminated and the game
continues without the player. In other words, if you suspect that some
of your players aren't up to their job, implement some fault tolerance
in your administrator.
Note 3: If a player runs out of tiles before the game is over, the
administrator skips the player in subsequent rounds.
Note 4: A game is over when there are no places left on the board or
when there are no players left (see note 4) or when no player is able to
place a tile. The players are ordered lexicographically according in
ascending order of scores. That is, the player with the worst
minimal score for any color loses the game, even if he has the highest
score for some other color.
You may wish to equip your administrator with a method that helps you
extract additional statistical data.
Design and implement at least three distinct player strategies:
a completely random player plus the two strategies you described in the
Note: In an industrial-scale open architecture
project, software engineers may describe an informal strategy for
protecting the information embedded in a system from flowing into the
wrong parts of the system. When this happens, you should be prepared to
argue why/how the implementation lives up to the informal
description. The ideal case is an architecture where the strategy is
implemented all by itself and it is easy to explain the connection to the
informal description -- as is the case here, if you followed the implicit
interface descriptions of the assignments so far.
In this spirit, be prepared to explain how your strategy
implementation lives up to the policy in your informal description.
Task 3: Design and implement a "strategy farm". The
purpose of a strategy farm is to evaluate how various strategies perform
in various contexts. A "farm" is a program that creates an administrator,
and a number of players; registers the latter with the former; runs the
Ingenious game; and repeats this for 100 games. Determine how often
which one of your strategies wins.
Write a one-paragraph report on the result; you are welcome to add a
table of comparisons. If you sense that the results depends on certain
parameters (number of players, number of strategies present, etc), feel
welcome to conduct additional experiments.
Deliverables: Your SVN directory must contain a
subdirectory labeled "08" with the following pieces:
... source files for the admin, strategy, and farm implementation ...
TurnSource/ ... if you wish to reorganize the turn ...
BoardSource/ ... if you wish to reorganize the turn ...
xrun ... to run the Farm for one scenario
The Linux (Ubuntu) shell script xbuild
should create an
executable (if necessary). The xrun
script should consists of at
most two or three lines; its purpose is to execute one experiment (100
games of Ingenious for some scenario). It should print the results to
STDOUT; it takes no inputs.