In this exercise you are supposed to implement an agent playing through the given interface the game of trimok, which is a two-player board game that bears some resemblance to checkers. The rules of trimok are available at http://www.sci.fi/~tarvo/spk/.
The agent needs to be implemented using (ANSI standard) C++
so that the agents can be cast to play against each other in a test bench. The
data structures and algorithms of the Standard Library may be used freely in
this exercise. You should implement the agent as a class derived from the abstract
base class given in home/ai/trimok/english/Player.h.
The name of the class needs to of the form t123456, where the numbers correspond
to your student number. To avoid namespace clashes, keep all of your
implementation within the namespace of the class mentioned above or within your
own namespace (of the form n123456).
The simulator for trimok is available at Lintula directory /home/ai/trimok/english. This simulator will be used to test the agents. You are urged to use it also for your own tests. Eventually all agents must operate in Lintula, but if you want to program and develop the agent in your own environment, observe that the source code for the simulator is in the same directory. You can find out the exact game progress from the code.
The simulator uses two (different) instantiations of the class Player. It makes them play against each other as many times as a parameter determines. A game of trimok terminates
· when all pieces of one of the players have been captured,
· one or the other player gives up by moving any of its pieces to the same location that it already occupies, or
· the time limit is reached.
The time limit is a parameter of the simulator. After the games have terminated, the simulator gives the end result of the games. If a game terminates because the time limit is reached, the winner is determined by the number of remaining pieces.
A simulator for some particular classes is created using the script trimokmake, which takes as parameters two classes. Trimokmake has to be run in a directory that has subdirectories containing the source codes of the given classes and Makefile. These subdirectories need to have the same names as the classes contained in them. As a result program trimoksim is created. For example, the trimoksim in home/ai/trimok/english/ has been created by running in hopeatilhi
home/ai/trimok/english/trimokmake t777777 t999999
You can also test your own program by using test scripts testtrimok1 and testtrimok2. They are the same as trimokmake except that in them as the other agent automatically get linked the greedy agent t999999. In the simulation of testtrimok1 the greedy agent plays with black pieces and in the simulation of testtrimok2 it plays using white pieces. This may make a difference because the player with white pieces always gets the first move. The following command produces into the working directory the binary file trimoktest1, as long as the directory includes subdirectory t123456:
The returned programs have to follow good programming style and be properly commented. You need also to return a makefile, which from the returned program files produces the object file t123456.o with command make. It should be obvious that the agent may only choose legal moves and it has to be able to play any to end without crashing down.
The agent is viewed to be sufficient, if it able to beat the short-sighted and greedy agent t999999 using both white and black pieces. However, you should not try to tailor the trimok agent to take advantage of the shortcomings of t999999. The agent should be able to play against other opponents as well. An agent may not deliberate on its actions for an excessive time. It is required that beating t999999 does not take more than a minute; the game has to end before one minute has passed and t999999 may not have any moves left.
Agents that pass the test are graded by organizing a tournament between them. Any agent plays against each other agent twice – once with white and once with black pieces. If an agent cannot play any one of its games to end, it is disqualified from the tournament and accepted with zero points. An agent that tries to make an illegal move in the tournament will have the same destiny. In summary, an agent must work sensibly, without error, and in reasonable time also in a game with another opponent than t999999. It is also prohibited to use time up tactically. The quality of the program code has an impact on the grading of the programming exercise.
The agent program and the additional files are e-mailed to M.Sc. Heidi Koivisto (email@example.com), mark as subject AI trimok delivery, and attach the zipped pack of files to the message.
For a successful delivery you will soon get a confirmation indicating that the program has been received. The agents will be checked after the dead line May 31, 2010, once the tournament has been organized.
You are required to deliver a report on the programming exercise. Please deliver a PDF file rather than. e.g., a Word document. The main idea of the report is to clarify the operation of the program and its design principles. The report is taken into account in grading the exercise. The report is also intended to help you design and plan the implementation carefully, since in whole the agent is relatively complex program. As the code can grow to include a lot of lines and there are many possible solutions, careful and clear reporting on the implementation and the underlying principles is very important.
The report of the program must cover at least the following points.
It is most advisable to use illustrative figures in the report.
Please deliver the report to Heidi Koivisto (firstname.lastname@example.org) by the dead line May 31, 2010.
The most common reason for rejecting exercises implemented on C++ seems to be that compiling the code does not succeed in the test situation. Two common reasons for this are: The VPATH of makefile points, e.g., to directory .. or some own directory, while it should, almost without an exception, be /home/ai/trimok/english. Another cause of path problems are #includes. The programs may not assume that Pawn.h and Player.h are in directory .. or can be found any other relative path. The correct approach is to use the absolute path /home/ai/trimok/english.