Class AI

java.lang.Object
  |
  +--Player
        |
        +--AI

public class AI
extends Player

This class models all aspects of the AI." You can read more about the class AI in its design documentation.


Field Summary
 
Fields inherited from class Player
forcePoints, planets, playerUnits, victoryPoints
 
Constructor Summary
AI()
           
 
Method Summary
 void admitDefeat()
          Calls slightly less happy window when AI loses to human player
 void AI(Group AIUnits, int forcePts, Planet[] Iplanets)
          Initial shot at constructor for AI player; requires: 1) reference to the units owned by AI player 2) number of force points accounted to AI player can be 0 if not applicable 3) reference to the planets ONLY that the AI controls
static boolean CheckLethal()
          Imperial turn; operations; movement: AI stacks characters with military units or space ships AI lists units which are eligible to be moved AI first moves unstacked characters ie.
static boolean CheckRange()
           
 int GroupDecision(int n)
           
 char makeDecision(char[] m)
          Selects a character from an array of available characters
 int makeDecision(int x)
          A very boring function which can be called until such time as we code in better AI decision- making algorithms.
 void react()
          Rebel turn; operations; enemy reaction phase: 1) AI checks for location of detected rebels/militia 2) AI compares these to locations of imperial militia 3) AI randomly moves a unit to the rebel-occupied environ 75% of the time
 void search()
          Rebel turn; search: 1) AI makes or uses a list of detected rebels (if one is available) in same location as imperial units 2) AI searches for any/all rebels in the list 3) Successful search will always lead to combat
 void showTaunt()
          Calls happy little window for AI to taunt human player
 void ToggleActive(CharacterGroup units, int adv)
          Function for deciding when imperial characters are active.
 void tryCombat()
          Rebel turn; operations; combat phase: Imperial turn; operations; combat phase: 1) AI checks if combat is possible; if not, returns 2) AI makes list of all environs where combat is possible 3) AI steps through, removing from it environs where imperial forces are outnumbered 3:1 4) AI steps through list, assigning leaders where available 5) AI calls combat for each environ in the list
 
Methods inherited from class Player
getForcePoints, getPlayerType, isPlayerAI, isPlayerHuman, move, Player, setForcePoints, setPlayerType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AI

public AI()
Method Detail

AI

public void AI(Group AIUnits,
               int forcePts,
               Planet[] Iplanets)
Initial shot at constructor for AI player; requires: 1) reference to the units owned by AI player 2) number of force points accounted to AI player can be 0 if not applicable 3) reference to the planets ONLY that the AI controls


makeDecision

public int makeDecision(int x)
A very boring function which can be called until such time as we code in better AI decision- making algorithms. This function just returns an int from 0 to x-1, which can be used to make a decision directly or as an index into an array of possible decisions.


react

public void react()
Rebel turn; operations; enemy reaction phase: 1) AI checks for location of detected rebels/militia 2) AI compares these to locations of imperial militia 3) AI randomly moves a unit to the rebel-occupied environ 75% of the time

Overrides:
react in class Player

tryCombat

public void tryCombat()
Rebel turn; operations; combat phase: Imperial turn; operations; combat phase: 1) AI checks if combat is possible; if not, returns 2) AI makes list of all environs where combat is possible 3) AI steps through, removing from it environs where imperial forces are outnumbered 3:1 4) AI steps through list, assigning leaders where available 5) AI calls combat for each environ in the list


search

public void search()
Rebel turn; search: 1) AI makes or uses a list of detected rebels (if one is available) in same location as imperial units 2) AI searches for any/all rebels in the list 3) Successful search will always lead to combat

Overrides:
search in class Player

showTaunt

public void showTaunt()
Calls happy little window for AI to taunt human player


GroupDecision

public int GroupDecision(int n)

makeDecision

public char makeDecision(char[] m)
Selects a character from an array of available characters


admitDefeat

public void admitDefeat()
Calls slightly less happy window when AI loses to human player


CheckLethal

public static boolean CheckLethal()
Imperial turn; operations; movement: AI stacks characters with military units or space ships AI lists units which are eligible to be moved AI first moves unstacked characters ie. environ to environ this is randomly done 50% of the time AI then moves characters/military between planets these are also moved 50% of the time the target location is chosen first based on where the loyalty has fallen below some base line and second randomly to any planet


CheckRange

public static boolean CheckRange()

ToggleActive

public void ToggleActive(CharacterGroup units,
                         int adv)
Function for deciding when imperial characters are active. This function will b responsible for toggling the activity of any character that must be toggled.