You can move some code around in the Player to make it easier to specify individual points in a Player's logic. Consider something like:
public void step(){
if(decide()){
buyNewLootbox();
infoDump();
recordNewLootboxInHistory();
updateThreshold();
move(); // Does this happen only when a box is purchased? Or every step?
}
}
protected boolean decide(){
// Decision logic here; return true if decide to buy, false if not
}
protected Lootbox buyNewLootbox(){
// Create a new lootbox here; returning it is just a convenience/convention, not currently used
}
protected void recordNewLootboxInHistory(){
// Do that here
}
protected void updateThreshold(){
// This may not be in the correct place in my example... π
}
In this kind of form it's easier to specify the individual logic points and alternatives, like:
protected boolean decide(){
switch(DECISION_PARAMETER){
case SIMPLE: return true; // Always buy!
case COIN_FLIP: return coinFlip.nextInt() < buyThreshold
case default: return false; // Never- should never happen...
}
You can move some code around in the Player to make it easier to specify individual points in a Player's logic. Consider something like:
public void step(){ if(decide()){ buyNewLootbox();
infoDump(); recordNewLootboxInHistory(); updateThreshold(); move(); // Does this happen only when a box is purchased? Or every step? } }
protected boolean decide(){ // Decision logic here; return true if decide to buy, false if not }
protected Lootbox buyNewLootbox(){ // Create a new lootbox here; returning it is just a convenience/convention, not currently used }
protected void recordNewLootboxInHistory(){ // Do that here }
protected void updateThreshold(){ // This may not be in the correct place in my example... π }
In this kind of form it's easier to specify the individual logic points and alternatives, like:
protected boolean decide(){ switch(DECISION_PARAMETER){ case SIMPLE: return true; // Always buy! case COIN_FLIP: return coinFlip.nextInt() < buyThreshold case default: return false; // Never- should never happen... }