com.mebigfatguy.polycasso
Class ImprovementTypeStats

java.lang.Object
  extended by com.mebigfatguy.polycasso.ImprovementTypeStats

public class ImprovementTypeStats
extends java.lang.Object

a class to keep track of success statistics by improvement type, in order to further tune what improvement types to try in the future. It modifies a purely random selection criteria to one that is tuned by performance.


Constructor Summary
ImprovementTypeStats()
          creates an initial state of statistics
 
Method Summary
 ImprovementType getRandomImprovementType()
          returns a random improvement type that is influenced by how successful the types have been in the past.
 java.lang.String toString()
          builds a string of all the different types success statistics
 void typeWasSuccessful(ImprovementType type, boolean successful)
          increment a type's statistics whether success or fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImprovementTypeStats

public ImprovementTypeStats()
creates an initial state of statistics

Method Detail

typeWasSuccessful

public void typeWasSuccessful(ImprovementType type,
                              boolean successful)
increment a type's statistics whether success or fail

Parameters:
type - the improvement type that is to be updated
successful - if the improvement was successful

getRandomImprovementType

public ImprovementType getRandomImprovementType()
returns a random improvement type that is influenced by how successful the types have been in the past.

Returns:
the improvement type to try

toString

public java.lang.String toString()
builds a string of all the different types success statistics

Overrides:
toString in class java.lang.Object
Returns:
a statistics string


Copyright © 2009-2010 MeBigFatGuy.com. All Rights Reserved.