vooga.aiEngine.stickfightergameAI
Class StickFightAIMemory

java.lang.Object
  extended by vooga.aiEngine.stickfightergameAI.StickFightAIMemory

public class StickFightAIMemory
extends java.lang.Object

StickFightAIMemory.java

Author:
Cody Freeman The AIMemory class just keeps track of player actions, analyzes them, then dumps information as needed to conserve space and to keep the computer from dying.

Constructor Summary
StickFightAIMemory(java.util.Map<java.lang.String,java.lang.Integer> CPUmoves, java.lang.String game, java.lang.String character)
          A constructor that reads in a list of moves, a game and a character so that the computer can keep track of the number of times each move is used.
 
Method Summary
 int getduration()
          Returns the number of times the AI has processed information.
 double getoddsofmove(java.lang.String s)
          Reads through player trends to try to pick out the odds that a player will carry out a particular move.
 void incrementmove(java.lang.String s)
          Increments a move counter, with an input of a move name to be incremented.
 void readFromFile(java.lang.String filename)
          Reads in a player's history to try to adjust the AI to respond according to player trends.
 void registertargetPositon(Position in)
          Remembers targets' positions for output to a history file or to a map of lists containing each player's possible positions.
 void writeToFile(java.lang.String playeraction)
          Writes player actions to an output file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StickFightAIMemory

public StickFightAIMemory(java.util.Map<java.lang.String,java.lang.Integer> CPUmoves,
                          java.lang.String game,
                          java.lang.String character)
                   throws java.io.IOException
A constructor that reads in a list of moves, a game and a character so that the computer can keep track of the number of times each move is used.

Throws:
java.io.IOException
Method Detail

incrementmove

public void incrementmove(java.lang.String s)
Increments a move counter, with an input of a move name to be incremented.

Parameters:
s - - string representing move to be incremented.

getduration

public int getduration()
Returns the number of times the AI has processed information.

Returns:
- Duration of the game in terms of the times the AI has been called.

registertargetPositon

public void registertargetPositon(Position in)
Remembers targets' positions for output to a history file or to a map of lists containing each player's possible positions. These may allow for the creation of AIMemory files that remember how certain players play in this game.

Parameters:
in - - A new position to be recorded.

getoddsofmove

public double getoddsofmove(java.lang.String s)
Reads through player trends to try to pick out the odds that a player will carry out a particular move. For now it reads entirely from precedent, and could be updated to consider relative positions or response to certain actions by the AI.

Parameters:
s - - A string corresponding to a particular action event
Returns:
- The percentage of times a player has called a particular event in the past.

writeToFile

public void writeToFile(java.lang.String playeraction)
                 throws java.io.IOException
Writes player actions to an output file.

Parameters:
playeraction - - An action carried out by a player that needs to be recorded.
Throws:
java.io.IOException

readFromFile

public void readFromFile(java.lang.String filename)
                  throws java.io.IOException
Reads in a player's history to try to adjust the AI to respond according to player trends.

Parameters:
filename - - filepath to be read in.
Throws:
java.io.IOException