PlayerAI is the main force that controls how a game turns out. It decides where and how tokens move, the tokenClasses used and pretty much any point of strategy used at all.
PlayerAIs can follow the Decorator pattern. The Base AIs are the bottom-level ais which have a default for everything and generally deal with strategy and actions. The Decorator AIs decorate base AIs and generally provide more information to the AI, add extra functionality or outright override certain traits of the AI.
All PlayerAIs must extend com.rayrobdod.deductionTactics.PlayerAI
.
The abstract class has three abstract methods:
selectedClasses(myIndexInSelectedClasses)
, which will be the result from when
selectTokenClasses was called.
In addition, any Base must have a no-arg constructor, and any Decorator must a one-arg constructor where that arg is a PlayerAI.
Currently the program doesn't actually look anywhere for extensions. This will need to change eventually.
Anyway, the lookup of these classes are implemented as Services. Services are lists enumerated one per line in files inside the META-INF/services directory in a jar.
The base AIs are listed in the com.rayrobdod.deductionTactics.PlayerAI service and the decorator AIs are listed in the com.rayrobdod.deductionTactics.PlayerAIDecorator service
The service reads each line as a Java Class name. Until an explicit extension location is defined, just make sure the class itself is in the classpath and that the class is mentioned in a service file so the program is possible to find the PlayerAI.
These are the PlayerAIs provided by default. They are all in the com.rayrobdod.deductionTactics.ai package.
Ways for a human to interact with the game
Computer-controlled players
Ways to display information to a player.
These traits override the default team-selection algorithms.
They tend to not play nice together or with the Network Client/Server