Unzip the contents of the ttt.zip file into
the cgi-bin directory associated with our PythonWebserver.
Also copy your competitor python file into the same
cgi-bin directory. For the examples below, we'll be testing the
TTT-Random.py competitor, which was developed in python3, so
python3 will be the interpreter. If your version of
python is version 3.x but is invoked with the python
command, rather than the python3
command on your system, then edit the TTT-Random.py
program, and change the "python3"
to "python" in its first line. In the place of
TTT-Random.py, you should be testing your own competitor program in the
same way as below, and getting results formatted in exactly the same way.
Let's test the program with a variety of appropriate command-line arguments:
python3 TTT-Random.py
result_prefix=fred id=1
(this will print: )
fred
author=P. Brooks
title=Random Mover
python3 TTT-Random.py result_prefix=fred id=1
result_file=george.txt
(this will create the george.txt file with the same contents as above)
python3 TTT-Random.py result_prefix=harry
result_file=george.txt board=__x______
(this will create or overwrite george.txt with some random move
formatted as below). However, instead of the silly commentary
("(pretty random, though)") , you should provide the Best move
also in English and a projection for the rest of the game, as in "Best
move: upper-left. Draw in 4 moves" :
harry
move=0
(pretty random, though)
Now we have to test it with the TimeDriver-py3.py
program, which will be the parent program running your competitor:
Copy your program into the cgi-bin directory containing the TimeDriver-py3.py program (TTT-Random.py should be there already). Then run the test below, substituting your program filename for TTT-Random.py.
python3 TimeDriver-py3.py
progfile=TTT-Random.py result_file=george.txt
result_prefix=what cutoff_time=4 board=__x______
(this will actually print something like)
what
move=6
(pretty random, though)
All right. It's showtime. Let's try your
program in its intended habitat...
Copy your program file into the cgi-bin subdirectory of the PythonWebServer (if not there already).
Bring up the PythonWebServer.
(correction from previous version): In your browser, go to the URL: localhost:9000/cgi-bin/game-start.py
It will allow you to choose the name of your competitor program file (which must reside in your /cgi-bin directory)
...and, hopefully, things will work... (though this rarely happens).
The first test is to press the Check Program button and see if you get your name and program title. If so, happy sailing....