edu.columbia.cs.coms4701.agent.environments.pente
Class PenteRules

java.lang.Object
  extended by edu.columbia.cs.coms4701.agent.environments.simple.SimpleEnvironmentObject
      extended by edu.columbia.cs.coms4701.agent.environments.pente.PenteRules
All Implemented Interfaces:
EnvironmentObject

public class PenteRules
extends SimpleEnvironmentObject

A description of the rules for the current game.

Begin by implementing your agent program for the "Standard" rules, but eventually you should be able to handle any combination of rules.

Version:
0.1

User: aaron Date: Sep 26, 2006 Time: 6:14:09 AM

Author:
aaron@cs

Field Summary
static PenteRules CaptureOnly
          Capture-only rules: * 19x19 board, * Can't win with stones-in-a-row (99 to win :P) * 10 captured stones (5 pairs) to win, * Black can play anywhere.
static PenteRules Freestyle
          Freestyle rules: * 19x19 board, * 5-in-a-row to win, * 10 captured stones (5 pairs) to win, * Black can play anywhere.
static PenteRules Gomoku
          Gomoku rules: * 19x19 board, * 5-in-a-row to win, * No captures, * Black must begin in center, but 2nd move isn't restricted
static PenteRules MiniGame
          The minigame: * 5x5 board, * 5-in-a-row to win, * No captures, * Black must begin in center, but 2nd move isn't restricted
static PenteRules Quick
          Quick rules: Standard rules, with a short time limit.
static PenteRules Standard
          Standard rules: * 19x19 board, * 5-in-a-row to win, * 10 captured stones (5 pairs) to win, * Black must begin in center, * Black's second move must be at least 2 spaces away from the center
static PenteRules StandardSmallBoard
          Standard rules, but on a smaller 13x13 board: * 13x13 board, * 5-in-a-row to win, * 10 captured stones (5 pairs) to win, * Black must begin in center, * Black's second move must be at least 2 spaces away from the center
static PenteRules Tournament
          Tournament rules: Standard rules, with a time limit.
 
Fields inherited from class edu.columbia.cs.coms4701.agent.environments.simple.SimpleEnvironmentObject
changeSupport
 
Constructor Summary
PenteRules(int boardSize, int stonesInARowToWin, boolean capturesAllowed, int stonesCapturedToWin, boolean blackMustBeginInCenter, boolean blackMustAvoidCenterOnSecondMove, int requiredDistanceFromCenter)
          Constructs a new set of PenteRules (ignoring the time limit options).
PenteRules(int boardSize, int stonesInARowToWin, boolean capturesAllowed, int stonesCapturedToWin, boolean blackMustBeginInCenter, boolean blackMustAvoidCenterOnSecondMove, int requiredDistanceFromCenter, boolean hasTimeLimit, int softTimeLimitPerTurn, int allowedViolationsOfSoftLimit, int hardTimeLimitPerTurn)
          Constructs a new set of PenteRules.
 
Method Summary
 boolean blackMustAvoidCenterOnSecondMove()
          Is the first player required to place their second stone some distance away from the center position?
 boolean blackMustBeginInCenter()
          Is the first player required to begin by placing a stone in the center?
 boolean capturesAllowed()
          Are captures allowed?
 int getAllowedViolationsOfSoftLimit()
           
 int getBoardSize()
          Returns the size of the board (which is always square)
 int getHardTimeLimitPerTurn()
           
 int getRequiredDistanceFromCenter()
          If the away-from-center rule applies, how far away
 int getSoftTimeLimitPerTurn()
           
 int getStonesCapturedToWin()
          Returns how many captures are needed to win.
 int getStonesInARowToWin()
          Returns how many stones must be placed in a row to win.
 boolean isHasTimeLimit()
           
 java.lang.String toString()
           
 
Methods inherited from class edu.columbia.cs.coms4701.agent.environments.simple.SimpleEnvironmentObject
addPropertyChangeListener, isAlive, removePropertyChangeListener, setAlive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Standard

