de.uni_paderborn.robots.robot.group10
Class WrongFieldExchanger

java.lang.Object
  |
  +--de.uni_paderborn.robots.robot.group10.WrongFieldExchanger
All Implemented Interfaces:
RobotFunctions

public class WrongFieldExchanger
extends java.lang.Object
implements RobotFunctions

This robot is used for testing only.
Modification of LessStupid robot, uses ExchangeActionAction also if Field in front contains no card


Field Summary
private  RobotData latestRobotData
          stores latest robotData
private  int maxEnergy
          memorizes maxEnergy
private  java.util.Random random
          random number generator
private  int straightMoveCounter
          counts series of moves over empty fields without interruption
private  int turnNo
          turn counter
private  int wormwholeMoveCounter
          counts moves through wormwholes
 
Constructor Summary
WrongFieldExchanger()
          constructor
 
Method Summary
 boolean exchangeOk(CardData myCard, CardData otherCard)
          Robot accepts cards exchange, if new cards would be better.
 CardData exchangeProposal(CardData[] cards)
          Returns the card which absence costs fewest points, if the robot has any cards.
 AbstractRobotAction getCommand(RobotData robotData)
          Returns next command.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

random

private java.util.Random random
random number generator

maxEnergy

private int maxEnergy
memorizes maxEnergy

turnNo

private int turnNo
turn counter

wormwholeMoveCounter

private int wormwholeMoveCounter
counts moves through wormwholes

straightMoveCounter

private int straightMoveCounter
counts series of moves over empty fields without interruption

latestRobotData

private RobotData latestRobotData
stores latest robotData
Constructor Detail

WrongFieldExchanger

public WrongFieldExchanger()
constructor
Method Detail

getCommand

public AbstractRobotAction getCommand(RobotData robotData)
Returns next command. It is ensured that the robot does not run against any item! uses ExchangeActionAction also if Field in front contains no card
Specified by:
getCommand in interface RobotFunctions
Following copied from interface: de.uni_paderborn.robots.robotArenaInterface.RobotFunctions
Parameters:
robotData - current status of the robot
Returns:
a subclass of AbstractRobotAction which contains the robot's next command

exchangeProposal

public CardData exchangeProposal(CardData[] cards)
Returns the card which absence costs fewest points, if the robot has any cards.
Specified by:
exchangeProposal in interface RobotFunctions
Following copied from interface: de.uni_paderborn.robots.robotArenaInterface.RobotFunctions
Parameters:
cards - set of cards the robot owns
Returns:
a card a robot is willing to change

exchangeOk

public boolean exchangeOk(CardData myCard,
                          CardData otherCard)
Robot accepts cards exchange, if new cards would be better.
Specified by:
exchangeOk in interface RobotFunctions
Following copied from interface: de.uni_paderborn.robots.robotArenaInterface.RobotFunctions
Parameters:
myCard - card the robot wants to give away
otherCard - card the robot wants to have
Returns:
true if the robot is willing to change