org.vizzini.example.gin
Class Adjudicator

java.lang.Object
  extended by org.vizzini.game.AbstractAdjudicator
      extended by org.vizzini.example.gin.Adjudicator
All Implemented Interfaces:
IAdjudicator

public class Adjudicator
extends AbstractAdjudicator

Provides an adjudicator for Gin.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Field Summary
 
Fields inherited from class org.vizzini.game.AbstractAdjudicator
_winner
 
Constructor Summary
Adjudicator()
           
 
Method Summary
protected  int[] counts(Collection collection)
          Return a count of the cards in the given collection of card collections.
 boolean isActionLegal(IEnvironment environment, IAction action)
          Return true if the given action is legal in the given environment.
 boolean isGameOver(IEnvironment environment)
          Return true if one of the agents has won, or there are no more open positions.
protected  boolean isGin(IAgent agent, Collection kindsAndStraights)
          Return true if the given collection is a Gin.
 boolean isGoal(IEnvironment environment)
          Return true if one of the agents has won.
protected  void removeDuplicatesFromKinds(Collection kinds, Collection straights)
          Remove duplicate cards from the given kinds card collections.
protected  void removeDuplicatesFromStraights(Collection kinds, Collection straights)
          Remove duplicate cards from the given straights card collections.
 
Methods inherited from class org.vizzini.game.AbstractAdjudicator
areActionsLegal, getWinner, reset, setWinner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Adjudicator

public Adjudicator()
Method Detail

isActionLegal

public boolean isActionLegal(IEnvironment environment,
                             IAction action)
Return true if the given action is legal in the given environment.

Parameters:
environment - The environment of interest.
action - The action in question.
Returns:
true if the given action is legal in the given environment.
Since:
v0.1

isGameOver

public boolean isGameOver(IEnvironment environment)
Return true if one of the agents has won, or there are no more open positions.

Parameters:
environment - The environment of interest.
Since:
v0.1

isGoal

public boolean isGoal(IEnvironment environment)
Return true if one of the agents has won. If no one has won, return false.

Parameters:
environment - The environment of interest.
Since:
v0.1

counts

protected int[] counts(Collection collection)
Return a count of the cards in the given collection of card collections.

Since:
v0.1

isGin

protected boolean isGin(IAgent agent,
                        Collection kindsAndStraights)
Return true if the given collection is a Gin.

Since:
v0.1

removeDuplicatesFromKinds

protected void removeDuplicatesFromKinds(Collection kinds,
                                         Collection straights)
Remove duplicate cards from the given kinds card collections.

Since:
v0.1

removeDuplicatesFromStraights

protected void removeDuplicatesFromStraights(Collection kinds,
                                             Collection straights)
Remove duplicate cards from the given straights card collections.

Since:
v0.1


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02