Running and Debugging your TicTacToe competitor

  1. Unzip the contents of the ttt.zip file into the root directory associated with our PythonWebserver (the one that contains webserver.sh and webserver.bat).

  2. Also copy your competitor python file into the same 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.  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 own program file into the root directory of the PythonWebServer (if it's not there already).

    2. Bring up the PythonWebServer.

    3.  In your browser, go to the URL:  localhost:8000/startup.py

    4. It will allow you to enter the name of your competitor program file (just the filename, no path is required)...

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