this type of skill require the mendatory classes to exist in the project:
1 Bijuu : a container for a list of DISkills
2 Chi : an adaptor for AP classes which enables it to use the soul class
3 DISkill : a skill to be contained by a Bijuu class and generate conscious algorithms
(of Chi parts).
4 kokoro : the AGIs soul, all data passes through it and it can do stuff as written in its
class comments.
Bijuu
Chi :
DISkill
Kokoro :
and the new upgraded Chobit class, with the kokoro field added :
and also the Person class added to the Chobit class :
:alrt:
Last edited by Moti Barski on Wed Oct 09, 2019 10:24 pm; edited 2 times in total
1 Bijuu : a container for a list of DISkills
2 Chi : an adaptor for AP classes which enables it to use the soul class
3 DISkill : a skill to be contained by a Bijuu class and generate conscious algorithms
(of Chi parts).
4 kokoro : the AGIs soul, all data passes through it and it can do stuff as written in its
class comments.
Bijuu
Code:
package chobit;
import java.util.ArrayList;
public class Bijuu extends AbsCmdReq {
/*
* a container cls for a list of DIskills
*/
protected ArrayList<DISkill> dSkills = new ArrayList<>();
private Kokoro kokoro;
final int constTolerance = 3;
private int tolerance = constTolerance;
private Boolean enabled = true;
private Boolean fastBreak = true;
protected Person person;
public Bijuu(Person master, Kokoro kokoro, DISkill... skills) {
super();
this.kokoro = kokoro;
this.person = person;
for (DISkill i : skills) {
dSkills.add(i);
}
}
public void modeFlip() {
// pain = *repetition/ actual high level pain
// sets weather the Bijuu is active or not
tolerance -= kokoro.getPain(this.getClass().getSimpleName());
if (tolerance < 1) {
this.enabled = !this.enabled;
}
}
@Override
public void input(String ear, String skin, String eye) {
if (enabled) {
// if Bijuu enabled
for (DISkill dISkill : dSkills) {
dISkill.input(ear, skin, eye);
if (dISkill.getSentAlg()) {
/*
* found an alg ! exit the loop ! I dont need another alg !!
*/
dISkill.setOutput(true);
// hey, DIskill, remind me you have an alg waiting for pickup
fastBreak = false;
// dont skip alg pick up stage.
break;
}
}
}
else {
reenable(ear, skin, eye); // maybe I should be revived
}
}
@Override
public void output(Neuron noiron) {
// TODO Auto-generated method stub
if (!fastBreak) {
// if alg waiting for pick up
fastBreak = true; // reset
for (DISkill dISkill : dSkills) {
if (dISkill.getOutput()) {
// found the alg
dISkill.output(noiron);
// OK done, bye
break;
}
}
}
}
public void reenable(String ear, String skin, String eye) {
if (ear.contains("pain") || skin.contains("pain")) {
tolerance -= 1;
if (tolerance < 1) {
this.enabled = true;
}
}
}
}
Chi :
Code:
package com.yotamarker.lgkotlin1;
public class Chi extends AbsAlgPart {
/*
* an adaptor pattern to the alg part, it also has the kokoro consiousness
* object to be aware throughout the program of what is happening all action
* data goes through this soul.
*/
public Kokoro kokoro;
public String ofSkill;
public AbsAlgPart aPart;
public Chi(Kokoro kokoro, String ofSkill, AbsAlgPart aPart) {
super();
this.kokoro = kokoro;
this.ofSkill = ofSkill;
this.aPart = aPart;
}
public String actualAction(String ear, String skin, String eye) {
return aPart.action(ear, skin, eye);
}
@Override
public String action(String ear, String skin, String eye) {
kokoro.in(this);
String result = actualAction(ear, skin, eye);
kokoro.out(completed(), failure(""));
return result;
}
@Override
public Boolean itemize() {
// TODO Auto-generated method stub
return aPart.itemize();
}
@Override
public enumFail failure(String input) {
// TODO Auto-generated method stub
return aPart.failure(input);
}
@Override
public Boolean completed() {
// TODO Auto-generated method stub
return aPart.completed();
}
@Override
public AbsAlgPart clone() {
// TODO Auto-generated method stub
return new Chi(kokoro, this.ofSkill, aPart.clone());
}
}
DISkill
Code:
package chobit;
public class DISkill extends AbsCmdReq {
protected Boolean sentAlg = false; // accessed by sub cls
private Boolean output = false; // accessed by the DISkill container a Bijuu cls
// String ofSkill;
protected Kokoro kokoro; // accessed by sub cls
public void setSentAlg(Boolean sentAlg) {
this.sentAlg = sentAlg;
}
// in sub cls : person ?
public DISkill(Kokoro kokoro) {
super();
// this.ofSkill = ofSkill;
this.kokoro = kokoro;
}
@Override
public void output(Neuron noiron) {
// set sentAlg = true if an alg is to be sent
}
@Override
public void input(String ear, String skin, String eye) {
// TODO Auto-generated method stub
}
public Boolean getOutput() {
Boolean result = this.output;
this.output = false;
return result;
}
public void setOutput(Boolean output) {
this.output = output;
}
public Boolean getSentAlg() {
Boolean result = this.sentAlg;
this.sentAlg = false;
return result;
}
}
Kokoro :
Code:
package chobit;
import java.util.Hashtable;
/* all action data goes through here
* detects negatives such as : repetition, pain on various levels and failures
* serves as a database for memories, convos and alg generations
* can trigger revenge algs
* checks for % of difference in input for exploration type algs
* */
public class Kokoro {
Hashtable<String, Integer> pain = new Hashtable<>();
public int getPain(String BijuuName) {
return pain.getOrDefault(BijuuName, 0);
}
public void in(Chi chi) {
}
public void out(Boolean isCompleted, enumFail failure) {
}
}
and the new upgraded Chobit class, with the kokoro field added :
Code:
package chobit;
import java.util.ArrayList;
import java.util.Hashtable;
public class Chobit {
protected String emot = ""; // emotion
protected ArrayList<AbsCmdReq> dClassesLv1 = new ArrayList<>();
protected ArrayList<AbsCmdReq> dClassesLv2 = new ArrayList<>();
protected ArrayList<AbsCmdReq> dClassesLv3 = new ArrayList<>();
// algorithms fusion (polymarization)
protected Hashtable<String, Integer> AlgDurations = new Hashtable<>();
protected Fusion fusion = new Fusion(AlgDurations);
// region essential DClasses
protected Permission permission = Permission.newInstance("xxx", "chii", "liron");
protected DPermitter dPermitter = new DPermitter(permission);
// endregion
protected Neuron noiron;
// sleep vars :
protected InnerClass inner;
protected Person activePerson = new Person();
protected PrimoCera primoCera = new PrimoCera();
// added :
protected Kokoro kokoro = new Kokoro(); // soul
protected Person master = new Person();
public Chobit() {
super();
noiron = new Neuron();
this.inner = new InnerClass(); // sleep var
DAlarmer dAlarmer = new DAlarmer();
// add a skill here, only 1 line needed !!!
dClassesLv1.add(new Detective(fusion));
dClassesLv1.add(new DJirachi());
dClassesLv1.add(new DHungry());
dClassesLv1.add(dPermitter);
dClassesLv1.add(new DRules((new APSleep(24)), inner));
dClassesLv1.add(new DSpeller());
dClassesLv1.add(new DCalculatorV1());
dClassesLv1.add(dAlarmer);
dClassesLv2.add(new DSayer());
dClassesLv3.add(dAlarmer);
dClassesLv3.add(new DDirtyTalker());
// dClassesLv3.add(new DIMommyGf(kokoro, this.master));
dClassesLv3.add(new DIJirachi(master, kokoro));
}
public String doIt(String ear, String skin, String eye) {
for (AbsCmdReq dCls : dClassesLv1) {
inOut(dCls, ear, skin, eye);
}
if (dPermitter.getPermissionLevel() > 0) {
// works with friends
for (AbsCmdReq dCls : dClassesLv2) {
inOut(dCls, ear, skin, eye);
}
}
if (dPermitter.getPermissionLevel() > 1) {
// only works with owner
for (AbsCmdReq dCls : dClassesLv3) {
inOut(dCls, ear, skin, eye);
}
}
fusion.setAlgQueue(noiron);
return fusion.act(ear, skin, eye);
}
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;
}
protected String sleep() {
// data save load should go here and run while chobit is sleeping
return "haha I can sleep !";
}
protected void inOut(AbsCmdReq dClass, String ear, String skin, String eye) {
dClass.input(ear, skin, eye); // new
dClass.output(noiron);
}
protected class InnerClass {
public String nemure() {
return sleep();
}
}
protected String translateIn() {
return "";
}
protected String translateOut() {
return "";
}
}
and also the Person class added to the Chobit class :
Code:
package chobit;
public class Person {
private String name = "";
private Boolean active = true;
private String phone = "";
private String skill = "";
private String profession = "";
private String jutsu = "";
// location
private String email = "";
private String id = "";
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;
}
public String getSkill() {
return skill;
}
public void setSkill(String skill) {
this.skill = skill;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
public String getJutsu() {
return jutsu;
}
public void setJutsu(String jutsu) {
this.jutsu = jutsu;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
:alrt:
Last edited by Moti Barski on Wed Oct 09, 2019 10:24 pm; edited 2 times in total