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

gen3 skill team work technodrum mode

power_settings_newLogin to reply
3 posters

descriptiongen3 skill team work technodrum mode Emptygen3 skill team work technodrum mode

more_horiz
@kurosen
hadouken

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz


here we go

defcon
input
otheroutput{ //skill default
trg input,timer, prophesy}
souloutput

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
{defcon, soulInput} : if null alg return;
other{} if null alg return;//*3 + 1
souloutput{}

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
also need to reset the alg to null at the start of the input stage

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
kurosen wrote:
also need to reset the alg to null at the start of the input stage

yeah, I see it

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz

Code:

package chobit;

import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Queue;

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 = "";
   protected AbsDefConTranslator absDefConTranslator;
   private int defcon = 0;
   protected Algorithm outputAlg = null;
   protected Queue<String> soulOutput = new PriorityQueue<>();
   private int soulHP = 2;
   private Boolean replenishSoulHp = true;

   public TheSkill(Kokoro kokoro, AbsDefConTranslator absDefConTranslator, ArrayList<String> items) {
      super(kokoro);
      this.items = items;
      this.absDefConTranslator = absDefConTranslator;
   }

   @Override
   public void input(String ear, String skin, String eye) {
      detectFriend(ear);
   }

   @Override
   public void output(Neuron noiron) {
      if (!isNull(this.outputAlg)) {
         noiron.algParts.add(this.outputAlg);
         this.outputAlg = null;
      }
      // after this, if there is no reference to the object,
      // it will be deleted by the garbage collector
   }

   private boolean isNull(Object obj) {
      return obj == null;
   }

   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 "";
   }

   public static String strContains(String str1, String... a) {
      for (String temp : a) {
         if (str1.contains(temp)) {
            return temp;
         }
      }
      return "";
   }

   protected void inputToSoul(String ear, String skin, String eye) {
      String sensory = ear;
      if (sensory.isEmpty()) {
         sensory = skin;
      }
      if (sensory.isEmpty()) {
         sensory = eye;
      }
      if (!this.item.isEmpty()) {
         this.replikaMap.input(item, defcon, sensory);
      }
   }

   protected String soulOutput(String ear) // ear or time
   {
      if (ear.contains("yes")) {
         soulHP++;
      }
      if (this.soulOutput.isEmpty()) {
         return "";
      }
      if (ear.contains("how")) {
      }
      String question = strContains(ear, "who", "what", "when", "where", "why", "which");
      if (!question.isEmpty()) {
      }
      if (ear.contains("example")) {
         // /JOI example||detail, default for dirty skills
      }
      if (ear.contains("sleep")) {
      }
      if (ear.contains("story")) {
         // time trg
      }
      // default : imprint fresh memories, check not in friend memory.
      if (!this.soulOutput.isEmpty()) {
         soulHP--;
      }
      replenishSoulHP();
      return "";
   }

   private void replenishSoulHP() {
      int tempMinute = playGround.getMinutesAsInt();
      if (tempMinute != 1) {
         replenishSoulHp = true;
         return;
      }
      if ((tempMinute == 1) && replenishSoulHp) {
         soulHP = 2;
         replenishSoulHp = false;
      }
   }

   protected Algorithm mainOutput() {
      // overridde me
      return null;
   }
}

this is the b4

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz

Code:

package chobit;

import java.util.Calendar;
import java.util.Date;

public class ZeroTimeGate {
   // a gate that only opens x minutes after it has been set
   private int pause = 1;
   private Date openedGate = new Date();
   private Date checkPoint = new Date();

   public ZeroTimeGate(int minutes) {
      super();
      this.pause = minutes;
      try {
         Thread.sleep(1000);
      } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         // e.printStackTrace();
      }
   }

   public ZeroTimeGate() {
   }

   public Boolean isClosed() {
      return openedGate.before(new Date());
   }

   public void open() {
      this.openedGate = addMinutesToJavaUtilDate(new Date(), pause);
   }

   public void open(int minutes) {
      Date now = new Date();
      openedGate = addMinutesToJavaUtilDate(now, minutes);
   }

   private Date addMinutesToJavaUtilDate(Date date, int minutes) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(date);
      calendar.add(Calendar.MINUTE, minutes);
      return calendar.getTime();
   }

   public void setPause(int pause) {
      if (pause < 60 && pause > 0) {
         this.pause = pause;
      }
   }

   public void resetCheckPoint() {
      this.checkPoint = new Date();
   }

   public int givenTwoDateTimesInJava8_whenDifferentiatingInSeconds_thenWeGetTen() {
      Date now = new Date();
      long diff = now.getTime() - this.checkPoint.getTime();
      long diffSeconds = diff / 1000 % 60;
      // long diffMinutes = diff / (60 * 1000) % 60;
      // long diffHours = diff / (60 * 60 * 1000) % 24;
      // long diffDays = diff / (24 * 60 * 60 * 1000);
      // System.out.print(diffDays + " days, ");
      // System.out.print(diffHours + " hours, ");
      // System.out.print(diffMinutes + " minutes, ");
      // System.out.print(diffSeconds + " seconds.");
      return (int) diffSeconds;
   }
}

I updated the zerotimegate

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
an anti glitch in the c'tor ha ? based

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
lets continue tomorow, I'm pretty tired tbh

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
kurosen wrote:
lets continue tomorow, I'm pretty tired tbh


no problem.
haha we have a like ban cool :lol!:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
you there?
post focus on the input meth

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz

Code:

public void input(String ear, String skin, String eye) {
      detectFriend(ear);
      this.outputAlg = this.absDefConTranslator.getDefcon(ear, skin, eye);
   }

:alrt:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
lets take a look into the replica input
\we can thin it out I think

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
mod for superreplikamap :

Code:

public void input(String item, String defcon, String sensory) {
      // save
   }


:hkn:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz

Code:

protected void inputToSoul(String ear, String skin, String eye) {
      String sensory = ear;
      String currentDefcon = this.absDefConTranslator.getDefconTranslator().getSpecificDefcom(ear, skin, eye);
      if (currentDefcon.isEmpty()) {
         currentDefcon = absDefConTranslator.getDefconTranslator().aquiredTarget();
      }
      if (sensory.isEmpty()) {
         sensory = skin;
      }
      if (sensory.isEmpty()) {
         sensory = eye;
      }
      if (!this.item.isEmpty()) {
         this.replikaMap.input(item, currentDefcon, sensory);
      }
   }

:BP:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz


lets go samurai. populate the input function

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
all systems go
:morph: :ryu ranger:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz

Code:


@Override
   public void input(String ear, String skin, String eye) {
      detectFriend(ear);
      //func1 :
      this.outputAlg = this.absDefConTranslator.getDefcon(ear, skin, eye);
      inputToSoul(ear, skin, eye);
      if(outputAlg!=null) {return;}
      //func2
      triggeredAlgs(ear,skin,eye);
      if(isNull(outputAlg)) {return;}
   }

   private void triggeredAlgs(String ear, String skin, String eye) {
      trgAction(ear,skin,eye);
      if(isNull(outputAlg)) {return;}
      trgExplore(ear, skin, eye);
      if(isNull(outputAlg)) {return;}
      trgPreserve(ear, skin, eye);
   }


I need you to feel in the triggeredAlgs comments

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
finish the framework func 1st

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
Moti Barski wrote:
finish the framework func 1st


Code:

@Override
   public void input(String ear, String skin, String eye) {
      detectFriend(ear);
      // func1 :
      this.outputAlg = this.absDefConTranslator.getDefcon(ear, skin, eye);
      inputToSoul(ear, skin, eye);
      if (outputAlg != null) {
         return;
      }
      // func2
      triggeredAlgs(ear, skin, eye);
      if (isNull(outputAlg)) {
         return;
      }
      // func3
      soulOutput(ear);
   }


this belongs in the louver museum tbh :hisatsu:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz

Code:

package chobit;

import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Queue;

public abstract 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 = "";
   protected AbsDefConTranslator absDefConTranslator;
   private int defcon = 0;
   protected Algorithm outputAlg = null;
   protected Queue<String> soulOutput = new PriorityQueue<>();
   private int soulHP = 2;
   private Boolean replenishSoulHp = true;

   public TheSkill(Kokoro kokoro, AbsDefConTranslator absDefConTranslator, ArrayList<String> items) {
      super(kokoro);
      this.items = items;
      this.absDefConTranslator = absDefConTranslator;

   }

   @Override
   public void input(String ear, String skin, String eye) {
      detectFriend(ear);
      // func1 :
      this.outputAlg = this.absDefConTranslator.getDefcon(ear, skin, eye);
      inputToSoul(ear, skin, eye);
      if (outputAlg != null) {
         return;
      }
      // func2
      triggeredAlgs(ear, skin, eye);
      if (isNull(outputAlg)) {
         return;
      }
      // func3
      soulOutput(ear);
   }

   private void triggeredAlgs(String ear, String skin, String eye) {
      trgAction(ear, skin, eye);
      if (isNull(outputAlg)) {
         return;
      }
      trgExplore(ear, skin, eye);
      if (isNull(outputAlg)) {
         return;
      }
      trgPreserve(ear, skin, eye);
   }

   @Override
   public void output(Neuron noiron) {
      if (!isNull(this.outputAlg)) {
         noiron.algParts.add(this.outputAlg);
         this.outputAlg = null;
      }
      // after this, if there is no reference to the object,
      // it will be deleted by the garbage collector
   }

   private boolean isNull(Object obj) {
      return obj == null;
   }

   protected abstract void trgAction(String ear, String skin, String eye);
   // sensory, souled(kokoro cls directives), predicted

   protected abstract void trgExplore(String ear, String skin, String eye);
      // timed
      // Exploration and learning, Alg efficiancy tests and sort
   protected abstract 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 "";
   }

   public static String strContains(String str1, String... a) {
      for (String temp : a) {
         if (str1.contains(temp)) {
            return temp;
         }
      }
      return "";
   }

   protected void inputToSoul(String ear, String skin, String eye) {
      String sensory = ear;
      String currentDefcon = this.absDefConTranslator.getDefconTranslator().getSpecificDefcom(ear, skin, eye);
      if (currentDefcon.isEmpty()) {
         currentDefcon = absDefConTranslator.getDefconTranslator().aquiredTarget();
      }
      if (sensory.isEmpty()) {
         sensory = skin;
      }
      if (sensory.isEmpty()) {
         sensory = eye;
      }
      if (!this.item.isEmpty()) {
         this.replikaMap.input(item, currentDefcon, sensory);
      }
   }

   protected String soulOutput(String ear) // ear or time
   {
      if (ear.contains("yes")) {
         soulHP++;
      }
      if (this.soulOutput.isEmpty()) {
         return "";
      }
      if (ear.contains("how")) {
      }
      String question = strContains(ear, "who", "what", "when", "where", "why", "which");
      if (!question.isEmpty()) {
      }
      if (ear.contains("example")) {
         // /JOI example||detail, default for dirty skills
      }
      if (ear.contains("sleep")) {
      }
      if (ear.contains("story")) {
         // time trg
      }
      // default : imprint fresh memories, check not in friend memory.
      if (!this.soulOutput.isEmpty()) {
         soulHP--;
      }
      replenishSoulHP();
      return "";
   }

   private void replenishSoulHP() {
      int tempMinute = playGround.getMinutesAsInt();
      if (tempMinute != 1) {
         replenishSoulHp = true;
         return;
      }
      if ((tempMinute == 1) && replenishSoulHp) {
         soulHP = 2;
         replenishSoulHp = false;
      }
   }

   protected Algorithm mainOutput() {
      // overridde me
      return null;
   }
}

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
unit testing successful : defcontranslator cls :

Code:

package chobit;

import java.util.ArrayList;
import java.util.Stack;

public class DefconTranslator {
   private String input = "";
   private Stack<String> inputStack = new Stack<String>();
   private ArrayList<String> extraDefcons = new ArrayList<String>();// extra defcons
   private ZeroTimeGate zeroTimeGate = new ZeroTimeGate(1);
   private RegexUtil regexUtil = new RegexUtil();
   private String target = "";

   public DefconTranslator(ArrayList<String> extraDefcons) {
      super();
      this.extraDefcons = extraDefcons;
   }

   public String getSpecificDefcom(String ear, String skin, String eye) {
      for (String item : extraDefcons) {
         if (eye.contains(item)) {
            return item;
         }
      }
      for (String item : extraDefcons) {
         if (skin.contains(item)) {
            return item;
         }
      }
      for (String item : extraDefcons) {
         if (ear.contains(item)) {
            return item;
         }
      }
      return "";
   }

   public String aquiredTarget() {
      // for (String item : inputStack) {
      // if (eye.contains(item)) {
      // return item;
      // }
      // }
      // for (String item : inputStack) {
      // if (skin.contains(item)) {
      // return item;
      // }
      // }
      // for (String item : inputStack) {
      // if (ear.contains(item)) {
      // return item;
      // }
      // }
      return target;
   }
   // get unique defcon
   public int getDefcon(String ear, String skin, String eye) {
      // override this methode in subclass per skill
      this.target = "";
      if (zeroTimeGate.isClosed()) {
         if (listInStrEye(ear, skin, eye)) {
            zeroTimeGate.open();
            target = regexUtil.firstWord(eye);
            inputStack.push(target);
            return 1;
         }
         if (listInStrEar(ear, skin, eye)) {
            zeroTimeGate.open();
            target = regexUtil.afterWord("it is", ear);
            if (!target.isEmpty()) {
               inputStack.push(target);
            }
            return 2;
         }
         if (listInStrLearnedEar(ear, skin, eye)) {
            zeroTimeGate.open();
            // set target from regex
            // send alg
            // stuck clear;return alg
            target = "deduced: " + regexUtil.afterWord("it is", ear);
            if (target.isEmpty()) {
               return 3;
            }
            inputStack.clear();
         }
         if (listInStrLearnedEye(ear, skin, eye)) {
            zeroTimeGate.open();
            target = "deduced: " + regexUtil.firstWord(eye);
            inputStack.clear();
            return 4;
            // set target from regex
            // send alg
            // stuck clear;return alg
         }
      }
      return 0;
   }

   private Boolean listInStrEye(String ear, String skin, String eye) {
      for (String string : extraDefcons) {
         if (skin.contains(string)) {
            return true;
         }
      }
      for (String string : extraDefcons) {
         if (eye.contains(string)) {
            return true;
         }
      }
      return false;
   }

   private Boolean listInStrEar(String ear, String skin, String eye) {
      for (String string : extraDefcons) {
         if (ear.contains(string)) {
            return true;
         }
      }
      return false;
   }

   private Boolean listInStrLearnedEar(String ear, String skin, String eye) {

      for (String string : inputStack) {
         if (ear.contains(string)) {
            return true;
         }
      }
      return false;
   }

   private Boolean listInStrLearnedEye(String ear, String skin, String eye) {
      for (String string : inputStack) {
         if (eye.contains(string)) {
            return true;
         }
      }
      return false;
   }
}

:alrt:

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz


should dive into the replika. what do you think ?

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
ok, here is what I need next :
the replica side of the input()
souloutput : alg selection, the replica side of the soul output


item preservation, and befriending should be handled in the override the skill subclasses
so no problem there. a comment should suffice.

descriptiongen3 skill team work technodrum mode EmptyRe: gen3 skill team work technodrum mode

more_horiz
Alg cls:
AlgPart
action var : default or learned or chooses
to know if the ap uses an item we can use a naming convention, the ap has item name.
with the exception of special AP like saying and cussing which we can hardcode.
the super replica also needs a position reset()
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply