Due: Thursday, March 3rd, by 23:59
Group Size: 1-3
Programming Language: The skeleton is in Java, but you can do this in any language
Provided skeleton: prog2.zip
Having the computer play a game with a human player has always been an attractive way to showcase artificial intelligence, though one could argue that the intelligence used for choosing a good move in a particular game is too restrictive to be generally useful. However, writing a game playing agent introduces important concepts that are useful throughout any type of AI work, including real-time constraints (humans won't wait forever while you think) and the ability to evaluate a state or situation to inform a decision.
This is an assignment where you get the opportunity to write a game playing agent. The game is the classic “Connect 4” game, where the goal is to connect four of one's own discs of the same color next to each other vertically, horizontally, or diagonally before one's opponent can do so. The red player in the screenshot on the right has just won the game (diagonal from top left).
Submit a single zip or rar file into MySchool with all the required code in order to run your game playing agent. Include a readme.txt explaining how to run it (NOTE: this is important if you're not using the Java skeleton). Remember to document your code! In particular, parts where you implemented something clever
Be also prepared to have your agent competing against other agents in the tournament! Make sure you're using the standard stdin/stdout mechanism for input/output of your program.
The provided skeleton does not compile as it is. You need to fill in, at least, TODOs in the file State.java, except those that are marked otherwise. Once you are done with this, all files should compile. If you have ant installed you can issue the command “ant compile” in the root directory. The class files will be put in the
bin directory. You can run the application by changing to that directory and giving the command “java Connect4”.
NOTE: all interactions with the program are through the command line. The window displaying the board is only for showing the current state, you can't interact with it (i.e. select moves).
The command line interface is very simple. A prompt is indicated by ”>“ and all command names are one character long. You can see the list of available commands by issuing the command “h”.
If you want to implement your agent using a different language, you are completely free to do that, as long as you inform us (Hannes or Angelo) about the specific language you plan to use. If you do this, your program must use stdin and stdout as input/output mechanism, as this interface is also used to communicate with the tournament's server. Make sure your program at least accepts (and handles correctly) the commands “i”, “m”, “r”, “d”, “g”, “p” and “q” (in other words, all commands are essential but the “h” command).
The output of the program only matters in three cases.
> p BBBBRBB.RBBB...RBBR...RRR....BRR....RR.....
If you don't use the Java skeleton as a base, make sure you also flush the standard output every time you display the prompt.
|#||Team Name||Member 1||Member 2||Member 3||Language|
|1||Finnur||Finnur Emil Björgvinsson||Java|
|2||Helgi||Helgi Siemsen Sigurðarson||Java|
|3||Team Dragon||Þorsteinn Þorvaldsson||Java|
|5||Mask||Magnús Ágúst Skúlason||C|
|7||Abalpet||Árni Steingrímur Sigurðsson||Baldur Blöndal||Pétur Ólafur Aðalgeirsson||Java|
|8||Ricky Bobby||Eiríkur Fannar Torfason||Grímur Tómas Tómasson||C++|
|9||AHJ||Ásgeir Jónasson||Hrafn Jökull Geirsson||Jökull Jóhannsson||Java|
|11||Italian Team||Carmine Oliva||Lorenzo Scagnetti||Niccolo Drum Rossetti||Java|
|12||Gunjon||Gunnar S Sigurbjörnsson||Jón Friðrik Sigurðarson||Java|
|14||Gudelin||Elín Carstensdóttir||Guðrún Hauksdóttir||Java|
|16||Sigurdur||Sigurður Jökull Eydal Tómasson||C#|