Java:
public class SkillHubAlgDispenser {
private ArrayList<DiSkillV2> skills = new ArrayList<DiSkillV2>();
private int activeSkill = 0;
private Neuron tempN = new Neuron();;
private Random rand = new Random();
public SkillHubAlgDispenser(DiSkillV2...skillsParams) {
for (DiSkillV2 skill : skillsParams)
{
skills.add(skill);
}
}
public SkillHubAlgDispenser addSkill(DiSkillV2 skill){
// builder pattern
skills.add(skill);
return this;
}
public Algorithm dispenseAlgorithm(String ear, String skin, String eye){
// return value to outAlg param of (external) summoner DiskillV2
skills.get(activeSkill).input(ear,skin,eye);
skills.get(activeSkill).output(tempN);
for (int i = 1; i < 6; i++) {
Algorithm temp = tempN.getAlg(i);
if (temp != null){
return temp;
}
}
return null;
}
public void randomizeActiveSkill(){
activeSkill = rand.nextInt(skills.size());
}
public void setActiveSkillWithMood(int mood){
// mood integer represents active skill
// different mood = different behavior
if ((mood>-1) && mood < (skills.size())){
activeSkill = mood;
}
}
public void cycleActiveSkill(){
// changes active skill
// I recommend this method be triggered with a Learnability or SpiderSense object
activeSkill++;
if (activeSkill == skills.size()){
activeSkill = 0;
}
}
public int getSize(){return skills.size();}
}