All Packages Class Hierarchy This Package Previous Next Index
Class pinball.player.Strategy
java.lang.Object
|
+----java.lang.Thread
|
+----pinball.player.Strategy
- public class Strategy
- extends Thread
Decide whether to flip the flipper or not.
-
boarder
- Area around flipper that is to be ignored.
-
buffer
- The information buffer.
-
buffinfo
- The information from the buffer.
-
firstTime
- Used in options to see if the they happened once.
-
flipperHeight
- Anything moving below this be considered for flipping.
-
flipperOffset
- Where is the flipper from the top of the screen.
-
flipperZone
- Y location of begin flipper zone.
-
fromBottom
- Location from bottom of screen to be considered out of play.
-
fromTop
- Location from top of screen to be considered in play.
-
id
- ID of strategy.
-
key
- The lock on the strategy.
-
leftDistance
- The distance the ball is from the left flipper.
-
leftX
- Left flipper x location.
-
leftY
- Left flipper y location.
-
middle
- The x location for the middle of the flippers.
-
outZone
-
Location from bottom of screen to be considered out of play.
-
queue
- The queue of buffers waiting to be looked at.
-
resetTime
- How long can the flipper stay up in the game.
-
rightDistance
- The distance the ball is from the right flipper.
-
rightX
- Right flipper x location.
-
rightY
- Right flipper y location.
-
stub
- The stub to connect the strategy to the system.
-
top
-
Location from bottom of screen to be considered out of play.
-
x
- X location of the ball.
-
xsize
- Image x size.
-
y
- Y location of the ball.
-
ysize
- Image y size.
-
Strategy()
- Used in the extended classed.
-
Strategy(Buffer, TextArea, Camera)
- Make a new strategy thread.
-
bufferAvailable()
- Notify the thread that a buffer is available.
-
custom()
- Allow extended classes to define a custom startup option.
-
decision()
-
Should you flip or not.
-
draw(Graphics, int, int)
- Allows the strategy to draw to the screen any lines or other graphics
for the user to see how the strategy operates.
-
flipperFlipped(boolean)
- Set the flippers flipped condition.
-
flippersCheck()
- Check if the flippers need to be reset and then decide if they need to be flipped.
-
flippersReset()
-
Reset the flippers if they are up the allowed amount of time.
-
getStub()
- Get the stub from the strategy.
-
getStubInfo()
- Get info from the stub.
-
halt()
- Halt the thread until the queue is not empty.
-
id()
- Get the id of the strategy.
-
initalize()
- Initalize the strategy.
-
option()
- Setup the options for the strategy.
-
resetTime(int)
-
Get the flipper reset time.
-
run()
- Wait until the stub filtered out the ball and then decide to flip or not.
-
setQueue(StrategyQueue)
- Set up the queue of buffers.
-
special()
- Special is used for players that want to add something special
to their strategy, but want the standard decision.
-
testing()
- Used to simulate lots packets.
-
toString()
- Get the name of the object.
x
protected int x
- X location of the ball.
y
protected int y
- Y location of the ball.
xsize
protected int xsize
- Image x size.
ysize
protected int ysize
- Image y size.
leftX
protected int leftX
- Left flipper x location.
leftY
protected int leftY
- Left flipper y location.
rightX
protected int rightX
- Right flipper x location.
rightY
protected int rightY
- Right flipper y location.
boarder
protected int boarder
- Area around flipper that is to be ignored.
flipperOffset
protected int flipperOffset
- Where is the flipper from the top of the screen.
resetTime
protected int resetTime
- How long can the flipper stay up in the game.
flipperZone
protected int flipperZone
- Y location of begin flipper zone.
firstTime
protected boolean firstTime
- Used in options to see if the they happened once.
fromTop
protected int fromTop
- Location from top of screen to be considered in play.
fromBottom
protected int fromBottom
- Location from bottom of screen to be considered out of play.
flipperHeight
protected int flipperHeight
- Anything moving below this be considered for flipping.
top
protected int top
- Location from bottom of screen to be considered out of play.
Gets value from fromTop.
outZone
protected int outZone
- Location from bottom of screen to be considered out of play.
Gets value from fromBottom.
buffer
protected Buffer buffer
- The information buffer.
buffinfo
protected BufferInfo buffinfo
- The information from the buffer.
id
protected String id
- ID of strategy.
stub
protected Stub stub
- The stub to connect the strategy to the system.
key
protected boolean key
- The lock on the strategy.
queue
protected StrategyQueue queue
- The queue of buffers waiting to be looked at.
leftDistance
protected int leftDistance
- The distance the ball is from the left flipper.
rightDistance
protected int rightDistance
- The distance the ball is from the right flipper.
middle
protected int middle
- The x location for the middle of the flippers.
Strategy
public Strategy(Buffer buffer,
TextArea gameStats,
Camera camera)
- Make a new strategy thread.
- Parameters:
- buffer - the first buffer in the series of buffer.
- gameStats - the area to write the game stats info.
- camera - the camera for the system.
Strategy
public Strategy()
- Used in the extended classed.
toString
public String toString()
- Get the name of the object.
- Parameters:
- name - of the object.
- Overrides:
- toString in class Thread
id
public String id()
- Get the id of the strategy.
- Returns:
- id of strategy.
custom
public void custom()
- Allow extended classes to define a custom startup option.
run
public void run()
- Wait until the stub filtered out the ball and then decide to flip or not.
- Overrides:
- run in class Thread
halt
public synchronized void halt()
- Halt the thread until the queue is not empty.
bufferAvailable
public synchronized void bufferAvailable()
- Notify the thread that a buffer is available.
setQueue
public void setQueue(StrategyQueue q)
- Set up the queue of buffers.
- Parameters:
- q - the queue of buffers.
testing
public boolean testing()
- Used to simulate lots packets. This will randomly release the lock.
initalize
public void initalize()
- Initalize the strategy. Finds the flippers.
getStub
public Stub getStub()
- Get the stub from the strategy.
getStubInfo
public void getStubInfo()
- Get info from the stub. The flipper locations, and flipper zone info.
resetTime
public void resetTime(int reset)
- Get the flipper reset time.
- Parameters:
- reset - the reset time.
flippersReset
public void flippersReset()
- Reset the flippers if they are up the allowed amount of time.
flipperFlipped
public void flipperFlipped(boolean status)
- Set the flippers flipped condition.
- Parameters:
- status - the flippers flipped status.
flippersCheck
public void flippersCheck()
- Check if the flippers need to be reset and then decide if they need to be flipped.
option
public void option()
- Setup the options for the strategy.
This one sets the in play area and flipper height.
decision
public void decision()
- Should you flip or not.
special
public void special()
- Special is used for players that want to add something special
to their strategy, but want the standard decision.
draw
public void draw(Graphics g,
int canvasWidth,
int canvasHeight)
- Allows the strategy to draw to the screen any lines or other graphics
for the user to see how the strategy operates.
- Parameters:
- g - the graphics area to draw to.
- canvasWidth - the width of the canvas.
- canvasHeight - the height of the canvas.
All Packages Class Hierarchy This Package Previous Next Index