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

descriptionchobitv2 personality upgrade Emptychobitv2 personality upgrade

more_horiz
I am a lazy coder
which is why I really like the concept of one line of code to add a skill to the waifubot AGI.
but I understand I was not lazy enough.
indeed this is the most efficient way to code, and it offers customization, flexability and speed but
overall a waifubot has several skills in total, one could find himself writing 9 maybe even 20 lines of code
to fully load a bots personality.

what more I was thinking about gaming. some games would require many different AIs with different personality.

so, I beefed up the my waifubots c'tor !
1 line of code to add an entire personality(skill set) of the coders choice. you can not get lazier than that.
that's like chew my food lazy.

this class is used in the ChobitV2 c'tor.
it enables loading a complete skill set (a sub class of the personality class)
using 1 line of code. of course you can also select specific skills to add from
the subclasses c'tor. see also Personality1 for example.

Personality :

Code:

package com.yotamarker.lgkotlin1;

import java.util.ArrayList;
import java.util.Hashtable;

public class Personality {
    /*this class is used in the ChobitV2 c'tor.
it enables loading a complete skill set (a sub class of the personality class)
using 1 line of code. of course you can also select specific skills to add from
the subclasses c'tor. see also Personality1 for example.*/
    protected Kokoro kokoro; // soul
    protected ArrayList<AbsCmdReq> dClassesLv1 = new ArrayList<>();// can engage with anyone
    protected ArrayList<AbsCmdReq> dClassesLv2 = new ArrayList<>();// can engage with friends and work related
    protected ArrayList<AbsCmdReq> dClassesLv3 = new ArrayList<>();// can engage only by user
    protected Permission permission = Permission.newInstance("xxx", "sweetie", "honey");
    protected DPermitter dPermitter = new DPermitter(permission);//TODO
    protected Hashtable<String, Integer> AlgDurations = new Hashtable<>();
    protected Fusion fusion = new Fusion(AlgDurations);
    http://fusion.getReqOverload() // an overload of requests on the brain
    http://fusion.getRepReq() // someone is negging and asking the same thing over and over again
    /*
    flight or fight skills may need access to the above fusion class booleans
    on the output methode of a skill this skills will load algorithms to the highest priority of the noiron
    which carries algorithms :
    noiron.negativeAlgParts.add(Algorithm)
    * */
    public Personality(AbsDictionaryDB absDictionaryDB) {
        this.kokoro = new Kokoro(absDictionaryDB);
    }
    public Personality() {
        this.kokoro = new Kokoro(new AbsDictionaryDBShadow());
    }

    public ArrayList<AbsCmdReq> getdClassesLv1() {
        return dClassesLv1;
    }

    public ArrayList<AbsCmdReq> getdClassesLv2() {
        return dClassesLv2;
    }

    public ArrayList<AbsCmdReq> getdClassesLv3() {
        return dClassesLv3;
    }

    public Kokoro getKokoro() {
        return kokoro;
    }

    public Permission getPermission() {
        return permission;
    }

    public DPermitter getdPermitter() {
        return dPermitter;
    }

    public Hashtable<String, Integer> getAlgDurations() {
        return AlgDurations;
    }

    public Fusion getFusion() {
        return fusion;
    }
}


example subClass Personality1 :

Code:

package com.yotamarker.lgkotlin1;

public class Personality1 extends Personality{
    public Personality1(AbsDictionaryDB absDictionaryDB) {
        super(absDictionaryDB);
        // add a skill here, only 1 line needed !!!
        dClassesLv1.add(new Detective(fusion));
        // dClassesLv1.add(new DJirachi());
        // dClassesLv1.add(new DIAutomatic(kokoro, master));
        // dClassesLv1.add(new DIBedTime(kokoro));
        // dClassesLv1.add(new DHungry());
        // dClassesLv1.add(new DIBurper(kokoro));
        dClassesLv1.add(dPermitter);
        dClassesLv1.add(new DIJoker(kokoro));
        dClassesLv1.add(new DIEliza(kokoro));
        dClassesLv1.add(new DILively(kokoro));
        dClassesLv1.add(new DIBurper(kokoro));
        dClassesLv1.add(new DIWeather(kokoro));
        dClassesLv1.add(new DICurrency(kokoro));
        dClassesLv1.add(new DIGamer(kokoro));
        dClassesLv1.add(new DSpeller());
        dClassesLv1.add(new DiSoulV3(kokoro));
        dClassesLv1.add(new DiPrefer(kokoro));
        dClassesLv1.add(new DIBukubukuchagama(kokoro));
        dClassesLv1.add(new DIAlerter(kokoro));
        dClassesLv1.add(new DiTglrAdapter(kokoro,"mommy",new TheSitterV2(kokoro, "mommy")));
        dClassesLv1.add(new DiMiniGamer(kokoro));
        dClassesLv1.add(new ThePet(kokoro));
        dClassesLv1.add(new DiMemoryGame(kokoro));
        dClassesLv1.add(new DiSaladSuggestor(kokoro));
        dClassesLv1.add(new DiB8Tri(kokoro));
        // dClassesLv1.add(new DCalculatorV1());
        http://dClassesLv2.add(new DSayer());
        dClassesLv2.add(new DiSayer(kokoro));
        // dClassesLv3.add(new DAlarmer());
        dClassesLv3.add(new DIDirty(kokoro));
        dClassesLv3.add(new DIHomer(kokoro));
        dClassesLv3.add(new DILifeFueler(kokoro));
        dClassesLv3.add(new DiTglrSkill(kokoro, "mommy"));
    }

    public Personality1() {
        super();
        dClassesLv1.add(new Detective(fusion));
        // dClassesLv1.add(new DJirachi());
        // dClassesLv1.add(new DIAutomatic(kokoro, master));
        // dClassesLv1.add(new DIBedTime(kokoro));
        // dClassesLv1.add(new DHungry());
        // dClassesLv1.add(new DIBurper(kokoro));
        dClassesLv1.add(dPermitter);
        dClassesLv1.add(new DIJoker(kokoro));
        dClassesLv1.add(new DSpeller());
        dClassesLv1.add(new DISoulV2(kokoro));
        // dClassesLv1.add(new DCalculatorV1());
        dClassesLv2.add(new DSayer());
        // dClassesLv3.add(new DAlarmer());
        dClassesLv3.add(new DIDirty(kokoro));
    }
}

:swt:

descriptionchobitv2 personality upgrade EmptyRe: chobitv2 personality upgrade

more_horiz
ChobitV2 with the personality constructor :

Code:

package com.yotamarker.lgkotlin1;

import java.util.ArrayList;
import java.util.Hashtable;

public class ChobitV2 {
    protected String emot = ""; // emotion
    protected ArrayList<AbsCmdReq> dClassesLv1;
    protected ArrayList<AbsCmdReq> dClassesLv2;// can engage with friends and work related
    protected ArrayList<AbsCmdReq> dClassesLv3;// can engage only by user
    protected ArrayList<AbsCmdReq> dClassesAuto = new ArrayList<>();// automatically added and engaged by time
    // algorithms fusion (polymarization)
    protected Hashtable<String, Integer> AlgDurations;
    protected Fusion fusion;
    // region essential DClasses
    protected Permission permission;
    protected DPermitter dPermitter;
    // endregion
    protected Neuron noiron;
    // sleep vars :
    protected Person activePerson = new Person();
    protected PrimoCera primoCera = new PrimoCera();
    // added :
    protected Kokoro kokoro; // soul
    protected Person master = new Person();
    protected String lastOutput = "";
    // standBy phase 260320
    protected TimeGate timeGate = new TimeGate();
    public ChobitV2(Personality personality) {
        super();
        this.AlgDurations=personality.getAlgDurations();
        this.fusion=personality.getFusion();
        this.kokoro = personality.getKokoro();
        permission=personality.getPermission();
        dPermitter=personality.getdPermitter();
        noiron = new Neuron();
        dClassesLv1=personality.getdClassesLv1();
        dClassesLv2=personality.getdClassesLv2();
        dClassesLv3=personality.getdClassesLv3();
        formAutoClassesList();
    }
public void loadPersonality(Personality personality){
    this.AlgDurations=personality.getAlgDurations();
    this.fusion=personality.getFusion();
    this.kokoro = personality.getKokoro();
    permission=personality.getPermission();
    dPermitter=personality.getdPermitter();
    noiron = new Neuron();
    dClassesLv1=personality.getdClassesLv1();
    dClassesLv2=personality.getdClassesLv2();
    dClassesLv3=personality.getdClassesLv3();
    dClassesAuto = new ArrayList<>();
    formAutoClassesList();
}
    protected void formAutoClassesList() {
        // adds automatic skills so they can be engaged by time
        for (AbsCmdReq dCls : dClassesLv2) {
            if (dCls.auto()) {
                dClassesAuto.add(dCls);
            }
        }
        for (AbsCmdReq dCls : dClassesLv3) {
            if (dCls.auto()) {
                dClassesAuto.add(dCls);
            }
        }
    }
    public String doIt(String ear, String skin, String eye) {
        ear = translateIn(ear);
        for (AbsCmdReq dCls : dClassesAuto) {
            inOut(dCls, "", skin, 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 translateOut(fusion.act(ear, skin, eye));
    }
    public String getSoulEmotion(){return kokoro.getEmot();}
    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 void inOut(AbsCmdReq dClass, String ear, String skin, String eye) {
        dClass.input(ear, skin, eye); // new
        dClass.output(noiron);
    }

    protected String translateIn(String earIn) {
        // makes sure the chobit doesn't feedback on her own output
        if (earIn.equals(lastOutput)) {
            return "";
        }
        return earIn;
    }

    protected String translateOut(String outResult) {
        // save last output served
        if (!outResult.isEmpty()) {
            lastOutput = outResult;
            this.timeGate.close();
            this.kokoro.standBy = false;
        }
        // standBy :
        else {
            if (!this.timeGate.isClosed()) {
                this.kokoro.standBy = true;
                this.timeGate.close();
            } else {
                this.kokoro.standBy = false;
            }
        }
        return outResult;
    }
}


:chobit:
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply