Java:
package chobit;
import java.util.ArrayList;
public class TheSkill extends DISkill {
protected RegexUtil regexUtil = new RegexUtil();
protected DISkillUtils diSkillUtil = new DISkillUtils();
protected PlayGround playGround = new PlayGround();
protected CloudianV2 cloudian = new CloudianV2();
private MCodes mCodes = new MCodes(); // items
private ReplikaMap replikaMap = new ReplikaMap();
private Person friend = new Person(); // if you deal with several friends handle it in the sub class
private Boolean friendUpdatable = false;
private ArrayList<String> items = new ArrayList<String>();
private String item = "";
private DefconTranslator defconTranslator = new DefconTranslator();
private int defcon = 0;
public TheSkill(Kokoro kokoro, ArrayList<String> items) {
super(kokoro);
this.items = items;
}
@Override
public void input(String ear, String skin, String eye) {
detectFriend(ear);
}
@Override
public void output(Neuron noiron) {
super.output(noiron);
}
private void trgAction(String ear, String skin, String eye) {
// sensory, souled, predicted
}
private void trgExplore(String ear, String skin, String eye) {
// timed
// Exploration and learning, Alg efficiancy tests and sort
}
private void trgPreserve(String ear, String skin, String eye) {
// timed
// items and persons preservation, causes being annoyed if repeated in day
}
protected Algorithm makeFriend() {
return diSkillUtil.verbatimGorithm(new APVerbatim("what is your name"));
}
protected void friendUpdate(String ear) {
String temp = regexUtil.phoneRegex1(ear);
if(!temp.isEmpty()) {friend.setPhone(temp);}
temp = regexUtil.emailRegex(ear);
if(!temp.isEmpty()) {friend.setEmail(temp);}
temp = regexUtil.afterWord("i am ", ear);
if (temp.isEmpty()) {
temp = regexUtil.afterWord("my name is ", ear);
}
if (!temp.isEmpty()) {
friend.setName(temp);
friend.setActive(true);
}
temp = regexUtil.duplicateRegex(ear);
if (!temp.isEmpty()) {
friend.setJutsu(temp);
friend.setActive(true);
}
}
// key stuff detection and handling
protected void detectFriend(String ear) {
if (playGround.getMinutesAsInt() % 2 == 0) {
friendUpdatable = false;
}
Boolean friendRequest = (ear.contains("friends") || ear.contains("my name is")) && !this.friend.getActive();
if (friendRequest) {
kokoro.toHeart.put("Me", "introduce");
}
if (ear.contains(friend.getName()) || (ear.contains(friend.getJutsu())) || friendRequest)// or friend visual
{
friendUpdatable = true;
}
if (friendUpdatable) {
friendUpdate(ear);
}
}
protected String currentItem(String ear, String skin, String eye) {
for (String item : items) {
if (eye.contains(item)) {
return item;
}
}
for (String item : items) {
if (skin.contains(item)) {
return item;
}
}
for (String item : items) {
if (ear.contains(item)) {
return item;
}
}
return "";
}
}
Java:
package chobit;
import java.util.Stack;
public class DefconTranslator {
private String input = "";
private Stack<String> inputStack = new Stack<String>();
public int getDefcon(String ear, String skin, String eye) {
// *reset defcon
inputStack.push(input);
if (inputStack.size() > 10) {
inputStack.pop();
}
return 0;
}
}