Running and Debugging your TicTacToe competitor

  1. Unzip the contents of the ttt.zip file into the cgi-bin directory associated with our PythonWebserver.

  2. 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.

  3. Let's test the program with a variety of appropriate command-line arguments:

    1. python3  TTT-Random.py  result_prefix=fred id=1
      (this will print: )
      fred
      author=P. Brooks
      title=Random Mover

    2. 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)

    3. 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)

  4. Now we have to test it with the TimeDriver-py3.py program, which will be the parent program running your competitor:

    1. 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.

    2. 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)

  5. All right.  It's showtime.  Let's try your program in its intended habitat...

    1. Copy your program file into the cgi-bin subdirectory of the PythonWebServer (if not there already).

    2. Bring up the PythonWebServer.

    3. (correction from previous version): In your browser, go to the URL:  localhost:9000/cgi-bin/game-start.py

    4. It will allow you to choose the name of your competitor program file  (which must reside in your  /cgi-bin directory)

    5. ...and, hopefully, things will work... (though this rarely happens).

    6. The first test is to press the Check Program button and see if you get your name and program title.  If so, happy sailing....