battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

the LivinGrimoire Artificial General Intelligence software design pattern forum

descriptionDISkill : consciousness equiped skills examplified with the user imprint skill EmptyDISkill : consciousness equiped skills examplified with the user imprint skill

more_horiz
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

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

descriptionDISkill : consciousness equiped skills examplified with the user imprint skill EmptyDIJirachi

more_horiz
this classes names start with DI

the action part : APImprintMaster :

Code:

package com.yotamarker.lgkotlin1;

import java.util.ArrayList;

public class APImprintMaster extends AbsAlgPart {
   // todo : handle inputs regexes
   /*
    * asks master for vital info, to fill in master object fields like name and
    * phone number
    */
   private ArrayList<String> form = new ArrayList<>();
   private int mode = 0;
   private int index = 0;
   private String input = "";
   private Boolean isCompleted = false;
   private String curResult = "";
   private Person master;

   public APImprintMaster(Person master) {
      // default c'tor
      super();
      form.add("ntmyawwynb");
      form.add("are you my master");
      form.add("I will input your name");
      form.add("what is your skill");
      form.add("what is your profession");
      form.add("what is your phone number");
      form.add("what is your email address");
      form.add("which is your favorite jutsu");
      form.add("soul spark engaged");
      this.master = master;
   }

   public APImprintMaster(Person master, String... strs) {
      // alternative c'tor
      for (String i : strs) {
         form.add(i);
      }
      this.master = master;
   }

   @Override
   public String action(String ear, String skin, String eye) {
      String result = "";
      switch (mode) {
      case 0:
         result = form.get(index);
         curResult = result;
         if (result.contains("what") || result.contains("which is") || result.contains("ntmyawwynb") || result.contains("please")
               || result.contains("are you")) {
            mode = 2;
            if (form.get(index).contains("are you")) {
               mode = 4;
            }
         }
         else {
            index++;
         }
         break;
      case 2:
         if (!ear.isEmpty() && !form.contains(ear)) {
            mode = 3;
            input = ear;
         }

         break;
      case 3:
         result = input + " yes";
         mode = 4;
         break;
      case 4:
         if (ear.contains("yes")) {
            mode = 0;
            imprint();
            index++;
         }
         if (ear.contains("no")) {
            mode = 0;
         }
         break;
      default:
         break;
      }
      if (index == form.size()) {
         isCompleted = true;
         index--;
      }
      return result;
   }

   public void imprint() {
      switch (curResult) {
      case "nice to meet you, and what would your name be":
         master.setName(input);
         break;
      case "what is your skill":
         master.setSkill(input);
         break;
      case "what is your profession":
         master.setProfession(input);
         break;
      case "what is your phone number":
         master.setPhone(input);
         break;
      case "what is your email address":
         master.setEmail(input);
         break;
      case "which is your favorite jutsu":
         master.setJutsu(input);
         break;
      default:
         break;
      }
   }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return false;
   }

   @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() {
      // ***might glich, clone person ?
      return new APImprintMaster(this.master);
   }

}


DIMommyGF class extends DISkill:

Code:

package chobit;

import java.util.ArrayList;

public class DIMommyGf extends DISkill {
   public Person master;
   private Boolean exeAlg;

   public DIMommyGf(Kokoro kokoro, Person owner) {
      super(kokoro);
      this.master = owner;
      // TODO Auto-generated constructor stub
   }

   @Override
   public void input(String ear, String skin, String eye) {
      if (ear.contains("imprint master")) {
         this.exeAlg = true;
         this.setSentAlg(true);
      }
   }

   @Override
   public void output(Neuron noiron) {
      // TODO Auto-generated method stub

      if (this.exeAlg) {
         AbsAlgPart itte = new Chi(this.kokoro, this.getClass().getSimpleName(), new APImprintMaster(this.master));
         String representation = "imprintmaster";
         ArrayList<AbsAlgPart> algParts1 = new ArrayList<>();
         algParts1.add(itte);
         Algorithm algorithm = new Algorithm("imprintmaster", representation, algParts1);
         noiron.algParts.add(algorithm);
         exeAlg = false;
      }
   }
}


DIJirachi class :

Code:

package chobit;

public class DIJirachi extends Bijuu {
   // a set of skills to make the user happy and grant his wishes
   public DIJirachi(Person master, Kokoro kokoro) {
      super(master, kokoro, new DIMommyGf(kokoro, master));

   }

}


:joker:

descriptionDISkill : consciousness equiped skills examplified with the user imprint skill Emptydemonstration and explanation videos

more_horiz


explanation

https://www.youtube.com/watch?v=ekI_KLenIKc&t=5m39s

origin :

https://www.youtube.com/watch?v=MKcnnDCsmI0&t=9m58s

descriptionDISkill : consciousness equiped skills examplified with the user imprint skill EmptyDISkill UML diagram

more_horiz
https://www.yotamarker.com/t232-uml-of-a-diskill-a-soul-skill-with-consciousness#649

DIJirachi is the actual skill here and it is added in the Chobit class constructor
(using one code line) 🤡 :joker:
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply