heurgame.event.turn
Class SecondChanceRRIterator

java.lang.Object
  extended byheurgame.event.turn.AbstractTurnIterator
      extended byheurgame.event.turn.AbstractTokenBasedIterator
          extended byheurgame.event.turn.RoundRobinIterator
              extended byheurgame.event.turn.SecondChanceRRIterator
All Implemented Interfaces:
TokenBased

public class SecondChanceRRIterator
extends RoundRobinIterator

Author:
David Kaplin In some games, like the Voronoi game the RoundRobinIterator will not lead to a fair environment. In this case to acheive fairness the round robin order is changed so that the owner of the second turn goes twice and looses their last turn. Thus keeping the number of movees the same and fairness. NOTE: This iterator is specifically designed for two players. Any more than two will lead to unfair consequences

Field Summary
 
Fields inherited from class heurgame.event.turn.RoundRobinIterator
currentRound, currentToken, latestTokens, playerHelper, playerTokens, rrLog, totalRounds
 
Fields inherited from class heurgame.event.turn.AbstractTurnIterator
mylisteners
 
Constructor Summary
SecondChanceRRIterator()
           
 
Method Summary
 boolean hasMore()
           
 void next()
          Shifts state to the next turn, and broadcasts the turnChanged Event
 void setup(int numRounds, java.util.Vector players)
          Sets or Resets the state of the Iterator
 
Methods inherited from class heurgame.event.turn.RoundRobinIterator
getCurrentToken, logState, updateActiveTokens
 
Methods inherited from class heurgame.event.turn.AbstractTurnIterator
addTurnListener, notifyTurnListeners, removeAllTurnListeners, removeTurnListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondChanceRRIterator

public SecondChanceRRIterator()
Method Detail

setup

public void setup(int numRounds,
                  java.util.Vector players)
Description copied from class: RoundRobinIterator
Sets or Resets the state of the Iterator

Specified by:
setup in interface TokenBased
Overrides:
setup in class RoundRobinIterator
Parameters:
numRounds - Positive integer
players - A Vector of Player Tokens in the desired order

next

public void next()
Description copied from class: RoundRobinIterator
Shifts state to the next turn, and broadcasts the turnChanged Event

Overrides:
next in class RoundRobinIterator
See Also:
AbstractTurnIterator.next()

hasMore

public boolean hasMore()
Overrides:
hasMore in class RoundRobinIterator
Returns:
True while the current round is less than or equal to the total. If the game has 10 rounds the number of the last round will be 10. This iterator will be exhausted after the first turn of the 10th round, giving the first player his last chance.
See Also:
AbstractTurnIterator.hasMore()