Overview - adQuid/DecentAI GitHub Wiki

The code contained below can be divided into two examples and the AIBrain package. Decent AI is intended to be used as a tool to determine what a logical course of action would be in a game based on the model provided to it. It does not actually take actions on the model itself in case a developer wants to use a second layer of AI to make further decisions, or have logic to rule out the AI's decisions altogether.

The AIBrain class works by making copies of the game model provided and running hypothetical versions of the game under the assumption it took different courses of action, and evaluating the results based on the scoring model provided to it. Integrating your game to the AI still takes some investment, and makes strict requirements of your model's design, but it allows a developer to divide the work into smaller components that don't need to account for every other part of the game, as Decent AI weeds out bad ideas. In addition, because the AIBrain runs "real" copies of the game model, developers don't need to worry about changes to the game making existing AI logic irrational. So long as you tell Decent AI that a game rule exists, it will look at consequences of the rule automatically, and behave according to what would actually happen.

Decent AI makes no promises of "optimal play". It will prune and combine ideas in ways that are hard to predict, and if not perfectly integrated (particularly with the IdeaGenerator interface) will miss ideas that are obvious to humans. What it IS good at is avoiding obvious pitfalls and self-destructive behavior that can result in un-challenging play for opponents, and adapting automatically to implications to changes in game rules that a developer would have a hard time anticipating.