Points AI Protocol, version 6

The communication between the AI and the GUI interface is done via messages to standart input of the AI and messages from standart output of the AI. For example, if AI wants to say something, it must send a message to his standart output. The GUI then must capture this message and analyze it. If the GUI wants to say something, it sends a message to the standart input of the AI.

AI -->>> AI output -->>> catched by GUI -->>> analyzed by GUI

GUI -->>> thrown in to AI input -->>> analyzed by AI

More precise, every GUI->AI message must have the form:

id command_name arguments\n

And the AI must reply to it with one message of the form:

isOk id command_name arguments\n

"isOk" is a single letter. It is "=" in case of a success and "?" in case of an error.

"id" is an int. It must be copied by the AI into his reply.

"\n" means "end of line".

Command names

list_commands

return arguments — a space separated list of commands that the AI supports (can accept).

quit — request for the AI to exit.

return arguments — none.

init width height random_seed — initialization. random_seed — seed for random number generator, useful for reproducing games.

return arguments — none.

name

return arguments — name of the AI.

version

return arguments — version of the AI.

play x y color

return arguments — x, y, color of a played move.

gen_move color — request to calculate an AI move, but do NOT make it on the field.

return arguments — x, y, color of the suggested move.

gen_move_with_complexity color complexity — request to calculate an AI move with the given complexity, but NOT to make it on the field. Complexity is a number from 0 to 100. The interpretation of this number lies on the AI.

return arguments — x, y, color of the suggested move.

gen_move_with_time color time — request to calculate an AI move within the given time (milliseconds), but NOT to make it on the field.

return arguments — x, y, color of the suggested move.

undo — undo move.

return arguments — none.

Explanations:

  • x is a number from 0 to fieldSizeX - 1. For y it's the same, of course.
  • color is a boolean value typed as "0" or "1".
  • An error message should not contain return arguments.
  • If the argument string is returned, it should not contain spaces.