contents
Code:
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import PKGsystemClasses.APSay;
import PKGsystemClasses.AbsAlgPart;
import PKGsystemClasses.Algorithm;
import PKGsystemClasses.Neuron;
import PKGsystemClasses.Neuronable;
public class DSayer extends AbsCmdReq implements Neuronable {
private int times;
private String param;
public DSayer() {
super();
this.times = 1;
this.param = "";
}
public static String regexChecker(String theRegex, String str2Check) {
Pattern checkRegex = Pattern.compile(theRegex);
Matcher regexMatcher = checkRegex.matcher(str2Check);
while (regexMatcher.find()) {
if (regexMatcher.group().length() != 0) {
return regexMatcher.group().trim();
}
}
return "";
}
@Override
public void input(String command) {
int foo = 1;
String myString = regexChecker("(\\d+)(?= times)", command);
String toSay = regexChecker("(?<=say)(.*)(?=\\d)", command);
if (myString != "") {
foo = Integer.parseInt(myString);
} else {
toSay = regexChecker("(?<=say)(.*)", command);
}
this.param = toSay;
this.times = foo;
}
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
if (!param.isEmpty()) {
AbsAlgPart itte = new APSay(this.times, this.param);
String representation = "say " + param;
if (this.times > 1) {
representation += " " + this.times + " times";
}
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
algParts1.add(itte);
Algorithm algorithm = new Algorithm("say", representation, algParts1);
noiron.algParts.add(algorithm);
}
}
}
Code:
/* it speaks something x times
* a most basic skill.
* also fun to make the chobit say what you want
* */
public class APSay extends AbsAlgPart {
protected String param;
private int at;
public APSay(int at, String param) {
super();
if (at > 10) {
at = 10;
}
this.at = at;
this.param = param;
}
@Override
public String action(String input) {
// TODO Auto-generated method stub
String axnStr = "";
if (this.at > 0) {
if (!input.equalsIgnoreCase(param)) {
axnStr = param;
at--;
}
}
return axnStr;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return at < 1;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APSay(this.at, this.param);
}
@Override
public Boolean itemize() {
// TODO add logic
// at home
return true;
}
}
Code:
private String doIt2(String ear, String eye) {
// String axnStr = ""; //region 0
inOut(detective, ear);
inOut(dPermitter, ear);
inOut(dRules, ear);
inOut(dSpeller, ear);
inOut(dAlarmer, "");
if (dPermitter.getPermissionLevel() > 0) {
// works with friends region 1
inOut(dSayer, ear);
}
if (dPermitter.getPermissionLevel() > 1) {
// only works with owner region 2
inOut(dAlarmer, ear);
inOut(dDirtyTalker, ear);
}
fusion.setAlgQueue(noiron);
DCStrPair<String> result = new DCStrPair<String>();
result = fusion.act(ear);
this.emot = fusion.getEmot();
return itemFilter(result);
Code:
if (failureCounter > 1) {
cera.setActive(false);
}
Code:
public DCStrPair<String> autoEngage(String str1) {
// send image to grab + grab part
// or what happens at condition x
DCStrPair<String> result = new DCStrPair<>();
if (str1.contains(engageOn) && !engageOn.equals("")) {
result.key = FEEL; // when you see the item grab it.
result.value = toFeel;
return result;
}
result.key = this.itemKey;
result.value = str1;
return result;
}
Code:
public abstract class AbsAlgPart {
// one part of an algorithm, it is a basic simple action or sub goal
public abstract String action(String input); // return action string
public abstract Boolean itemize(); // equip with item ?
public abstract enumFail failure(String input); // failure type
public abstract Boolean completed(); // has finished ?
public abstract AbsAlgPart clone();
}
Code:
public abstract class AbsCmdReq implements Neuronable {
// handle the input per Dclass (a class whose name starts with D)
public abstract void input(String command);
}
Code:
import java.util.ArrayList;
// a step by step plan to achieve a goal
public class Algorithm implements Comparable<Algorithm> {
private String goal;
private String representation;
private ArrayList<AbsAlgPart> algParts = new ArrayList<>();
public Algorithm(String goal, String representation, ArrayList<AbsAlgPart> algParts) {
super();
this.goal = goal;
this.representation = representation;
this.algParts = algParts;
}
// *constract with string and goal
public String getGoal() {
return goal;
}
public String getRepresentation() {
return representation;
}
public ArrayList<AbsAlgPart> getAlgParts() {
return algParts;
}
public int getSize() {
return algParts.size();
}
public Algorithm clone() {
ArrayList<AbsAlgPart> parts = new ArrayList<>();
for (AbsAlgPart absAlgPart : this.algParts) {
parts.add(absAlgPart.clone());
}
return new Algorithm(this.goal, getRepresentation(), parts);
}
@Override
public int compareTo(Algorithm o) {
// TODO Auto-generated method stub
return 0;
}
}
Code:
/*
* megata kyoujin skill
* this beauty is an alarm skill
* it has the ability to go dormant and to get revived when needed
* by using triggers : eye ear or time.
*/
public class APCldAlarm extends AbsAlgPart {
private Cloudian cld;
private Boolean isComplete = false;
private enumFail enumfail = enumFail.ok;
private String zman = "";
public APCldAlarm(Cloudian cld, String zman) {
super();
this.cld = cld;
this.zman = zman;
this.cld.setActive(true);
cld.setMe(4, "ok", "zhakhrix", zman);
}
public APCldAlarm(Cloudian cld, String zman, Boolean b1) {
super();
this.cld = cld;
this.zman = zman;
}
@Override
public String action(String input) {
// TODO Auto-generated method stub
String result = "";
if (cld.getFin()) {
result = "bwahaha";
isComplete = true;
cld.reset();
}
else if (!cld.getDead()) {
switch (cld.getCountDown()) {
case 4:
result = "ok";
cld.sleep(0);
break;
case 3:
result = "wake up";
cld.sleep(2);
break;
case 2:
result = "come on wake up";
cld.sleep(2);
break;
case 1:
result = "please my darling do wake up";
cld.sleep(2);
break;
default:
result = "wake up I command you";
cld.sleep(2);
break;
}
//cld.sleep(2);
enumfail = enumfail.cloudian;
cld.setActive(false);
} else {
result = "it can not be helped";
isComplete = true;
cld.reset();
}
return result;
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return this.enumfail;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return this.isComplete;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APCldAlarm(this.cld, this.zman, null);
}
}
Code:
// a simple cuss action
public class APCuss extends AbsAlgPart {
private int doer = 1;
private String cuss, evil; // evil = the trigger of the anger
// as long as evil exists the cussing goes on.
private Boolean isComplete = false;
public APCuss(String cuss, String evil) {
super();
this.cuss = cuss;
this.evil = evil;
}
@Override
public String action(String input) {
String axnStr = "";
if (doer < 10) {
axnStr = evil;
doer++;
} else {
doer = 0;
}
if (doer == 0 && evil != input) {
isComplete = true;
}
return axnStr;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return this.isComplete;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APCuss(cuss, evil);
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
}
Code:
import java.util.Hashtable;
// dirty talk
public class APDirtyTalk extends AbsAlgPart {
private Hashtable<String, String> hashtable = new Hashtable<>(); // script for dirty talking
private String indexConvo = "start";
private String kowase = "ok next";
private Boolean isCompleted = false;
@Override
public String action(String input) {
// TODO Auto-generated method stub
String axnStr = "";
if (input.equals(kowase)) {
isCompleted = true;
} else if (hashtable.containsKey(input)) {
indexConvo = input;
axnStr = hashtable.get(indexConvo);
} else if (hashtable.containsKey(indexConvo)) {
indexConvo = hashtable.get(indexConvo);
axnStr = indexConvo;
} else {
isCompleted = true;
}
return axnStr;
}
public APDirtyTalk(Hashtable<String, String> hashtable) {
super();
this.hashtable = hashtable;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return isCompleted;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APDirtyTalk((Hashtable) this.hashtable.clone());
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
}
Code:
package PKGsystemClasses;
import java.util.ArrayList;
import java.util.Random;
public class APMoan extends AbsAlgPart {
// TODO : create active fuck counter parameter for this class :-)
// this class is responsible to trigger the right moan
private ArrayList<String> moans; // automatic moan :
/*
* such as : come on lets fuck please oh me so horney
*/
private ArrayList<String> interActiveMoans;
/*
* this will link to inter active convo like moans such as : fuck yeah feels
* good ahhhhh weeeeee all moans must be linked to actual audio
*/
private Boolean isCompleted = false; // the user has jizzed 8)
private PlayGround watch; // used to get seconds here
// I want a pause between moans so it looks like the app needs to breath
private boolean Acted;
private String todo = "";
public APMoan() {
// c'tor
super();
watch = new PlayGround();
Acted = false;
this.moans = new ArrayList<>();
this.interActiveMoans = new ArrayList<>();
moans.add("moan0");// example moans (more can be added)
moans.add("moan1");
moans.add("moan2");
interActiveMoans.add("IMoan1"); // inter active moans (doll was moved) or told something
interActiveMoans.add("IMoan2");
interActiveMoans.add("IMoan3");
moans.add("thank you"); // user jizzed (conclusion after fuck)
}
@Override
public String action(String input) {
// where the actual action takes place (the meat of this class)
// the sysout is a temporary methode stub
String axnStr = "";
if (input.equals("thank you") || this.interActiveMoans.contains(input)) {
this.todo = input;
}
int sec = watch.getSecondsAsInt(); // will be commented out
// axnStr = sec + "";
if (!this.Acted) {
// (time div (moan duration + extra tolerance time)) mod 2 == 0
if ((sec / 10) % 2 == 0) {
Acted = true;
if (this.equals("thank you")) {
playMoan("finish");
this.isCompleted = true;
this.todo = "";
return axnStr;
}
if (interActiveMoans.contains(this.todo)) {
playMoan(this.todo);
this.todo = "";
return axnStr;
}
Random rand = new Random();
int x = rand.nextInt(moans.size() - 1);
playMoan("moan num " + x);
// Acted = true;
}
} else {
this.Acted = false;
}
return axnStr;
}
private void playMoan(String input) {
// TODO Auto-generated method stub
// System.out.println(input);
}
@Override
public String failure(String input) {
// TODO Auto-generated method stub
return null;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return isCompleted;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APMoan();
}
}
Code:
import java.util.ArrayList;
import java.util.Random;
public class APMoan0 extends AbsAlgPart implements Mutatable {
protected Random rand = new Random();
protected final int failed = 3;
protected enumFail failure = enumFail.ok;
protected boolean isComplete = false;
protected ArrayList<String> interactions;
protected ArrayList<String> moans;
protected ArrayList<String> groans;
protected ArrayList<String> moanList;
protected int noInputCounter = 0;
public APMoan0() {
super();
moanList = new ArrayList<>();
moanList.add("1");
moanList.add("2");
interactions = new ArrayList<>();
moans = new ArrayList<>();
groans = new ArrayList<>();
}
@Override
public AbsAlgPart mutation() {
// TODO Auto-generated method stub
return null;
}
@Override
public String action(String input) {
if (!input.equals("")) {
noInputCounter = 0;
}
if (input.contains("thank you")) {
isComplete = true;
return "fuck you very much";
}
if (input.equals("")) {
noInputCounter++;
if (noInputCounter > failed) {
failure = enumFail.fail;
}
} //
else if (interactions.contains(input)) {
return moans.get(rand.nextInt(moans.size()));
}
return groans.get(rand.nextInt(groans.size()));
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return this.failure;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return isComplete;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return null;
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
}
Code:
public class APMoan1 extends APMoan0 {
public APMoan1() {
super();
interactions.add("do it");
moans.add("fuck");
moans.add("fuck yeah");
groans.add("i love you");
groans.add("sweet");
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APMoan1();
}
@Override
public AbsAlgPart mutation() {
// TODO Auto-generated method stub
APMoan0 mutant = new APMoan1();
int x = rand.nextInt(moanList.size() + 1);
switch (x) {
case 1:
mutant = new APMoan1();
break;
case 2:
mutant = new APMoan2();
break;
default:
break;
}
return (AbsAlgPart) mutant;
}
}
Code:
public class APMoan2 extends APMoan0 {
public APMoan2() {
super();
interactions.add("do it");
moans.add("lick it");
moans.add("harder");
groans.add("i heart you");
groans.add("dear");
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APMoan2();
}
@Override
public AbsAlgPart mutation() {
// TODO Auto-generated method stub
APMoan0 mutant = new APMoan1();
switch (rand.nextInt(moanList.size() - 1)) {
case 1:
mutant = new APMoan1();
break;
case 2:
mutant = new APMoan2();
break;
default:
break;
}
return mutant;
}
}
Code:
/* it speaks something x times
* a most basic skill.
* also fun to make the chobit say what you want
* */
public class APSay extends AbsAlgPart {
protected String param;
private int at;
public APSay(int at, String param) {
super();
if (at > 10) {
at = 10;
}
this.at = at;
this.param = param;
}
@Override
public String action(String input) {
// TODO Auto-generated method stub
String axnStr = "";
if (this.at > 0) {
if (!input.equalsIgnoreCase(param)) {
axnStr = param;
at--;
}
}
return axnStr;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return at < 1;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APSay(this.at, this.param);
}
@Override
public Boolean itemize() {
// TODO add logic
// at home
return true;
}
}
Code:
/* doesn't actually does anything
* she simply sleeps
* till she gets a wake string or the time to wake comes
* */
public class APSleep extends AbsAlgPart {
// waker = wake
private PlayGround playGround = new PlayGround();
private int wakeTime; // hour
public void setWakeTime(int wakeTime) {
this.wakeTime = wakeTime;
}
private Boolean isComplete = false;
public APSleep(int wakeTime) {
super();
this.wakeTime = wakeTime;
}
@Override
public String action(String input) {
// TODO Auto-generated method stub
String axnStr = "";
if (this.isComplete) {
return axnStr;
}
if ((wakeTime == playGround.getHoursAsInt()) || (input.contains("wake"))) {
isComplete = true;
axnStr = "waking";
return axnStr;
}
if (!input.isEmpty()) {
axnStr = "sleeping";
}
return axnStr;
}
public int getWakeTime() {
return wakeTime;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return this.isComplete;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APSleep(this.wakeTime);
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
}
Code:
/* activate the nemure action
* of the chobit class
* where the saving and loading of data against a data base should be
* */
public class APSleep0 extends AbsAlgPart {
private Boolean isComplete = false;
private Chobit.InnerClass actualSleep;
@Override
public String action(String input) {
String puke;
puke = this.actualSleep.nemure();
isComplete = true;
return puke;
}
public APSleep0(Chobit.InnerClass actualSleep) {
super();
this.actualSleep = actualSleep;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return isComplete;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APSleep0(this.actualSleep);
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
}
Code:
/* an easy way to add an action to any exact input
* */
public class APSpell extends AbsAlgPart {
PlayGround playGround = new PlayGround();
String[] morningGreet = { "good morning", "hi", "hadouken", "]" };
private String param = "";
private Boolean isCompleted = false;
public APSpell(String param) {
super();
this.param = param;
}
private String greet() {
String axnStr = "";
int random = (int) (Math.random() * 20);
if ((random < morningGreet.length - 1) && (random != 0)) {
axnStr = morningGreet[0] + " " + morningGreet[random];
String temp = morningGreet[0];
morningGreet[0] = morningGreet[random];
morningGreet[random] = temp;
} else {
axnStr = morningGreet[0];
}
return axnStr;
}
@Override
public String action(String input) {
String axnStr = "";
switch (this.param) {
case "what is the time":
axnStr = playGround.getCurrentTimeStamp();
break;
case "what is the date":
axnStr = playGround.getSpecificTime(enumTimes.DATE);
break;
case "what is the year":
axnStr = playGround.getSpecificTime(enumTimes.YEAR);
break;
case "current seconds":
axnStr = playGround.getSpecificTime(enumTimes.SECONDS);
break;
case "current minutes":
axnStr = playGround.getSpecificTime(enumTimes.MINUTES);
break;
case "current hour":
axnStr = playGround.getSpecificTime(enumTimes.HOUR);
break;
case "which day is it":
axnStr = playGround.getDayOfDWeek();
break;
case "greet":
axnStr = greet();
break;
default:
break;
}
isCompleted = true;
return axnStr;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return isCompleted;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APSpell(this.param);
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return false;
}
}
Code:
/*a temp skill not vital really
* it simply marks that an item has been equiped
* it is a copy paste of the APSay skill
* */
public class APSummonSkill extends AbsAlgPart {
protected String param;
private int at;
public APSummonSkill(int at, String param) {
super();
if (at > 10) {
at = 10;
}
this.at = at;
this.param = param;
}
@Override
public String action(String input) {
// TODO Auto-generated method stub
String axnStr = "";
if (this.at > 0) {
if (!input.equalsIgnoreCase(param)) {
axnStr = param;
at--;
}
}
return axnStr;
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return enumFail.ok;
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return at < 1;
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new APSay(this.at, this.param);
}
@Override
public Boolean itemize() {
// TODO add logic
// at home
return false;
}
}
Code:
/*becomes false for 5 minutes from the setBlock time
* */
public class BlockTime {
private int h = -1;
private int m = -1;
private int blockMinutes = 5;
public void setBlock(int hour, int minutes) {
this.m = minutes + blockMinutes;
this.h = hour;
if (m > 60) {
m -= 60;
h += 1;
if (h > 24) {
h -= 24;
}
}
}
public Boolean unBlock(int hour, int minutes) {
if (h == -1) {
return false;
}
if ((hour == this.h) && (minutes > this.m)) {
h = -1;
m = -1;
return false;
}
return true;
}
}
Code:
public class Cerabellum {
// runs an algorithm
private int fin;
private int at;
private enumFail failType;
private Boolean incrementAt = false;
public void advanceInAlg() {
if (incrementAt) {
incrementAt = false;
at++;
if (at == fin) {
isActive = false;
}
}
}
public int getAt() {
return at;
}
public Algorithm alg;
private boolean isActive = false;
private String emot = "";
public String getEmot() {
return emot;
}
public boolean setAlgorithm(Algorithm algorithm) {
if (!isActive && (algorithm.getAlgParts() != null)) {
this.alg = algorithm;
this.at = 0;
this.fin = algorithm.getSize();
this.isActive = true;
this.emot = alg.getAlgParts().get(at).getClass().getSimpleName(); // updated line
return false;
}
return true;
}
public boolean isActive() {
return isActive;
}
public boolean setActive(Boolean b1) {
return isActive = b1;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public String act(String input) {
String axnStr = "";
if (!isActive) {
return axnStr;
}
if (at < fin) {
axnStr = alg.getAlgParts().get(at).action(input);
this.emot = alg.getAlgParts().get(at).getClass().getSimpleName();
if (alg.getAlgParts().get(at).completed()) {
incrementAt = true;
// at++;
// if (at == fin) {
// isActive = false;
// }
}
}
return axnStr;
}
public enumFail getFailType() {
return alg.getAlgParts().get(at).failure("");
}
}
Code:
import java.util.Hashtable;
public class Chobit {
private String emot = ""; // emotion
// algorithms fusion (polymarization)
private Hashtable<String, Integer> AlgDurations = new Hashtable<>();
private Fusion fusion = new Fusion(AlgDurations);
//region DClasses
private Permission permission = Permission.newInstance("xxx", "chii", "liron");
private DPermitter dPermitter = new DPermitter(permission);
private Detective detective = new Detective(fusion);
private DSpeller dSpeller = new DSpeller();
private DSayer dSayer = new DSayer();
private DAlarmer dAlarmer = new DAlarmer();
private DDirtyTalker dDirtyTalker = new DDirtyTalker();
//endregion
private Neuron noiron;
// sleep vars :
private InnerClass inner;
private DRules dRules;
private DCFilter dcFilter = new DCFilter(); // used for the filter func
private Person activePerson = new Person();
private PrimoCera primoCera = new PrimoCera();
public Chobit() {
super();
noiron = new Neuron();
this.inner = new InnerClass(); // sleep var
dRules = new DRules(new APSleep(24), inner);
}
private String doIt2(String ear, String eye) {
// this is the main function
// works regardless of permissions
inOut(detective, ear);
inOut(dPermitter, ear);
inOut(dRules, ear);
inOut(dSpeller, ear);
inOut(dAlarmer, "");
if (dPermitter.getPermissionLevel() > 0) {
// works with friends
inOut(dSayer, ear);
}
if (dPermitter.getPermissionLevel() > 1) {
// only works with owner
inOut(dAlarmer, ear);
inOut(dDirtyTalker, ear);
}
fusion.setAlgQueue(noiron);
DCStrPair<String> result = new DCStrPair<String>();
result = fusion.act(ear);
this.emot = fusion.getEmot();
return itemFilter(result);
}
public String getEmot() {
// emot (emotion for display)
String x1 = emot;
switch (this.emot) {
case "APCuss ":
x1 = "angry";
break;
case "APDirtyTalk":
x1 = "grinny";
break;
case "APMoan":
x1 = "horny";
break;
case "APSay":
x1 = "speaking";
break;
case "APSleep0":
x1 = "dreaming";
break;
case "APSleep":
x1 = "asleep";
break;
case "APSpell":
x1 = "blank";
break;
default:
break;
}
emot = "";
return x1;
}
private String sleep() {
// data save load should go here and run while chobit is sleeping
return "haha I can sleep !";
}
private void inOut(AbsCmdReq dClass, String stuff) {
dClass.input(stuff); // new
dClass.output(noiron);
}
protected class InnerClass {
public String nemure() {
return sleep();
}
}
private String itemFilter(DCStrPair<String> pair) {
if (!pair.key.equals(dcFilter.prevKey)) {
// fold prev key(item) with switch case :
// tie bike, put phone in place...
// dcFilter.ignoreCounter = 3; // longer tick for longer action
}
// fold on key change;
String result = "";
// ter(item) cases
switch (pair.key) {
case "itemLess":
result = pair.value;
break;
case "nyaa":
if (!activePerson.getActive()) {
// send SMS if target guy is not actively available/responding
} else {
result = pair.value + " nyaa";
}
dcFilter.imutable = true; // constant action (no need to try other movements)
// * dcFilter.ignoreCounter = 3; // longer tick for longer action
default:
break;
}
return result;
}
public String doIt(String ear, String eye) {
if (dcFilter.danger.contains(ear) || dcFilter.danger.contains(eye)) {
return doIt2(ear, eye);
}
if (dcFilter.ignoreCounter > 0) {
dcFilter.ignoreCounter--;
} else if (dcFilter.imutable) {
return doIt2(ear, eye);
} else if (eye.contains(dcFilter.pair.toString())) {
primoCera.saveAction(dcFilter.pair.toString(), dcFilter.actioNum);
// savekeyvalnum (successful actual action chosen)
} else {
dcFilter.actioNum++;
if (dcFilter.actioNum > primoCera.getFinalActionCode()) {
dcFilter.actioNum = 0;
}
primoCera.saveAction(dcFilter.pair.toString(), dcFilter.actioNum);
// save key++,num
// the action did not result in the needed imidiate outcome, use a different
// action next time
}
return doIt2(ear, eye);
}
private String translateIn() {
return "";
}
private String translateOut() {
return "";
}
}
Code:
/*a trigger for reviving a dormant algorithm
* there should be a cloudian per APCld (alg part cloudian user)
* */
public class Cloudian {
private Boolean active = false;
private Algorithm algorithm = null;
private String timeTrig = ""; // time trigger
private String earTrig = "zhakhrixxer";
private String eyeTrig = "zhakhrixxer";
private int countDown = 0;
private Boolean dead = false;
public Boolean getDead() {
return dead;
}
private Boolean fin = false;
public Boolean getFin() {
return fin;
}
private PlayGround playGround = new PlayGround();
public Boolean updateStat(String ear, String eye) {
Boolean result = false;
if (ear.contains(earTrig) || eye.contains(eyeTrig)) {
fin = true;
result = true;
}
if (playGround.getCurrentTimeStamp().equals(this.timeTrig)) {
result = true;
}
result = result && !active;
if (result) {
active = true;
}
return result;
}
public int getCountDown() {
return countDown;
}
public void setCountDown(int countDown) {
this.countDown = countDown;
}
public void reset() {
active = false;
algorithm = null;
timeTrig = ""; // time trigger
earTrig = "zhakhrixxer";
eyeTrig = "zhakhrixxer";
countDown = 0;
dead = false;
fin = false;
}
public void setMe(int count, String ear, String eye, String setAlmTo) {
this.countDown = count;
this.earTrig = ear;
this.eyeTrig = eye;
this.timeTrig = setAlmTo;
}
public void sleep(int dormantFor) {
if (this.countDown > 0) {
this.countDown--;
} else {
this.dead = true;
}
// this.timeTrig = playGround.getFutureInXMin(dormantFor);
this.timeTrig = playGround.getFutureFromXInYMin(dormantFor, this.timeTrig);
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
public Algorithm getAlgorithm() {
return algorithm;
}
public void setAlgorithm(Algorithm algorithm) {
this.algorithm = algorithm;
}
public String getTimeTrig() {
return timeTrig;
}
public void setTimeTrig(String timeTrig) {
this.timeTrig = timeTrig;
}
public String getEarTrig() {
return earTrig;
}
public void setEarTrig(String earTrig) {
this.earTrig = earTrig;
}
public String getEyeTrig() {
return eyeTrig;
}
public void setEyeTrig(String eyeTrig) {
this.eyeTrig = eyeTrig;
}
}
Code:
import java.util.ArrayList;
/*creates algorithms with alg parts that can become dormant
* can wake a dormant algorithm
* should use notify if you add more cloudians to a wake one of many said algorithm
* */
public class DAlarmer extends AbsCmdReq implements Neuronable {
private RegexUtil regexUtil = new RegexUtil();
private String jikan = "";
private Cloudian cloudian = new Cloudian();
private String representation = "";
private Boolean summon = false;
private String ear = "";
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
if (summon) {
// AbsAlgPart itte = new APCldAlarm(cloudian, jikan);
AbsAlgPart itte = new APCldAlarm(cloudian, jikan);
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
algParts1.add(itte);
Algorithm algorithm = new Algorithm("alm", representation, algParts1);
this.cloudian.setAlgorithm(algorithm); // ***
noiron.algParts.add(algorithm);
reset();
return;
}
if (this.cloudian.updateStat(ear, "")) {
noiron.algParts.add(this.cloudian.getAlgorithm());
}
}
private void reset() {
representation = "";
summon = false;
}
@Override
public void input(String command) {
// TODO Auto-generated method stub
this.ear = command;
jikan = regexUtil.regexChecker("\\d+:\\d+", command);
if (command.contains("wake me at") && !jikan.isEmpty()) {
summon = true;
representation = command;
}
}
}
Code:
import java.util.HashSet;
// data class (DC). just a variable.
public class DCFilter {
public HashSet<String> danger = new HashSet<>();
public Boolean imutable = true;
public String prevKey = "";
public int ignoreCounter = 0;
public DCStrPair<String> pair = new DCStrPair<>();;
public int actioNum = 0;
public DCFilter() {
super();
this.pair.key = "";
this.pair.value = "";
}
}
Code:
// data class.
public class DCStrPair<T> {
public T key;
public T value;
@Override
public String toString() {
// TODO Auto-generated method stub
return (String) key + (String) value;
}
}
Code:
import java.util.ArrayList;
// generates an algorithm with dirty talking and then moaning too.
public class DDirtyTalker extends AbsCmdReq implements Neuronable {
private String choice = "";
ArrayList<String> choices = new ArrayList<>();
public DDirtyTalker() {
super();
choices.add("fuck");
}
private String param;
private RegexUtil regexUtil = new RegexUtil();
private ArrayList<AbsAlgPart> algParts;
private String represantation = "";
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
switch (choice) {
case "fuck":
APDirtyTalk apDirtyTalk = new APDirtyTalk(new MockDB().getHashtable());
APMoan1 moan = new APMoan1(); // default
algParts = new ArrayList<>();
algParts.add(apDirtyTalk);
algParts.add(moan);
represantation = "dirty talk fuck";
Algorithm algorithm = new Algorithm("fuck", represantation, algParts);
noiron.algParts.add(algorithm);
this.choice = "";
break;
default:
break;
}
}
@Override
public void input(String command) {
// TODO Auto-generated method stub
// regex here
String param = regexUtil.regexChecker("(?<=dirty talk)(.*)", command);
if (choices.contains(param)) {
choice = param;
}
}
}
Code:
import java.util.ArrayList;
/*handles dager type input :
* pain, repeated input, cussing, danger
* */
public class Detective extends AbsCmdReq implements Neuronable {
private String mimi, prevMimi; // ear input
private int cussCounter; // must be > cussing action
private String cry;
private String imBusy;
private String requestRepeated;
private ArrayList<String> cusses = new ArrayList<String>();
private Fusion fusion;
public Detective(Fusion fusion) {
super();
this.fusion = fusion;
this.mimi = "";
this.prevMimi = "";
this.imBusy = "chill";
this.requestRepeated = "fineeeeeeeeeeeeeeeeeeeeeee";
this.cry = "hadouken";
this.cussCounter = 0;
cusses.add("shit");
cusses.add("fuck");
cusses.add("jizz");
cusses.add("");
cusses.add(cry);
}
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
if (cussCounter > 3) {
cussCounter = 0;
noiron.negativeAlgParts.add(loadCuss());
return;
}
if (fusion.getReqOverload()) {
badReqConditions(this.imBusy, noiron);
return;
}
if (fusion.getRepReq()) {
badReqConditions(this.requestRepeated, noiron);
// System.out.println("again with this shit ? :");
}
}
@Override
public void input(String ear) {
// TODO Auto-generated method stub
this.mimi = ear;
if ((this.mimi.equals(this.prevMimi) || this.cusses.contains(this.mimi)) && !this.mimi.isEmpty()) {
// || this.cusses.contains(this.mimi) enables old cuss recognition without
// repetition
this.cussCounter++;
if (!cusses.contains(mimi)) {
cusses.set((int) (Math.random() * 3 + 1) - 1, mimi);
}
}
this.prevMimi = mimi;
}
private Algorithm loadCuss() {
APCuss apCuss = new APCuss(cry, cusses.get((int) (Math.random() * cusses.size() + 1) - 1));
ArrayList<AbsAlgPart> algParts = new ArrayList<>();
algParts.add(apCuss);
String represantation = "cuss"; // *match
Algorithm algorithm = new Algorithm("cuss", represantation, algParts);
return algorithm;
}
private Algorithm loadReplay(String replay) {
APSay apCuss = new APSay(1, replay);
ArrayList<AbsAlgPart> algParts = new ArrayList<>();
algParts.add(apCuss);
String represantation = "say " + replay; // *match
Algorithm algorithm = new Algorithm("say", represantation, algParts);
return algorithm;
}
private void badReqConditions(String replay, Neuron noiron) {
int actionX = (int) (Math.random() * 2 + 1) - 1;
switch (actionX) {
case 0:
noiron.negativeAlgParts.add(loadCuss());
break;
default:
noiron.negativeAlgParts.add(loadReplay(replay));
break;
}
}
}
Code:
//D class responsible for exploring :
// learning, mutating algorithms, requiping APs with objects or skill mods
// the sould resides here
public class DExplorer extends AbsCmdReq implements Neuronable {
private int failureCounter = 0;
private String prevAP = "";
public GameShark gameShark = new GameShark();
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
}
@Override
public void input(String command) {
// TODO Auto-generated method stub
}
public void mutate(Cerabellum cera, enumFail failure) {
String AP = cera.getEmot();
// group
AP = GroupAP(AP);
// give up ? :
if (prevAP.contains(AP) && !failure.toString().equals(enumFail.ok.toString())) {
failureCounter++;
switch (AP) {
case "APSay":
break;
case "APMoan":
if (failureCounter > 1) {
cera.setActive(false);
}
break;
default:
break;
}
}
else {
if (!prevAP.contains(AP)) {
failureCounter = 0;
}
}
prevAP = AP;
switch (failure) {
case fail:
Mutatable mutant = (Mutatable) cera.alg.getAlgParts().get(cera.getAt());
cera.alg.getAlgParts().set(cera.getAt(), mutant.mutation());
break;
case requip:
gameShark.outerMutate(AP);
break;
case cloudian:
cera.setActive(false);
break;
default:
break;
}
}
private String GroupAP(String aP) {
String result = "";
if (aP.contains("APMoan")) {
result = "APMoan";
}
return result;
}
public void requip(Cerabellum fusionCera, Cerabellum mainCera) {
for (AbsAlgPart algPart : mainCera.alg.getAlgParts()) {
if (algPart.itemize()) {
this.gameShark.addMcode(algPart.getClass().getSimpleName());
}
}
fusionCera.setAlgorithm(this.gameShark.requipAlg);
this.gameShark.setGameShark();
}
}
Code:
import java.util.ArrayList;
/* handles permissions using 2 names for the chobit :
* name one : permission lv1 (engages with friend)
* name 2 : permission level2 (for doing things with the owner only)
* */
public class DPermitter extends AbsCmdReq implements Neuronable {
/*
* conjuratis : change pass : oldPass new password newPassword change lv1 name :
* pass your name is newName change lv2 name : pass you are newName
*/
Permission permission;
private int permissionLevel = 2;
private int relevantCase = 0;
private RegexUtil regexer = new RegexUtil();
public DPermitter(Permission permission) {
super();
this.permission = permission;
}
@Override
public void output(Neuron noiron) {
switch (this.relevantCase) {
case 1:
requipSayAlg(noiron, permission.getLv1Name());
break;
case 2:
requipSayAlg(noiron, "got it");
break;
case 3:
requipSayAlg(noiron, "got it");
break;
case 4:
requipSayAlg(noiron, "got it");
break;
default:
break;
}
this.relevantCase = 0;
}
@Override
public void input(String command) {
permission.setPermissionLevel(command);
this.permissionLevel = this.permission.getPermissionLevel();
if (command.contains("what is your name")) {
this.relevantCase = 1;
return;
}
String password = regexer.regexChecker("(\\w+)(?= you are)", command);
String newName = regexer.regexChecker("(?<=you are)(.*)", command);
if (permission.setLv2Name(password, newName)) {
this.relevantCase = 2;
return;
}
;
password = regexer.regexChecker("(\\w+)(?= your name is)", command);
newName = regexer.regexChecker("(?<=your name is)(.*)", command);
if (permission.setLv1Name(password, newName)) {
this.relevantCase = 3;
return;
}
;
password = regexer.regexChecker("(\\w+)(?= new password)", command);
newName = regexer.regexChecker("(?<=new password)(.*)", command);
if (permission.setLv1Name(password, newName)) {
this.relevantCase = 4;
return;
}
;
}
public int getPermissionLevel() {
return permissionLevel;
}
private void requipSayAlg(Neuron noiron, String replay) {
AbsAlgPart itte = new APSay(1, replay);
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
algParts1.add(itte);
String represantation = "say " + replay;
Algorithm algorithm = new Algorithm("say", represantation, algParts1);
noiron.algParts.add(algorithm);
}
}
Code:
import java.util.ArrayList;
import java.util.Hashtable;
public class DRules extends AbsCmdReq implements Neuronable {
// sends a sleepgorithm out. triggered at sleep hour.
private AbsAlgPart apSleep;
private PlayGround playGround = new PlayGround();
private Hashtable<String, String> zettaiRules = new Hashtable<>();
private BlockTime blockTime = new BlockTime();
private String todo = "";
// private int sleepMinute = 0;
private Chobit.InnerClass actualSleep;
public DRules(APSleep apSleep, Chobit.InnerClass actualSleep) {
super();
this.apSleep = apSleep;
int sleepTime = apSleep.getWakeTime() - 2;
if (sleepTime > 24) {
sleepTime -= 24;
}
zettaiRules.put(sleepTime + ":00", "sleep");
this.actualSleep = actualSleep;
// can add 01 02 minutes
// this.sleepHour = sleepHour;
}
@Override
public void output(Neuron noiron) {
switch (todo) {
case "sleep":
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
APSleep0 apSleep0 = new APSleep0(actualSleep);
algParts1.add(apSleep0);
algParts1.add(this.apSleep);
Algorithm algorithm = new Algorithm("sleep", "going to sleep", algParts1);
noiron.algParts.add(algorithm);
break;
default:
break;
}
}
@Override
public void input(String command) {
// TODO Auto-generated method stub
int h = playGround.getHoursAsInt();
int m = playGround.getMinutesAsInt();
String strH = (h < 10) ? "0" + h : h + "";
String strM = (m < 10) ? "0" + m : m + "";
;
String Time = strH + ":" + strM;
// zettaiRules.put(Time, "sleep"); // for testing
Boolean boolean1 = zettaiRules.containsKey(Time);
if ((!blockTime.unBlock(h, m)) && boolean1) {
todo = zettaiRules.get(Time);
blockTime.setBlock(h, m);
}
}
}
Code:
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// very simple Dclass for creating a say something x times algorithm
public class DSayer extends AbsCmdReq implements Neuronable {
private int times;
private String param;
public DSayer() {
super();
this.times = 1;
this.param = "";
}
public static String regexChecker(String theRegex, String str2Check) {
Pattern checkRegex = Pattern.compile(theRegex);
Matcher regexMatcher = checkRegex.matcher(str2Check);
while (regexMatcher.find()) {
if (regexMatcher.group().length() != 0) {
return regexMatcher.group().trim();
}
}
return "";
}
@Override
public void input(String command) {
int foo = 1;
String myString = regexChecker("(\\d+)(?= times)", command);
String toSay = regexChecker("(?<=say)(.*)(?=\\d)", command);
if (myString != "") {
foo = Integer.parseInt(myString);
} else {
toSay = regexChecker("(?<=say)(.*)", command);
}
this.param = toSay;
this.times = foo;
}
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
if (!param.isEmpty()) {
AbsAlgPart itte = new APSay(this.times, this.param);
String representation = "say " + param;
if (this.times > 1) {
representation += " " + this.times + " times";
}
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
algParts1.add(itte);
Algorithm algorithm = new Algorithm("say", representation, algParts1);
noiron.algParts.add(algorithm);
}
}
}
Code:
import java.util.ArrayList;
public class DSpeller extends AbsCmdReq implements Neuronable {
private String param;
private Boolean active;
@Override
public void output(Neuron noiron) {
if (this.active) {
APSpell maho = new APSpell(this.param);
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
algParts1.add(maho);
Algorithm algorithm = new Algorithm("spell", this.param, algParts1);
noiron.algParts.add(algorithm);
}
}
@Override
public void input(String command) {
// TODO Auto-generated method stub
switch (command) {
case "what is the time":
case "what is the date":
case "what is the year":
case "current seconds":
case "current minutes":
case "current hour":
case "which day is it":
case "greet":
active = true;
this.param = command;
break;
default:
active = false;
break;
}
}
}
Code:
/* failure types
* ok : no fail
* requip : item should be added
* cloudian : algorithm goes to stand by in its Dclass
* fail : no input
* */
public enum enumFail {
fail, requip, dequip, cloudian, ok
}
Code:
public enum enumTimes {
DATE, DAY, YEAR, HOUR, MINUTES, SECONDS
}
Code:
public class Friends {
private String master = "";
private String[] friends = new String[10];
private int[] friendVal = new int[10];
private String[] goals = new String[10];
}
Code:
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.PriorityQueue;
public class Fusion {
/*
* fuses algorithms and sends needed algorithm to a designated cerabellum
* cobject for activation
*/
private Hashtable<String, Integer> AlgDurations;
private Hashtable<String, Integer> AlgDurations2 = new Hashtable<>();
private String emot = "";
private PriorityQueue<Algorithm> algQueue = new PriorityQueue<Algorithm>();
private PriorityQueue<Algorithm> dangerAlgQueue = new PriorityQueue<Algorithm>();
private Boolean reqOverload = false; // too many requests
private Boolean repReq = false; // chobit has already accepted this request
private HashSet<String> represantations = new HashSet<String>();
DExplorer dExplorer = new DExplorer();
// private Cerabellum mainCera = new Cerabellum();
// private Cerabellum dangerCera = new Cerabellum();
private String[] goalsToTrack = { "", "" }; // dangerCera, mainCera
private Cerabellum requipCera = new Cerabellum();
// cerabellums :
private Cerabellum dangerCera = new Cerabellum();
// requip cera
private FusionCera fusionCera;
private Cerabellum mainCera = new Cerabellum();
// home cera
Cerabellum[] cera = new Cerabellum[4];
// end cerabellums
public Fusion(Hashtable<String, Integer> algDurations) {
super();
AlgDurations = algDurations;
// fusionCera = (Cerabellum) (new FusionCera(algQueue));
fusionCera = new FusionCera(algQueue);
cera[0] = dangerCera;
cera[1] = requipCera; //requip
cera[2] = fusionCera;
cera[3] = mainCera;
// cera = { dangerCera, fusionCera, mainCera };
}
public void setAlgQueue(Neuron shinkei) {
for (Algorithm algorithm : shinkei.negativeAlgParts) {
if (this.dangerAlgQueue.size() < 1) {
this.dangerAlgQueue.add(algorithm.clone());
} else {
break;
}
}
this.repReq = false;
for (Algorithm algorithm : shinkei.algParts) {
updateRepresentations();
if (this.represantations.contains(algorithm.getRepresentation())) {
this.repReq = true;
// System.out.println("again with this shit ?");
continue;
}
if (this.algQueue.size() < 5) {
this.algQueue.add(algorithm.clone());
} else {
break;
}
}
this.reqOverload = this.algQueue.size() > 4 && shinkei.algParts.size() > 0;
// empty Neuron
shinkei.empty();
if (!dangerCera.isActive() && !dangerAlgQueue.isEmpty()) {
dangerCera.setAlgorithm(dangerAlgQueue.poll());
goalsToTrack[0] = dangerCera.alg.getGoal();
goalTrack(goalsToTrack[0]);
}
if (!mainCera.isActive() && !algQueue.isEmpty()) {
mainCera.setAlgorithm(algQueue.poll());
dExplorer.requip(requipCera, mainCera); // requip
goalsToTrack[1] = mainCera.alg.getGoal();
goalTrack(goalsToTrack[1]);
}
// fuse if, {fuse}
// goalsToTrack[0] = goalTrackReset(goalsToTrack[0]);
// goalsToTrack[1] = goalTrackReset(goalsToTrack[1]);
fuze();
}
public Boolean getRepReq() {
return repReq;
}
public Boolean getReqOverload() {
return reqOverload;
}
public DCStrPair<String> act(String input) {
DCStrPair<String> result = new DCStrPair<String>();
result.key = "itemLess";
result.value = "";
// String axnStr = "";
for (int i = 0; i < cera.length; i++) {
if (cera[i].isActive()) {
// dExplorer.mutate(null, cera[i],
// dExplorer.gameShark.pegasus.get(cera[i].getEmot()).summonMutation(input,
// cera[i].getFailType()));
result = dExplorer.gameShark.autoEngage(cera[i].getEmot(), cera[i].act(input));
dExplorer.mutate(cera[i],
dExplorer.gameShark.finalMutation(cera[i].getEmot(), input, cera[i].getFailType()));
cera[i].advanceInAlg();
this.emot = cera[i].getEmot();
if (i > 1) {
int n1 = AlgDurations2.get(cera[i].alg.getGoal());
AlgDurations2.put(cera[i].alg.getGoal(), n1 + 1);
}
break;
}
// else(cera notactive) try go home
}
return result;
}
public String getEmot() {
return emot;
}
private void updateRepresentations() {
this.represantations = new HashSet<String>();
for (Algorithm algorithm : this.algQueue) {
this.represantations.add(algorithm.getRepresentation());
}
}
private void goalTrack(String goal) {
if (!AlgDurations2.containsKey(goal)) {
// try to load, if failed :
AlgDurations.put(goal, 0);
AlgDurations2.put(goal, 0);
} else {
AlgDurations.put(goal, AlgDurations2.get(goal));
}
}
private String goalTrackReset(String goal) {
if (!goal.equals("")) {
AlgDurations2.put(goal, 0);
}
return "";
}
private void fuze() {
if (mainCera.isActive() && !fusionCera.isActive()) {
int algRunTime = AlgDurations.get(mainCera.alg.getGoal());
algRunTime = algRunTime / 2;
Algorithm alg1;
String g1 = "";
int time1 = 0;
Iterator<Algorithm> iterator = algQueue.iterator();
while (iterator.hasNext()) {
alg1 = iterator.next();
g1 = alg1.getGoal();
goalTrack(g1);
time1 = AlgDurations.get(g1);
if (time1 < algRunTime) {
fusionCera.setAlgorithm(alg1);
fusionCera.setAbort(time1);
goalTrackReset(g1);
break;
}
// System.out.println(iterator.next());
}
}
// TODO
// del those lines from setalgqueue
// and replace with this function.
// uncheck algQueue.remove(super.alg); at FusionCera
goalsToTrack[0] = goalTrackReset(goalsToTrack[0]);
goalsToTrack[1] = goalTrackReset(goalsToTrack[1]);
}
}
Code:
import java.util.PriorityQueue;
public class FusionCera extends Cerabellum {
private int abort;
private PriorityQueue<Algorithm> algQueue;
public FusionCera(PriorityQueue<Algorithm> algQueue) {
super();
this.abort = 0;
this.algQueue = algQueue;
}
public void setAbort(int abort) {
this.abort = abort + 1;
}
@Override
public String act(String input) {
// TODO Auto-generated method stub
String result = super.act(input);
abort--;
if (abort < 1) {
super.setActive(false);
} else {
if (!super.isActive()) {
algQueue.remove(super.alg);
}
}
return result;
}
}
Code:
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Set;
/* represents all possible requipable items
* activeSkills : type of item of item set for example :
* bicycle with chain lock of transport items
* */
public class GameShark {
public Hashtable<String, McodeSet> allSkills = new Hashtable<>();
public Hashtable<String, Mcode> activeSkills = new Hashtable<>();
public Algorithm requipAlg = new Algorithm("disabled","", null);
public Hashtable<String, TER> pegasus;
public GameShark() {
super();
createMCodeSet("APSay", createMCode(new TER("nyaa", "", ""), new APSummonSkill(1, "kuchiyouse no jutsu")));
addMCode("APSay", createMCode(new TER("buhi", "", ""), new APSummonSkill(1, "kuchiyouse no jutsu")));
}
public void setGameShark() {
pegasus = new Hashtable<>();
Set<String> keys = activeSkills.keySet();
for(String key: keys){
pegasus.put(key, activeSkills.get(key).ter);
}
if (pegasus.isEmpty()) {
}
reset();
}
public void addMcode(String AP) {
Boolean boolean1 = allSkills.containsKey(AP);
if (boolean1) {
activeSkills.put(AP, allSkills.get(AP).activeMcode);
if(requipAlg.getGoal().equals("disabled")) {requipAlg = allSkills.get(AP).activeMcode.algorithm;}
else{requipAlg.getAlgParts().addAll(allSkills.get(AP).activeMcode.algorithm.getAlgParts());}}
}
public Algorithm getRequipAlg() {
return requipAlg;
}
private void reset() {
activeSkills = new Hashtable<>();
requipAlg = new Algorithm("disabled","", null);
}
public DCStrPair<String> autoEngage(String AP, String input) {
DCStrPair<String> result = new DCStrPair<String>();
if (pegasus.containsKey(AP)) {
result = pegasus.get(AP).autoEngage(input);
} else {
result.key = "itemLess";
result.value = input;
}
return result;
}
public void outerMutate(String APCls) {
if (allSkills.containsKey(APCls)) {
if (!allSkills.get(APCls).skills.isEmpty()) {
allSkills.get(APCls).marker++;
if (allSkills.get(APCls).marker > allSkills.get(APCls).skills.size() - 1) {
allSkills.get(APCls).marker = 0;
}
int x = allSkills.get(APCls).marker;
allSkills.get(APCls).activeMcode = allSkills.get(APCls).skills.get(x);
}
}
}
public enumFail finalMutation(String AP, String input, enumFail fail1) {
enumFail result = fail1;
if (this.pegasus.containsKey(AP)) {
result = pegasus.get(AP).summonMutation(input, fail1);
}
return result;
}
private void createMCodeSet(String AP, Mcode activeMCode) {
McodeSet mcodeSet1 = new McodeSet();
mcodeSet1.skills.add(activeMCode);
mcodeSet1.activeMcode = activeMCode;
mcodeSet1.name = "APSay";
allSkills.put(mcodeSet1.name, mcodeSet1);
}
private Mcode createMCode(TER ter1, AbsAlgPart aPart) {
Mcode mcode1 = new Mcode();
mcode1.ter = ter1;
ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
algParts1.add(aPart);
mcode1.algorithm = new Algorithm(ter1.getItemKey(), ter1.getItemKey(), algParts1);
return mcode1;
}
private void addMCode(String AP, Mcode mCodeNxt) {
allSkills.get(AP).skills.add(mCodeNxt);
}
}
Code:
public class Mcode {
public int speed = 0;
public TER ter;
public Algorithm algorithm;
}
Code:
import java.util.ArrayList;
import java.util.Random;
public class McodeSet {
public String name;
public Mcode activeMcode;
public ArrayList<Mcode> skills = new ArrayList<>();
public int marker = 0;
public void mutateOuter() {
Random rand = new Random();
activeMcode = skills.get(rand.nextInt(skills.size()));
}
}
Code:
import java.util.ArrayList;
import java.util.Hashtable;
// script holder for the dirty talk AP
public class MockDB {
public Hashtable<String, String> hashtable;
public MockDB() {
super();
ArrayList<String> AR1 = new ArrayList<>();
AR1.add("start");
AR1.add("hi honey");
AR1.add("I love you");
AR1.add("oh honey your dick so beutiful");
AR1.add("would you like dinner a shower me ?");
AR1.add("oh fuck yeah");
AR1.add("please more honey");
AR1.add("thank you");
AR1.add("thank you so much");
AR1.add("me so happy");
AR1.add("me love you long time");
AR1.add("chupa chupa");
AR1.add("lick lick lick");
String at = "start";
this.hashtable = new Hashtable<>();
for (String string : AR1) {
hashtable.put(at, string);
at = string;
}
}
public Hashtable<String, String> getHashtable() {
return (Hashtable<String, String>) hashtable.clone();
}
}
Code:
public interface Mutatable {
public AbsAlgPart mutation();
}
Code:
import java.util.ArrayList;
// used to transport algorithms to other classes
public class Neuron {
public ArrayList<Algorithm> algParts = new ArrayList<>();
public ArrayList<Algorithm> negativeAlgParts = new ArrayList<>();
public void empty() {
this.algParts.clear();
this.negativeAlgParts.clear();
}
}
Code:
public interface Neuronable {
public void output(Neuron noiron);
}
Code:
import java.util.Hashtable;
/* resides outside of the chobit
* connects an action sent as output by the chobit(s primoCera) to robotics actions and such
* */
public class OuterCerabellum {
private Hashtable<String, String> numFilteredInputOutput = new Hashtable<>();
}
Code:
public class Permission {
/*
* uses two names as lv1,2 permission levels
* requires password to change password or said names
*/
private static Permission singleton;
private String password, lv1Name, lv2Name;
private int permissionLevel;
private Permission(String password, String lv1Name, String lv2Name) {
super();
this.password = password;
this.lv1Name = lv1Name;
this.lv2Name = lv2Name;
}
public static Permission newInstance(String password, String lv1Name, String lv2Name) {
if (singleton == null) {
singleton = new Permission(password, lv1Name, lv2Name);
}
return singleton;
}
public int getPermissionLevel() {
int result = this.permissionLevel;
this.permissionLevel = 0;
return result;
}
public void setPermissionLevel(String input) {
if (input.contains(this.lv2Name)) {
this.permissionLevel = 2;
} else if (input.contains(this.lv1Name)) {
this.permissionLevel = 1;
}
if (input.contains(this.lv2Name + " reset")) {
this.permissionLevel = 0;
}
}
public void setPassword(String oldPassword, String newPassword) {
if (this.password.equals(password)) {
this.password = newPassword;
}
}
public Boolean setLv2Name(String password, String newName2) {
if (this.password.equals(password)) {
this.lv2Name = newName2;
return true;
}
return false;
}
public String getLv1Name() {
return lv1Name;
}
public Boolean setLv1Name(String password, String newName) {
if (this.password.equals(password)) {
this.lv1Name = newName;
return true;
}
return false;
}
public static String clsmsg() {
return "chaos ritual\r\n" + "\r\n" + "create two names\r\n" + "one soul will be called to the light\r\n"
+ "and one will be led by the darkness\r\n"
+ "and those souls of light and darkness will combine to create\r\n" + "the light of chaos\r\n"
+ "...\r\n" + "A.G.I descended!";
}
}
Code:
public class Person {
private String name = "";
private Boolean active = true;
private String phone = "";
// email, location
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
Code:
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
// times and stuff
public class PlayGround {
// int foo = Integer.parseInt(myString);
public String getCurrentTimeStamp() {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate = new SimpleDateFormat("HH:mm");// dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return strDate;
}
public String getMinutes() {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate = new SimpleDateFormat("mm");// dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return strDate;
}
public String getSeconds() {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate = new SimpleDateFormat("ss");// dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return strDate;
}
public String getDayOfDWeek() {
Date now = new Date();
Calendar c = Calendar.getInstance();
c.setTime(now);
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
return convertToDay(dayOfWeek);
}
private String convertToDay(Integer d) {
String result = "";
switch (d) {
case 1:
result = "sunday";
break;
case 2:
result = "monday";
break;
case 3:
result = "tuesday";
break;
case 4:
result = "wednesday";
break;
case 5:
result = "thursday";
break;
case 6:
result = "friday";
break;
case 7:
result = "saturday";
break;
default:
break;
}
return result;
}
public String getSpecificTime(enumTimes timeType) {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate;
String format = "";
switch (timeType) {
case DATE:
format = "yyyy-MM-dd";
break;
case HOUR:
format = "HH";
break;
case SECONDS:
format = "ss";
break;
case MINUTES:
format = "mm";
break;
case YEAR:
format = "yyyy";
break;
default:
break;
}
sdfDate = new SimpleDateFormat(format);
Date now = new Date();
String strDate = sdfDate.format(now);
return strDate;
}
public int getSecondsAsInt() {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate = new SimpleDateFormat("ss");// dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return Integer.parseInt(strDate);
}
public int getMinutesAsInt() {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate = new SimpleDateFormat("mm");// dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return Integer.parseInt(strDate);
}
public int getHoursAsInt() {
// SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//
// dd/MM/yyyy
SimpleDateFormat sdfDate = new SimpleDateFormat("HH");// dd/MM/yyyy
Date now = new Date();
String strDate = sdfDate.format(now);
return Integer.parseInt(strDate);
}
public String getFutureInXMin(int x) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, x);
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
return df.format(cal.getTime());
}
public String getFutureFromXInYMin(int x, String y) {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
try {
cal.setTime(sdf.parse(y));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // all done
cal.add(Calendar.MINUTE, x);
return sdf.format(cal.getTime());
}
}
Code:
import java.util.Hashtable;
/* the actual action
* for example go left, jump right
* see outerCerabellum class for more detail
* */
public class PrimoCera {
private Hashtable<Integer, String> numAction = new Hashtable<>();
private Hashtable<String, Integer> keyvalNum = new Hashtable<>();
public void saveAction(String str, int num) {
keyvalNum.put(str, num);
}
public int getFinalActionCode() {
return numAction.size();
}
}
Code:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// returns expression of type theRegex from the string str2Check
public class RegexUtil {
public String regexChecker(String theRegex, String str2Check) {
Pattern checkRegex = Pattern.compile(theRegex);
Matcher regexMatcher = checkRegex.matcher(str2Check);
while (regexMatcher.find()) {
if (regexMatcher.group().length() != 0) {
return regexMatcher.group().trim();
}
}
return "";
}
}
Code:
import java.util.Arrays;
public class Soul {
private int[] goalVal = new int[3];
private String[] goals = new String[3];
public Soul() {
super();
Arrays.fill(goals, "");
Arrays.fill(goalVal, 0);
}
}
Code:
public class TER {
// thousand eyes restrict
// @ used with Hashtable<String, TER> pegasus = new Hashtable<>();
// handles a part of an item
private static final String FEEL = "#";
private String itemKey = "";
private String engageOn = "";// see item
private String toFeel = "";
public String getItemKey() {
return itemKey;
}
public TER(String itemKey, String engageOn, String toFeel) {
super();
this.itemKey = itemKey;
this.engageOn = engageOn;
this.toFeel = toFeel;
if (engageOn.isEmpty()) {
engageOn = "%&^**()!!@#$";
}
}
public DCStrPair<String> autoEngage(String str1) {
// send image to grab + grab part
// or what happens at condition x
DCStrPair<String> result = new DCStrPair<>();
if (str1.contains(engageOn) && !engageOn.equals("")) {
result.key = FEEL;
result.value = toFeel;
return result;
}
result.key = this.itemKey;
result.value = str1;
return result;
}
public enumFail summonMutation(String str1, enumFail eFail) {
// if no feel at needed area or no visual of Mcode
// return fail.mutation
if (!str1.contains(toFeel) && str1.contains(FEEL) && !str1.contains(engageOn)) {
return enumFail.requip;
} // *counter
return eFail;
}
}