All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.lotspiech.poker.strategy.Strategy

java.lang.Object
   |
   +----com.lotspiech.poker.strategy.Strategy

public class Strategy
extends Object
implements Serializable
This class calculates the optimal play, hand by hand, for a given machine.

Copyright 2001, 2002 by Jeffrey B. Lotspiech. This program is open source; it is licensed under the Common Public License Version 0.5.

Author:
Jeffrey B. Lotspiech

Variable Index

 o checkPointInterval
 o COPYRIGHT
 o count
 o hands
 o machine
 o serialVersionUID

Constructor Index

 o Strategy()
Strategy constructor comment.
 o Strategy(Machine, File)
This calculates a strategy for a given game, checkpointing the strategy in the given file.

Method Index

 o calculateStrategy(File)
This method was created in VisualAge.
 o dump(PrintWriter)
This method was created in VisualAge.
 o getHands()
This returns an Enumeration for this strategy's "registered hands".
 o getMachine()
This method was created in VisualAge.
 o handCount(int, int, int, int, int)
This method was created in VisualAge.
 o load(String)
This loads a strategy from a file.
 o main(String[])
This method was created in VisualAge.
 o nextSuit(int)
This method was created in VisualAge.
 o readObject(ObjectInputStream)
This method was created in VisualAge.
 o store(File)
This method was created in VisualAge.
 o toString()
This method was created in VisualAge.
 o writeObject(ObjectOutputStream)
This method was created in VisualAge.

Variables

 o COPYRIGHT
 private static final String COPYRIGHT
 o serialVersionUID
 public static final long serialVersionUID
 o checkPointInterval
 private static final int checkPointInterval
 o machine
 private Machine machine
 o hands
 private Vector hands
 o count
 private int count

Constructors

 o Strategy
 public Strategy()
Strategy constructor comment.

 o Strategy
 public Strategy(Machine machine,
                 File file) throws Exception
This calculates a strategy for a given game, checkpointing the strategy in the given file. (It can take hours to calculate a strategy.)

Parameters:
machine - com.lotspiech.poker.Machine
file - A File object that will be the checkpoint file.

Methods

 o calculateStrategy
 private double calculateStrategy(File file) throws Exception
This method was created in VisualAge.

Parameters:
machine - com.lotspiech.poker.Machine
Returns:
double
 o dump
 private void dump(PrintWriter out)
This method was created in VisualAge.

Parameters:
out - java.io.PrintWriter
 o getHands
 public Enumeration getHands()
This returns an Enumeration for this strategy's "registered hands".

Returns:
java.util.Enumeration
 o getMachine
 public Machine getMachine()
This method was created in VisualAge.

Returns:
com.lotspiech.poker.Machine
 o handCount
 private static int handCount(int i0,
                              int i1,
                              int i2,
                              int i3,
                              int i4)
This method was created in VisualAge.

Parameters:
i0 - int
i1 - int
i2 - int
i3 - int
i4 - int
Returns:
int
 o load
 public static final Strategy load(String filename) throws IOException, ClassNotFoundException
This loads a strategy from a file.

Parameters:
filename - The name of the file.
Returns:
The strategy.
Throws: IOException
If an I/O error occurs.
 o main
 public static void main(String args[]) throws Exception
This method was created in VisualAge.

Parameters:
args - The arguments are: "name of machine"
 o nextSuit
 private static final int nextSuit(int in)
This method was created in VisualAge.

Parameters:
in - int
Returns:
int
 o readObject
 private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
This method was created in VisualAge.

Parameters:
out - java.io.ObjectOutputStream
 o store
 private void store(File file) throws IOException
This method was created in VisualAge.

Parameters:
file - java.io.File
 o toString
 public String toString()
This method was created in VisualAge.

Returns:
java.lang.String
Overrides:
toString in class Object
 o writeObject
 private void writeObject(ObjectOutputStream out) throws IOException
This method was created in VisualAge.

Parameters:
out - java.io.ObjectOutputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index