coding world cup

Write AIs to play football

This project is maintained by richard shepherd nick pollard

Logging and Debugging

Logging

The game-engine logs to the file 'log.txt' in the log folder off the root of the game-engine. This contains a log of all messages sent to AIs and the responses received. It can be very useful for debugging your AI, as well as being a reminder of the message formats.

AIs should do their own logging to a location within their own folder. Note that if you are testing your own AI against itself, you may have a problem if both AIs write to the same log file. The 'BootAndShoot' sample avoids this by creating unique log file names including the PID of the process.

Debugging

Debugging can be tricky, as the AI processes are launched by the game-engine rather than by your own code or IDE.

The C# 'BootAndShoot' sample contains this line in the constructor of the base 'CodingWorldCupAPI' class:


    // Uncomment this line to launch the debugger when the AI starts up.
    // you can then set breakpoints in the rest of your code.
    //System.Diagnostics.Debugger.Launch();
    
If uncommented, this breaks and launches the debugger. Other languages may support similar features. Alternatively you could attach a debugger to the running process, though this may miss some of the initial messages.