The next job is to create a tictactoe competition program that fits into the framework that allows someone to play the competitor using a browser. I have developed this framework (consisting of 3 Python3 programs and one webpage) that you'll need, and you can add your program to the framework to run TicTacToe through your browser.
The following instuctions show the requirements for your program to fit into the framework. Any program not fullfilling these requirements will fail to run properly and will be punished. As an example, let's say you have the program fred.py which is your competitor program.
The progam will be called by the python3
program on the command-line, as in:
$ python3 fred.py .... {command-line arguments}...
so make sure that your preferred python interpreter is called
python3
Also make sure that you can call up the Python interpreter by executing
the command "python3" on your command-line, either in the Mac or UNIX
terminal or in the CMD window on Windows.
fred.py will be called with a number of command-line arguments, some of which it may ignore. These arguments may be given in any order. Here they are:
result_prefix={some-string} This argument will be given. fred's first line of output, whether to a file or to stdout, must be the string given by result_prefix followed by '\n'. For instance, if the argument is result_prefix=Fleep then the first line of output must be Fleep.
result_file={filename} This
argument is optional. If provided, all output should be
appended to that
file. If not provided, output should be printed.
board={9-char board} This argument
is optional and will be given if the task is to return the best next
move. Either this argument or id={anything} must be
given. When this argument is provided, the output should look
something like this, below. Formatting is important: "move" is
lower-case, and there are no spaces around the "=" in that line.
Fleep
move=2
Best move: upper-right. Draw in 4 moves.
id=something The
something can be any value. This argument is optional.
If given, then fred will output the author and title of the
program. When this argument is provided, the output should look
something like this, below. Formatting is important: "author" and
"title" as lower-case and there are no spaces around the "=" in those
lines.
Fleep
author=Beelzebub
title=The Best (v. 19.2.b)
cutoff_time={seconds} The maximum amount of time allocated to this program. Feel free to ignore. This will be enforced by the parent of this program.
So, the program will either be called to compute the next best move (when the "board=" argument is given) or to identify itself (when the "id=" argument is given).
When outputing the best move, also say it in English with the appropriate future claim: (as in: "Best move: upper-right. Draw in 4 moves").
Typically, you'll be given 4 seconds to compute (actually, this is elapsed time, not CPU time). Your program should be able to do this easily, without a sliderule or WolframAlpha.
To show you how the plumbing works, I've included a brilliant competitor program: TTT-Random.py which will assess its opponent's personality virtues and credit score, and choose a move accordingly.
Having built a competitor, it's time to try RUNNING IT (omg).