public static final PenteRules Standard
Standard rules:


Tournament

public static final PenteRules Tournament
Tournament rules: Standard rules, with a time limit.


Quick

public static final PenteRules Quick
Quick rules: Standard rules, with a short time limit.


StandardSmallBoard

public static final PenteRules StandardSmallBoard
Standard rules, but on a smaller 13x13 board:


MiniGame

public static final PenteRules MiniGame
The minigame:


Gomoku

public static final PenteRules Gomoku
Gomoku rules:


Freestyle

public static final PenteRules Freestyle
Freestyle rules:


CaptureOnly

public static final PenteRules CaptureOnly
Capture-only rules:

Constructor Detail

PenteRules

public PenteRules(int boardSize,
                  int stonesInARowToWin,
                  boolean capturesAllowed,
                  int stonesCapturedToWin,
                  boolean blackMustBeginInCenter,
                  boolean blackMustAvoidCenterOnSecondMove,
                  int requiredDistanceFromCenter)
Constructs a new set of PenteRules (ignoring the time limit options).

Parameters:
boardSize - size of the board
stonesInARowToWin -
capturesAllowed -
stonesCapturedToWin -
blackMustBeginInCenter -
blackMustAvoidCenterOnSecondMove -

PenteRules

public PenteRules(int boardSize,
                  int stonesInARowToWin,
                  boolean capturesAllowed,
                  int stonesCapturedToWin,
                  boolean blackMustBeginInCenter,
                  boolean blackMustAvoidCenterOnSecondMove,
                  int requiredDistanceFromCenter,
                  boolean hasTimeLimit,
                  int softTimeLimitPerTurn,
                  int allowedViolationsOfSoftLimit,
                  int hardTimeLimitPerTurn)
Constructs a new set of PenteRules. Use your imagination!

Parameters:
boardSize - size of the board
stonesInARowToWin -
capturesAllowed -
stonesCapturedToWin -
blackMustBeginInCenter -
blackMustAvoidCenterOnSecondMove -
hasTimeLimit - - whether this game has a time limit per turn
softTimeLimitPerTurn - - the suggested max time per turn, in seconds
allowedViolationsOfSoftLimit - - how many times an agent may go over the soft limit; above this, the agent will forfeit
hardTimeLimitPerTurn - - the absolute maximum time allowed per turn, in seconds. Any agent taking longer than this for a turn will forfeit
Method Detail

isHasTimeLimit

public boolean isHasTimeLimit()

getSoftTimeLimitPerTurn

public int getSoftTimeLimitPerTurn()

getAllowedViolationsOfSoftLimit

public int getAllowedViolationsOfSoftLimit()

getHardTimeLimitPerTurn

public int getHardTimeLimitPerTurn()

toString

public java.lang.String toString()
Overrides:
toString in class SimpleEnvironmentObject

capturesAllowed

public boolean capturesAllowed()
Are captures allowed?

If true, then the game may be won by obtaining 5 captured pairs.

Returns:
true if the rule applies

blackMustBeginInCenter

public boolean blackMustBeginInCenter()
Is the first player required to begin by placing a stone in the center?

Returns:
true if the rule applies

blackMustAvoidCenterOnSecondMove

public boolean blackMustAvoidCenterOnSecondMove()
Is the first player required to place their second stone some distance away from the center position?

Returns:
true if the rule applies

getRequiredDistanceFromCenter

public int getRequiredDistanceFromCenter()
If the away-from-center rule applies, how far away

Returns:
true if the rule applies

getStonesInARowToWin

public int getStonesInARowToWin()
Returns how many stones must be placed in a row to win. Ordinarily 5.

Returns:
number of stones to place in a row

getBoardSize

public int getBoardSize()
Returns the size of the board (which is always square)

Returns:
size of board

getStonesCapturedToWin

public int getStonesCapturedToWin()
Returns how many captures are needed to win. if capturesAllowed() is false, could be anything (e.g. zero)

Returns:
number of captures needed to win