vooga.aiEngine.pongAI
Class PongPlayer

java.lang.Object
  extended by vooga.gameEngine.game.GameRelatedObject
      extended by vooga.aiEngine.AbstractPlayer
          extended by vooga.aiEngine.pongAI.PongPlayer
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, TimeListener

public class PongPlayer
extends AbstractPlayer
implements TimeListener

PongPlayer.java

Author:
Cody Freeman This class is an AI for Pong, which due to simplicity is more or less a matter of tracking the ball's position when it is coming towards the paddle and remembering where the ball tends to approach when the ball is going away from the AI. If friction is applied to the ball and paddle, then an A* algorithm may be implemented to find the best angle and velocity to use to move the ball the greatest distance from the human at the greatest speed.
See Also:
Serialized Form

Constructor Summary
PongPlayer()
           
 
Method Summary
 void timeUpdated(TimeUpdateEvent t)
          Uses the specified algorithm when a time update event is called
 
Methods inherited from class vooga.aiEngine.AbstractPlayer
addAIControlledListener, addItemToTrack, getAI, getDifficulty, getItemsToTrack, setDifficulty
 
Methods inherited from class vooga.gameEngine.game.GameRelatedObject
addEventListener, clearListeners, equals, fire, fire, fire, getEventListeners, getID, getListenerCount, removeEventListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PongPlayer

public PongPlayer()
Method Detail

timeUpdated

public void timeUpdated(TimeUpdateEvent t)
                 throws java.lang.RuntimeException
Uses the specified algorithm when a time update event is called

Specified by:
timeUpdated in interface TimeListener
Overrides:
timeUpdated in class AbstractPlayer
Parameters:
t - is the TimeUpdateEvent
Throws:
InvalidAlgorithmArgumentsException
java.lang.RuntimeException