6.170 Laboratory in Software Engineering
Fall 2003
Final Project: Antichess: TextUI spec
Due: See Schedule

Handout F4.1

Contents:

main

You should create a class antichess.TextUI that contains a main method. main is an interactive loop between a human and a computer. The TextUI should wait for user input. Valid user input is in the form of commands. Outputs as a result of a command should be terminated with a newline. If multiple lines are output, the last line should also be terminated with a new line.

Main must be executed with zero command-line arguments, like this:

java antichess.TextUI 

The behavior of the TextUI is unspecified when main is run with one or more command-line arguments.

Commands

Each command must be one of the following. Parameters to commands are enclosed in square brackets.

For each command except MakeNextMove, the specified behavior completes within 10 seconds.

If the user input does not match one of these commands, output Input error alone on one line.

When a player has won the game, output on its own line: [Player color] Player has won. For example, if the black player has won, output: Black Player has won. At this point, you can assume that the Antichess program has just been started and therefore, you only need to support a subset of commands.

Timing

In the TextUI, time must be kept against the human and computer players, just as it is in the GUI.

If the clock runs out on a human player, the player can be informed that they have lost after the next TextUI command is entered--it is not necessary to interrupt the player. If the clock runs out on a computer player, the system must immediately report that the other player has won.

All commands except MakeNextMove must complete within 10 seconds. MakeNextMove can take as long as the computer player wishes, subject to the constraints of the game clock.