AI

OpenBGE has some built in code for making it very fast to create AI for new boardgames.

See Hive for an example of using the code. Current functionality:
 * When it is the HiveComputerPlayerController's turn, it will create a separate thread (so that processing can be done on a different processor core on the Xbox or PC) which will determine the best move. This is done by calling HiveAiAgent.CalculateNextPlyAsynchronously.
 * Each AI agent must be implement CalculateNextPly (which is called inside of the thread... the synchronization is handled automatically by OpenBGE).
 * If the ply is determined before a certain amount of time has passed ( HiveComputerPlayer.DELAY_TO_THINK_IN_MILLIS ), then the thread will not apply the move until that amount of time has elapsed. This creates a minimum-delay so that the computer moving immediately after the human player is not a jarring experience.
 * The AiAgents (which the ComputerPlayerController should use to figure out the move) can extend MinimaxBoardGameAgent to be able to take advantage of a system for using the minimax algorithm with alpha/beta pruning. All that needs to be done on a game-specific level is to implement the IMinimaxBoardGamePlayerController interface (which is done in HivePlayerController, for example).

Overview

 * TODO: Explain minimax
 * TODO: Explain alpha-beta pruning
 * TODO: Explain multithreading
 * TODO: Explain timeouts
 * TODO: Explain presorting so that timeouts aren't as bad
 * TODO: Explain Failure case of using best pre-scoring when none of the nodes gets fully evaluated before timeout.

Creating AI for a new game
TODO: create step-by-step instructions.