skill code :

Code:

package com.yotamarker.lgkotlin1;

public class DiGateBox extends DiSkillV2{
    // this will make the AI miss the user and also give him a shout out a while before he returns home
    /* a lot of possible beefups here
    * like connecting the output cases to missing persons algorithm
    * or setting up lights and warm the water or make coffee before the user returns
    * as well as exchanging info about the bots and users day
    * */
    private Worry worry;
    private Responder responder = new Responder("bye bye#i shall miss you#have a good day#i love you", (byte)4);
    public DiGateBox(Kokoro kokoro) {
        super(kokoro);
        this.worry = new Worry(kokoro);

    }
    @Override
    public void input(String ear, String skin, String eye) {
        int temp = worry.input(ear, "", "");
        worry.standby();
        worry.setLog(ear);
        if(temp > 0){
            switch(temp) {
                case 1:
                    this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("misses_you", "come back");
                    return;
                case 2:
                    this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("worried", "come back");
                    return;
                default:
                    // code block
            }
        }
        switch(ear) {
            case "i am home":
                this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("welcome4","welcome home");
                return;
            case "when do i get home":
                this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("arrival_home",worry.getAtHome());
                return;
            case "i am leaving":
                this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("bye",responder.getResponse());
                return;
            case "what was i going to do": case"what did i want to do":
                this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm("leaver_log","you were going to "+worry.getLog());
                return;
            default:
                // code block
        }
    }
}


worry class :

Code:

package com.yotamarker.lgkotlin1;

public class Worry extends GrimoireModule {
    private PlayGround playGround = new PlayGround();
    private String atHome = ""; // time to expect user to be home
    private int counter = 0;
    private PheonixSender sendGate = new PheonixSender();
    private Boolean limiter = false;// makes the AI worry only once
    private Boolean worry = false;
    private String log = "";
    private Kokoro kokoro;

    public String getAtHome() {
        return atHome;
    }

    public Worry(Kokoro kokoro) {
        this.kokoro = kokoro;
        this.atHome = this.kokoro.grimoireMemento.simpleLoad("worry_time");
    }

    @Override
    public int input(String ear, String skin, String eye) {
        // got home ? save time
        if (ear.equals("i am home")) {
            limiter = false;
            atHome = playGround.getPastInXMin(20);
            this.kokoro.grimoireMemento.simpleSave("worry_time",atHome);
            counter = 0;
            worry = false;
            return 0;
        }
        // hmm user should be home soon
        if (playGround.getCurrentTimeStamp().equals(atHome) && !limiter) {
            // send only once
            if (sendGate.sendable()) {
                limiter = true;
                return 1;
            }
        }
        // user is late I am worried :
        if (worry) {
            worry = false;
            return 2;
        } // worry algorithm
        return 0;
    }

    public void standby() {
        sendGate.standByReset();
        if (limiter) {
            if (counter > 7) {
                return;
            }
            if (counter == 7) {
                worry = true;
            }
            counter++;
        }
    }

    public String getLog() {
        return log;
    }

    public void setLog(String log) {
        if (log.startsWith("i am going to")) {
            this.log = log.replace("i am going to", "");
        }
    }
}


:chii: