vooga.aiEngine.stickfightergameAI
Class StickFighterAlgorithm
java.lang.Object
vooga.aiEngine.Algorithms.AbstractAlgorithm
vooga.aiEngine.stickfightergameAI.StickFighterAlgorithm
public class StickFighterAlgorithm
- extends AbstractAlgorithm
StickFighterAlgorithm.java
- Author:
- Cody Freeman
StickFighterAlgorithm would theoretically be ready to go if the game
existed. The algorithm has three steps:
1.) Find the nearest target by finding the distances between the AI
and the target. A different approach to finding nearest targets that
accounts for environmental conditions and obstacles could easily be
added on if the game was ever built.
2.) Go through every possible move the ai has, but directed towards
the target, and see which one gets the ai closest to the target and
does the most damage to the target.
3.) Carry out the best action.
Currently the AI is sitting on its own, but it could be extended for
future use in fighting games involving any number of players, while
also allowing for extensions of movesets using separate files.
Method Summary |
void |
perform(java.lang.Object... args)
Performs an arbitrary algorithm with arbitrary parameters. |
void |
performAlg(GameItem ai,
java.util.ArrayList<GameItem> targets,
java.util.ArrayList<java.util.EventObject> moves)
Performs the algorithm. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StickFighterAlgorithm
public StickFighterAlgorithm()
performAlg
public void performAlg(GameItem ai,
java.util.ArrayList<GameItem> targets,
java.util.ArrayList<java.util.EventObject> moves)
- Performs the algorithm. Finds closest target, and tests all possible
moves, assigning numerical values tied to each move, then carries out the
highest-valued move.
- Parameters:
ai
- - Gameitem representing the ai's status.targets
- - An arraylist of Gameitems, with each corresponding to the
state of each possible target.moves
- - A list of moves read in from a file, which allows for more
moves to be added by typing in one line of code and creating a
corresponding EventObject.
perform
public void perform(java.lang.Object... args)
throws java.lang.RuntimeException
- Description copied from class:
AbstractAlgorithm
- Performs an arbitrary algorithm with arbitrary parameters. Defines the
basic parameters of an algorithm.
Algorithms generally require a number of EventObjects which the algorithm
fires according to certain specifications.
- Specified by:
perform
in class AbstractAlgorithm
- Throws:
java.lang.RuntimeException