org.eviline.randomizer
Class MaliciousRandomizer

java.lang.Object
  extended by org.eviline.randomizer.MaliciousRandomizer
All Implemented Interfaces:
Serializable, Randomizer
Direct Known Subclasses:
ThreadedMaliciousRandomizer

public class MaliciousRandomizer
extends Object
implements Randomizer, Serializable

Randomizer that looks a few moves ahead in the future to come up with the worst Shape to return.

Author:
robin
See Also:
Serialized Form

Nested Class Summary
static class MaliciousRandomizer.MaliciousRandomizerProperties
           
 
Field Summary
protected  MaliciousRandomizer.MaliciousRandomizerProperties config
           
protected  int distAdjustment
           
protected  List<ShapeType> history
           
static int HISTORY_SIZE
           
protected  Random random
           
protected  boolean randomFirst
           
protected  List<ShapeType> recent
           
protected  String taunt
           
protected  int[] typeCounts
           
 
Constructor Summary
MaliciousRandomizer(PropertySource p)
           
 
Method Summary
 PropertySource config()
           
protected  Decision decide(Field field, String taunt, int depth)
           
 int depth()
           
 int distribution()
           
 boolean fair()
           
 List<ShapeType> getNext()
           
 Random getRandom()
           
 String getTaunt()
           
 String name()
           
protected  void permuteDecision(Decision typeDecision)
           
 Shape provideShape(Field field)
          Return the Shape to be next played on the argument Field
 double rfactor()
           
 void setRandom(Random random)
           
protected  Decision worstFor(Field field, String taunt, int depth)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTORY_SIZE

public static final int HISTORY_SIZE
See Also:
Constant Field Values

config

protected MaliciousRandomizer.MaliciousRandomizerProperties config

randomFirst

protected boolean randomFirst

recent

protected List<ShapeType> recent

typeCounts

protected int[] typeCounts

history

protected List<ShapeType> history

distAdjustment

protected int distAdjustment

random

protected Random random

taunt

protected transient String taunt
Constructor Detail

MaliciousRandomizer

public MaliciousRandomizer(PropertySource p)
Method Detail

depth

public int depth()

rfactor

public double rfactor()

fair

public boolean fair()

distribution

public int distribution()

provideShape

public Shape provideShape(Field field)
Description copied from interface: Randomizer
Return the Shape to be next played on the argument Field

Specified by:
provideShape in interface Randomizer
Returns:

getTaunt

public String getTaunt()
Specified by:
getTaunt in interface Randomizer

getNext

public List<ShapeType> getNext()
Specified by:
getNext in interface Randomizer

decide

protected Decision decide(Field field,
                          String taunt,
                          int depth)

worstFor

protected Decision worstFor(Field field,
                            String taunt,
                            int depth)

permuteDecision

protected void permuteDecision(Decision typeDecision)

getRandom

public Random getRandom()

setRandom

public void setRandom(Random random)

config

public PropertySource config()
Specified by:
config in interface Randomizer

name

public String name()
Specified by:
name in interface Randomizer


Copyright © 2013. All Rights Reserved.