This file contains specifications for the data structures, subroutines, and equates that are used to create our user interface.
- user_interface: the central data structure by which the user interface is defined and created
-
user_interface.equ
: equates used by user_interface
- ui_command: a user command returned by the interface
ui_command = oneof[domove: moveData, timeout:null, setname_white: string,
settime_white: int, makecomputer_white: null,
makehuman_white: null, setname_black: string,
settime_black: int, makecomputer_black: null,
makehuman_black: null, setlevel_white: int,
setlevel_black: int, dosave: string, doload: string,
pause: null, step: null, unpause: null,
donew: null, doquit: null, setteleport: teleportState]
- domove means that the user wants to make the move specified in
moveData. The move may be illegal.
- timeout means that all the player's allotted time has elapsed without
the player doing anything
- setname_white means that the user wants to change white's name to
that string.
- settime_white means that the user wants to set the time on the white
player's timer to that int (in milliseconds)
- makecomputer_white means that the user wants to make the white
player be handled by the computer
- makehuman_white means that the user wants to make the white
player be handled by the user
- setlevel_white means that the user wants to set the level of the
white computer player to that int (higher number = better player)
- setname_black means that the user wants to change black's name to
that string.
- settime_black means that the user wants to set the time on the black
player's timer to that int (in milliseconds)
- makecomputer_black means that the user wants to make the black
player be handled by the computer
- makehuman_black means that the user wants to make the black
player be handled by the user
- setlevel_black means that the user wants to set the level of the
black computer player to that int (higher number = better player)
- dosave/doload means that the user wants to save/load the game to/from
the file whose name is that string. Filename may not be valid/
- pause means the user want to pause the game if two computer
players are playing each other. This command has no meaning unless
both players are computers, but the user interface needn't check
for that.
- step means that the user wants one computer to make a move. This
command has no meaning unless both players are computers, but the
user interface needn't check for that.
- unpause means that the user want the computers to start playing
each other continuously again. This command has no meaning unless
both players are computers, but the user interface needn't check
for that.
- donew means that the user wants to terminate the current game and start
a new one
- doquit means that the user wants to quit the program
- setteleport means that the user wants to set the teleport state to that state; the teleport locations in the state (if it is "on"), may not be valid.
- game_state: contains all information about the current state of the game (other than the game board) that the user interface might want to display
-
game_state = record[white: player_state, black: player_state,
game_paused: bool]
- game_state (and its component player_state records) is modified
only by the main program. The user_interface reads but must never
modify the game_state.
- white is the state of the white player.
- black is the state of the black player.
- game_paused is true if the game is in a paused state and false if
it is not. This flag has meaning only if both players are
computers.
- player_state: contains information for the game_state which is specific to a particular player
-
player_state = record[name: string, time: int, isComputer: bool,
computerLevel: int]
- name is the name of the player.
- time is the time left on the player's clock, in milliseconds.
- isComputer is true if the player is a computer and false if the
player is a human.
- computerLevel is the skill level (1-5) of the player if the player
is a computer; unused if player is human.
- graphic_piece and graphic_board: data structures used internally by the user_interface module.