lets dev and shit

fukurou

the supreme coder
ADMIN
Python:
class AXHandshake:
    def __init__(self):
        self.__trgTime: TrgTime = TrgTime()
        self.__trgTolerance: TrgTolerance = TrgTolerance(10)
        self.__shoutout: AXShoutOut = AXShoutOut()
        # default handshakes (valid reply to shout out)
        self.__shoutout.handshake = Responder("what", "yes", "i am here")
        self.__user_name: str = ""
        self.__dripper: PercentDripper = PercentDripper()

    # setters
    def setTimeStamp(self, time_stamp: str) -> AXHandshake:
        # when will the shout out happen?
        # example time stamp: 9:15
        self.__trgTime.setTime(time_stamp)
        return self

    def setShoutOutLim(self, lim: int) -> AXHandshake:
        # how many times should user be called for, per shout out?
        self.__trgTolerance.setMaxRepeats(lim)
        return self

    def setHandShake(self, responder: Responder) -> AXHandshake:
        # which responses would acknowledge the shout-out?
        # such as *see default handshakes for examples suggestions
        self.__shoutout.handshake = responder
        return self

    def setDripperPercent(self, n: int) -> AXHandshake:
        # hen shout out to user how frequent will it be?
        self.__dripper.setLimit(n)
        return self

    def setUser_name(self, user_name: str) -> AXHandshake:
        self.__user_name = user_name
        return self

    # getters
    def getUser_name(self) -> str:
        return self.__user_name

    def engage(self, ear: str) -> bool:
        if self.__trgTime.alarm():
            self.__trgTolerance.reset()
        # stop shout out
        if self.__shoutout.engage(ear):
            self.__trgTolerance.disable()
            return True
        return False

    def trigger(self) -> bool:
        if self.__trgTolerance.trigger():
            if self.__dripper.drip():
                self.__shoutout.activate()
                return True
        return False
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DiTreater extends DiSkillV2 {
    private AXHandshake handshake = new AXHandshake();

    public Responder replies = new Responder("stop arguing", "just do it", "behave","be a big boy and do it","bad boy no more fussing","i know best");
    public TrgArgue contextCmd = new TrgArgue();
    public DiTreater setTime(String time_stamp){
        // set time in which the event eventifies
        handshake.setTimeStamp(time_stamp);
        return this;
    }
    public DiTreater setDripper(int percentage){
        handshake.setDripperPercent(percentage);
        return this;
    }

    public DiTreater() {
        handshake.setTimeStamp("19:30");
        contextCmd.contextCommands.add("do i have to wear a diaper");
        contextCmd.commands.add("but");
        contextCmd.commands.add("do not want to");
        contextCmd.commands.add("why");
        contextCmd.commands.add("no");
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (handshake.engage(ear)){
            contextCmd.engageCommand("do i have to wear a diaper");
            setVerbatimAlg(4,"put on your diaper sweet heart");return;
        }
        if (handshake.trigger()){setVerbatimAlg(4,handshake.getUser_name());return;}
        switch (contextCmd.engageCommand(ear)){
            case 1:
                setVerbatimAlg(4,"you know you do");
                break;
            case 2:
                setVerbatimAlg(4, replies.getAResponse());
                break;
        }
    }
    public DiTreater setUser_nickname(String nickname){
        handshake.setUser_name(nickname);
        return this;
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
from __future__ import annotations
from LivinGrimoire23 import *
from AXPython import *


class DiTreater(DiSkillV2):
    def __init__(self):
        super().__init__()
        self.__handshake: AXHandshake = AXHandshake()
        self.replies: Responder = Responder("stop arguing", "just do it", "behave", "be a big boy and do it", "bad boy "
                                                                                                              "no more "
                                                                                                              "fussing",
                                            "i know best")
        self.contextCmd: TrgArgue = TrgArgue()
        self.__handshake.setTimeStamp("19:30")
        self.contextCmd.contextCommands.insert("do i have to wear a diaper")
        self.contextCmd.commands.insert("but")
        self.contextCmd.commands.insert("do not want to")
        self.contextCmd.commands.insert("why")
        self.contextCmd.commands.insert("no")

    # setters
    def setTime(self, time_stamp: str) -> DiTreater:
        # set time in which the event eventifies
        self.__handshake.setTimeStamp(time_stamp)
        return self

    def setDripper(self, percentage: int) -> DiTreater:
        self.__handshake.setDripperPercent(percentage)
        return self

    def setUser_name(self, user_name: str) -> DiTreater:
        self.__handshake.setUser_name(user_name)
        return self

    # override
    def input(self, ear: str, skin: str, eye: str):
        if self.__handshake.engage(ear):
            self.contextCmd.engageCommand("do i have to wear a diaper");
            self.setVerbatimAlg(4, "put on your diaper sweet heart")
            return
        if self.__handshake.trigger():
            self.setVerbatimAlg(4, self.__handshake.getUser_name())
            return
        match self.contextCmd.engageCommand(ear):
            case 1:
                self.setVerbatimAlg(4, "you know you do")
            case 2:
                self.setVerbatimAlg(4,self.replies.getAResponse())
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DiTime extends DiSkillV2 {
    private PlayGround pl = new PlayGround();

    @Override
    public void input(String ear, String skin, String eye) {
        switch(ear) {
            case "what is the time":
                setVerbatimAlg(4, pl.getCurrentTimeStamp());
                return;
            case "which day is it":
                setVerbatimAlg(4, pl.getDayOfDWeek());
                return;
            case "good morning": case "good night": case "good afternoon": case "good evening":
                setVerbatimAlg(4, "good " + pl.partOfDay());
                return;
            case "which month is it":
                setVerbatimAlg(4, pl.translateMonth(pl.getMonthAsInt()));
                return;
            case "which year is it":
                setVerbatimAlg(4, pl.getYearAsInt()+"");
                return;
            case "what is your time zone":
                setVerbatimAlg(4, pl.getLocal());
                return;
            case "when is the first":
                setVerbatimAlg(4, pl.nxtDayOnDate(1));
                return;
            case "when is the second":
                setVerbatimAlg(4, pl.nxtDayOnDate(2));
                return;
            case "when is the third":
                setVerbatimAlg(4, pl.nxtDayOnDate(3));
                return;
            case "when is the fourth":
                setVerbatimAlg(4, pl.nxtDayOnDate(4));
                return;
            case "when is the fifth":
                setVerbatimAlg(4, pl.nxtDayOnDate(5));
                return;
            case "when is the sixth":
                setVerbatimAlg(4, pl.nxtDayOnDate(6));
                return;
            case "when is the seventh":
                setVerbatimAlg(4, pl.nxtDayOnDate(7));
                return;
            case "when is the eighth":
                setVerbatimAlg(4, pl.nxtDayOnDate(8));
                return;
            case "when is the ninth":
                setVerbatimAlg(4, pl.nxtDayOnDate(9));
                return;
            case "when is the tenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(10));
                return;
            case "when is the eleventh":
                setVerbatimAlg(4, pl.nxtDayOnDate(11));
                return;
            case "when is the twelfth":
                setVerbatimAlg(4, pl.nxtDayOnDate(12));
                return;
            case "when is the thirteenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(13));
                return;
            case "when is the fourteenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(14));
                return;
            case "when is the fifteenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(15));
                return;
            case "when is the sixteenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(16));
                return;
            case "when is the seventeenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(17));
                return;
            case "when is the eighteenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(18));
                return;
            case "when is the nineteenth":
                setVerbatimAlg(4, pl.nxtDayOnDate(19));
                return;
            case "when is the twentieth":
                setVerbatimAlg(4, pl.nxtDayOnDate(21));
                return;
            case "when is the twenty first":
                setVerbatimAlg(4, pl.nxtDayOnDate(21));
                return;
            case "when is the twenty second":
                setVerbatimAlg(4, pl.nxtDayOnDate(22));
                return;
            case "when is the twenty third":
                setVerbatimAlg(4, pl.nxtDayOnDate(23));
                return;
            case "when is the twenty fourth":
                setVerbatimAlg(4, pl.nxtDayOnDate(24));
                return;
            case "when is the twenty fifth":
                setVerbatimAlg(4, pl.nxtDayOnDate(25));
                return;
            case "when is the twenty sixth":
                setVerbatimAlg(4, pl.nxtDayOnDate(26));
                return;
            case "when is the twenty seventh":
                setVerbatimAlg(4, pl.nxtDayOnDate(27));
                return;
            case "when is the twenty eighth":
                setVerbatimAlg(4, pl.nxtDayOnDate(28));
                return;
            case "when is the twenty ninth":
                setVerbatimAlg(4, pl.nxtDayOnDate(29) == "" ? "never":pl.nxtDayOnDate(29));
                return;
            case "when is the thirtieth":
                setVerbatimAlg(4, pl.nxtDayOnDate(30) == "" ? "never":pl.nxtDayOnDate(30));
                return;
            case "when is the thirty first":
                setVerbatimAlg(4, pl.nxtDayOnDate(31) == "" ? "never":pl.nxtDayOnDate(31));
                return;
            default:
                // code block
        }
    }
}
 

fukurou

the supreme coder
ADMIN
assssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssses
and
feeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet
 

fukurou

the supreme coder
ADMIN
Python:
class DiTime(DiSkillV2):
    def __init__(self):
        super().__init__()
        self.__pl: PlayGround = PlayGround()

    # Override
    def input(self, ear: str, skin: str, eye: str):
        match ear:
            case "what is the time":
                self.setVerbatimAlg(4, self.__pl.getCurrentTimeStamp())
            case "which day is it":
                self.setVerbatimAlg(4, self.__pl.getDayOfDWeek())
            case "good morning", "good night", "good afternoon", "good evening":
                self.setVerbatimAlg(4, f'good {self.__pl.partOfDay()}')  # fstring
            case "which month is it":
                self.setVerbatimAlg(4, self.__pl.getCurrentMonthName())
            case "which year is it":
                self.setVerbatimAlg(4, f'{self.__pl.getYearAsInt()}')
            case "what is your time zone":
                self.setVerbatimAlg(4, self.__pl.getLocal())
            case "when is the first":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(1))
            case "when is the second":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(2))
            case "when is the third":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(3))
            case "when is the fourth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(4))
            case "when is the fifth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(5))
            case "when is the sixth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(6))
            case "when is the seventh":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(7))
            case "when is the eighth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(8))
            case "when is the ninth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(9))
            case "when is the tenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(10))
            case "when is the eleventh":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(11))
            case "when is the twelfth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(12))
            case "when is the thirteenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(13))
            case "when is the fourteenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(14))
            case "when is the fifteenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(15))
            case "when is the sixteenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(16))
            case "when is the seventeenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(17))
            case "when is the eighteenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(18))
            case "when is the nineteenth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(19))
            case "when is the twentieth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(20))
            case "when is the twenty first":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(21))
            case "when is the twenty second":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(22))
            case "when is the twenty third":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(23))
            case "when is the twenty fourth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(24))
            case "when is the twenty fifth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(25))
            case "when is the twenty sixth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(26))
            case "when is the twenty seventh":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(27))
            case "when is the twenty eighth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(28))
            case "when is the twenty ninth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(29) if (self.__pl.nxtDayOnDate(29) != "") else "never")
            case "when is the thirtieth":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(30) if (self.__pl.nxtDayOnDate(30) != "") else "never")
            case "when is the thirty first":
                self.setVerbatimAlg(4, self.__pl.nxtDayOnDate(31) if (self.__pl.nxtDayOnDate(31) != "") else "never")

 

owly

闇の伝説
Staff member
戦闘 コーダー
swift
skills: GamificationP,N,DiEngager, DiBlabber, DiTime,dimagic8ball,ditreater, dicron
AX:magic8ball,AXShoutout,AXHandshake
LG: setsimplealg(diskillv2),pl(getcurrentmonthname)

python
skills: GamificationP,N,DiEngager, DiBlabber, dicron

java:
LG: setsimplealg(diskillv2),pl(getcurrentmonthname)
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DiCron extends DiSkillV2 {
    private String sound = "snore";
    private Cron cron = new Cron("12:05",40,2);//Cron(String startTime, int minutes, int limit)
    // setters
    public DiCron setSound(String sound) {
        this.sound = sound;
        return this;
    }

    public DiCron setCron(Cron cron) {
        this.cron = cron;
        return this;
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (cron.trigger()){
            setVerbatimAlg(4,sound);
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class DiCron(DiSkillV2):
    def __init__(self):
        super().__init__()
        self.__sound: str = "snore"
        self.__cron: Cron = Cron("12:05", 40, 2)

    # setters
    def setSound(self, sound: str) -> DiCron:
        self.__sound = sound
        return self

    def setCron(self, cron: Cron) -> DiCron:
        self.__cron = cron
        return self

    # Override
    def input(self, ear: str, skin: str, eye: str):
        if self.__cron.trigger():
            self.setSimpleAlg(self.__sound)
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DIBlabber extends DiSkillV2 {
    private Boolean isActive = true; // skill toggle
    public AXContextCmd skillToggler = new AXContextCmd();
    // chat mode select
    public AXContextCmd modeSwitch = new AXContextCmd();
    protected Cycler mode = new Cycler(1); // chat-bot mode
    // engage chatbot
    public AXContextCmd engage = new AXContextCmd();
    // chatbots
    public AXNPC2 chatbot1 = new AXNPC2(30,90); // pal mode chat module
    public AXNPC2 chatbot2 = new AXNPC2(30,90); // discreet mode chat module
    // auto mode
    private Responder autoEngage = new Responder("engage automatic mode","automatic mode", "auto mode");
    private Responder shutUp = new Responder("stop","shut up", "silence", "be quite", "be silent");
    private TimeGate tg = new TimeGate(5);
    private int nPCPlus = 5; // increase rate of output in self auto reply mode
    private int nPCNeg = -10; // decrease rate of output in self auto reply mode
    public DIBlabber(String skill_name) {
        skillToggler.contextCommands.add("toggle " + skill_name);
        skillToggler.commands.add("again");skillToggler.commands.add("repeat");
        modeSwitch.contextCommands.add("switch " + skill_name + " mode");
        modeSwitch.commands.add("again");modeSwitch.commands.add("repeat");
        engage.contextCommands.add("engage " + skill_name);engage.commands.add("talk");
        engage.commands.add("talk to me");
        engage.commands.add("again");engage.commands.add("repeat");
        mode.setToZero();
    }

    @Override
    public void input(String ear, String skin, String eye) {
        // skill toggle:
        if(skillToggler.engageCommand(ear)){isActive = !isActive;}
        if (!isActive){return;}
        // chat-bot mode switch mode
        if(modeSwitch.engageCommand(ear)){
            mode.cycleCount();
            setVerbatimAlg(4, talkMode());;
            return;
        }
        switch (mode.getMode()){
            case 0:
                mode0(ear);
                break;
            case 1:
                mode1(ear);
                break;
        }
    }
    private void mode0(String ear) {
        if (!kokoro.toHeart.getOrDefault("diblabber","").isEmpty()){
            kokoro.toHeart.put("diblabber","");
            setVerbatimAlg(4, chatbot1.forceRespond());
            return;
        }
        NPCUtilization(chatbot1,ear);
    }

    private void mode1(String ear) {
        // auto engage
        if(autoEngage.responsesContainsStr(ear)){
            tg.openGate();
            setVerbatimAlg(4,"auto NPC mode engaged");
            return;
        }
        if(shutUp.responsesContainsStr(ear)){
            tg.close();
            setVerbatimAlg(4,"auto NPC mode disengaged");
            return;
        }
        if (tg.isOpen()){
            int plus = nPCNeg;
            if (!ear.isEmpty()){plus = nPCPlus;}
            String result = chatbot2.respondPlus(plus);
            if (!result.isEmpty()) {
                setVerbatimAlg(4, result);
                return;
            }
        }
        // end auto engage code snippet
        NPCUtilization(chatbot2, ear);
    }
    private String talkMode(){
        switch (mode.getMode()){
            case 0:
                return "friend mode";
            case 1:
                return "discreet mode";
        }
        return "mode switched";
    }
    // auto mode setters
    public void setNPCTimeSpan(int n){
        tg.setPause(n);
    }
    public void setNPCNeg(int n){
        // lower NPC auto output chance
        nPCNeg = n;
    }
    public void setNPCPlus(int n){
        // increase NPC auto output chance
        nPCPlus = n;
    }
    // chat module common tasks
    private void NPCUtilization(AXNPC2 npc, String ear){
        String result = "";
        // engage
        if (engage.engageCommand(ear)) {
            result = npc.respond();
            if (!result.isEmpty()) {
                setVerbatimAlg(4, result);
                return;
            }
        }
        // str engage
        result = npc.strRespond(ear);
        if (!result.isEmpty()) {
            setVerbatimAlg(4, result);
        }
        // forced learn (say n)
        if (!npc.learn(ear)){
            // strlearn
            npc.strLearn(ear);
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class DiBlabber(DiSkillV2):
    def __init__(self, skill_name: str):
        super().__init__()
        # skill toggle
        self.__isActive: bool = True
        self.skillToggler: AXContextCmd = AXContextCmd()
        self.skillToggler.contextCommands.insert(f'toggle {skill_name}')
        self.skillToggler.commands.insert("again")
        self.skillToggler.commands.insert("repeat")
        # chat mode select
        self.modeSwitch: AXContextCmd = AXContextCmd()
        self.modeSwitch.contextCommands.insert(f'switch {skill_name} mode')
        self.modeSwitch.commands.insert("again")
        self.modeSwitch.commands.insert("repeat")
        self._mode: Cycler = Cycler(1)
        self._mode.setToZero()  # default mode : pal chatbot (chatbot1)
        # engage chatbot
        self.engage: AXContextCmd = AXContextCmd()
        self.engage.contextCommands.insert(f'engage {skill_name}')
        self.engage.commands.insert("talk to me")
        self.engage.commands.insert("again")
        self.engage.commands.insert("repeat")
        # chatbots
        self.chatbot1: AXNPC2 = AXNPC2(30, 90)  # pal mode chat module
        self.chatbot2: AXNPC2 = AXNPC2(30, 90)  # discreet mode chat module
        # auto mode
        self.__autoEngage: Responder = Responder("engage automatic mode", "automatic mode", "auto mode")
        self.__shutUp: Responder = Responder("engage automatic mode", "automatic mode", "auto mode")
        self.__tg: TimeGate = TimeGate(5)
        self.__nPCPlus: int = 5  # increase rate of output in self auto reply mode
        self.__nPCNeg: int = -10  # decrease rate of output in self auto reply mode

    # Override
    def input(self, ear: str, skin: str, eye: str):
        # skill toggle:
        if self.skillToggler.engageCommand(ear):
            self.__isActive = not self.__isActive
        if not self.__isActive:
            return
        # chatbot mode: switch mode
        if self.modeSwitch.engageCommand(ear):
            self._mode.cycleCount()
            self.setSimpleAlg(self.talkMode())
            return
        match self._mode.getMode():
            case 0:
                self.mode0()
            case 1:
                self.mode1()

    def talkMode(self) -> str:
        match self._mode.getMode():
            case 0:
                return "friend mode"
            case 1:
                return "discreet mode"
        return "mode switched"

    # chat module common tasks
    def NPCUtilization(self, npc: AXNPC2, ear: str):
        result: str = ""
        # engage
        if self.engage.engageCommand(ear):
            result = npc.respond()
            if not result == "":
                self.setSimpleAlg(result)
                return
        # str engage
        result = npc.strRespond(ear)
        if not result == "":
            self.setSimpleAlg(result)
        # forced learn (say n)
        if not npc.learn(ear):
            # str learn
            npc.strLearn(ear)

    def mode0(self, ear: str):
        if not len(super()._kokoro.get("diblabber", "")) == 0:
            super()._kokoro["diblabber"] = ""
            self.setSimpleAlg(self.chatbot1.forceRespond())
            return
        self.NPCUtilization(self.chatbot1, ear)

    def mode1(self,ear: str):
        # auto engage:
        if self.__autoEngage.responsesContainsStr(ear):
            self.__tg.open()
            self.setSimpleAlg("auto NPC mode engaged")
            return
        if self.__shutUp.responsesContainsStr(ear):
            self.__tg.close()
            self.setSimpleAlg("auto NPC mode disengaged")
            return
        if self.__tg.isOpen():
            plus:int = self.__nPCNeg
            if not (len(ear) == 0):
                plus = self.__nPCPlus
            result:str = self.chatbot2.respondPlus(plus)
            if not (len(result) == 0):
                self.setSimpleAlg(result)
                return
        # end auto engage code snippet
        self.NPCUtilization(self.chatbot2,ear)

    # auto mode setters
    def setNPCTimeSpan(self, n: int):
        self.__tg.setPause(n)

    def setNPCNeg(self, n: int):
        # lower NPC auto output chance
        self.__nPCNeg = n

    def setNPCPlus(self, n: int):
        # increase NPC auto output chance
        self.__nPCPlus = n
 

fukurou

the supreme coder
ADMIN
Python:
class DiBlabber(DiSkillV2):
    def __init__(self, skill_name: str):
        super().__init__()
        # skill toggle
        self.__isActive: bool = True
        self.skillToggler: AXContextCmd = AXContextCmd()
        self.skillToggler.contextCommands.insert(f'toggle {skill_name}')
        self.skillToggler.commands.insert("again")
        self.skillToggler.commands.insert("repeat")
        # chat mode select
        self.modeSwitch: AXContextCmd = AXContextCmd()
        self.modeSwitch.contextCommands.insert(f'switch {skill_name} mode')
        self.modeSwitch.commands.insert("again")
        self.modeSwitch.commands.insert("repeat")
        self._mode: Cycler = Cycler(1)
        self._mode.setToZero()  # default mode : pal chatbot (chatbot1)
        # engage chatbot
        self.engage: AXContextCmd = AXContextCmd()
        self.engage.contextCommands.insert(f'engage {skill_name}')
        self.engage.commands.insert("talk to me")
        self.engage.commands.insert("again")
        self.engage.commands.insert("repeat")
        # chatbots
        self.chatbot1: AXNPC2 = AXNPC2(30, 90)  # pal mode chat module
        self.chatbot2: AXNPC2 = AXNPC2(30, 90)  # discreet mode chat module
        # auto mode
        self.__autoEngage: Responder = Responder("engage automatic mode", "automatic mode", "auto mode")
        self.__shutUp: Responder = Responder("stop", "shut up", "silence", "be quite", "be silent")
        self.__tg: TimeGate = TimeGate(5)
        self.__nPCPlus: int = 5  # increase rate of output in self auto reply mode
        self.__nPCNeg: int = -10  # decrease rate of output in self auto reply mode

    # Override
    def input(self, ear: str, skin: str, eye: str):
        # skill toggle:
        if self.skillToggler.engageCommand(ear):
            self.__isActive = not self.__isActive
        if not self.__isActive:
            return
        # chatbot mode: switch mode
        if self.modeSwitch.engageCommand(ear):
            self._mode.cycleCount()
            self.setSimpleAlg(self.talkMode())
            return
        match self._mode.getMode():
            case 0:
                self.mode0(ear)
            case 1:
                self.mode1(ear)

    def talkMode(self) -> str:
        match self._mode.getMode():
            case 0:
                return "friend mode"
            case 1:
                return "discreet mode"
        return "mode switched"

    # chat module common tasks
    def NPCUtilization(self, npc: AXNPC2, ear: str):
        result: str = ""
        # engage
        if self.engage.engageCommand(ear):
            result = npc.respond()
            if not result == "":
                self.setSimpleAlg(result)
                return
        # str engage
        result = npc.strRespond(ear)
        if not result == "":
            self.setSimpleAlg(result)
        # forced learn (say n)
        if not npc.learn(ear):
            # str learn
            npc.strLearn(ear)

    def mode0(self, ear: str):
        if not len(super().getKokoro().toHeart.get("diblabber", "")) == 0:
            super().getKokoro().toHeart["diblabber"] = ""
            self.setSimpleAlg(self.chatbot1.forceRespond())
            return
        self.NPCUtilization(self.chatbot1, ear)

    def mode1(self, ear: str):
        # auto engage:
        if self.__autoEngage.responsesContainsStr(ear):
            self.__tg.open(self.__tg.pause)
            self.setSimpleAlg("auto NPC mode engaged")
            return
        if self.__shutUp.responsesContainsStr(ear):
            self.__tg.close()
            self.setSimpleAlg("auto NPC mode disengaged")
            return
        if self.__tg.isOpen():
            plus: int = self.__nPCNeg
            if not (len(ear) == 0):
                plus = self.__nPCPlus
            result: str = self.chatbot2.respondPlus(plus)
            if not (len(result) == 0):
                self.setSimpleAlg(result)
                return
        # end auto engage code snippet
        self.NPCUtilization(self.chatbot2, ear)

    # auto mode setters
    def setNPCTimeSpan(self, n: int):
        self.__tg.setPause(n)

    def setNPCNeg(self, n: int):
        # lower NPC auto output chance
        self.__nPCNeg = n

    def setNPCPlus(self, n: int):
        # increase NPC auto output chance
        self.__nPCPlus = n
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class DiEngager extends DiSkillV2 {
    // makes the AI burp n  times per hour at random times
    private int burpsPerHour = 2;
    private TrgMinute trgMinute = new TrgMinute(0);
    private String skillToEngage = "unknown";
    private DrawRndDigits draw = new DrawRndDigits();
    private LGFIFO<Integer> burpMinutes = new LGFIFO<>();
    private PlayGround pl = new PlayGround();
    public DiEngager(int burpsPerHour, String skillToEngage) {
        super();
        if((burpsPerHour >0)&& (burpsPerHour <60)){
            this.burpsPerHour = burpsPerHour;
        }
        for (int i = 1; i < 60; i++) {
            draw.addElement(i);
        }
        for (int i = 0; i < burpsPerHour; i++) {
            burpMinutes.add(draw.draw());
        }
        this.skillToEngage = skillToEngage;
    }

    public void setSkillToEngage(String skillToEngage) {
        this.skillToEngage = skillToEngage;
    }

    @Override
    public void input(String ear, String skin, String eye) {
        // night? do not burp
        if (pl.partOfDay().equals("night")){
            return;
        }
        // reset burps
        if (trgMinute.trigger()){
            burpMinutes.clear();
            draw.reset();
            for (int i = 0; i < burpsPerHour; i++) {
                burpMinutes.add(draw.draw());
            }
            return;
        }
        // burp
        int nowMinutes = pl.getMinutesAsInt();
        if(burpMinutes.contains(nowMinutes)){
            burpMinutes.removeItem(nowMinutes);
            this.kokoro.toHeart.put(skillToEngage, "engage");
            return;
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class DiEngager(DiSkillV2):
    def __init__(self, burps_per_hour: int,skillToEngage:str):
        self._burpsPerHour = 2
        if 60 > burps_per_hour > 0:
            self._burpsPerHour = burps_per_hour
        self._trgMinute: TrgMinute = TrgMinute()
        self._trgMinute.setMinute(0)
        self._draw: DrawRndDigits = DrawRndDigits()
        self._burpMinutes: LGFIFO = LGFIFO()
        self._pl: PlayGround = PlayGround()
        self._skillToEngage: str = skillToEngage
        for i in range(1, 60):
            self._draw.addElement(i)
        for i in range(0, burps_per_hour):
            self._burpMinutes.insert(self._draw.drawAndRemove())
        super().__init__()

    def setSkillToEngage(self, skillToEngage: str) -> DiEngager:
        self._skillToEngage = skillToEngage
        return self

    # Override
    def input(self, ear: str, skin: str, eye: str):
        # night? do not burp
        if self._pl.partOfDay() == "night":
            return
        # reset burps
        if self._trgMinute.trigger():
            self._burpMinutes.clear()
            self._draw.reset()
            for i in range(0, self._burpsPerHour):
                self._burpMinutes.insert(self._draw.drawAndRemove())
            return
        # burp
        now_minutes: int = self._pl.getMinutesAsInt()
        if self._burpMinutes.contains(now_minutes):
            self._burpMinutes.removeItem(now_minutes)
            self.getKokoro().toHeart[self._skillToEngage] = "engage"
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
public class GamificationP extends DiSkillV2 {
    // the grind side of the game, see GamificationN for the reward side
    private int gain = 1;
    private DiSkillV2 skill;
    private AXGamification axGamification = new AXGamification();

    public GamificationP(DiSkillV2 skill) {
        this.skill = skill;
    }

    public void setGain(int gain) {
        if (gain >0){
            this.gain = gain;}
    }

    public AXGamification getAxGamification() {
        // shallow ref
        return axGamification;
    }

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

    @Override
    public void output(Neuron noiron) {
        // skill activation increases gaming credits
        if (skill.pendingAlgorithm()) {axGamification.incrementBy(gain);}
        skill.output(noiron);
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
class GamificationP(DiSkillV2):
    
    def __init__(self, skill):
        self.gain = 1
        self.skill = skill
        self.axGamification = AXGamification()
    
    def setGain(self, gain):
        if gain > 0:
            self.gain = gain
    
    def getAxGamification(self):
        return self.axGamification
    
    def input(self, ear, skin, eye):
        self.skill.input(ear, skin, eye)
    
    def output(self, noiron):
        if self.skill.pendingAlgorithm():
            self.axGamification.incrementBy(self.gain)
        self.skill.output(noiron)
 

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
class GamificationN(DiSkillV2):
    def __init__(self, skill, rewardBank):
        self.axGamification = rewardBank.getAxGamification()
        self.cost = 3
        self.skill = skill
    
    def setCost(self, cost):
        self.cost = cost
        return self
    
    def input(self, ear, skin, eye):
        if self.axGamification.surplus(self.cost):
            self.skill.input(ear, skin, eye)
    
    def output(self, noiron):
        if self.skill.pendingAlgorithm():
            self.axGamification.reward(self.cost)
            self.skill.output(noiron)
 

fukurou

the supreme coder
ADMIN
Python:
class GamificationP(DiSkillV2):
    # the grind side of the game, see GamificationN for the reward side
    def __init__(self, skill: DiSkillV2):
        self._gain: int = 1
        self._skill: DiSkillV2 = skill
        self._axGamification: AXGamification = AXGamification()

    def setGain(self, gain):
        if gain > 0:
            self._gain = gain

    def getAxGamification(self) -> AXGamification:
        # shallow ref
        return self._axGamification

    def input(self, ear, skin, eye):
        self._skill.input(ear, skin, eye)

    def output(self, noiron):
        # skill activation increases gaming credits
        if self._skill.pendingAlgorithm():
            self._axGamification.incrementBy(self._gain)
        self._skill.output(noiron)


class GamificationN(DiSkillV2):
    def __init__(self, skill: DiSkillV2, rewardBank: GamificationP):
        self._axGamification: AXGamification = rewardBank.getAxGamification()
        self._cost: int = 3
        self._skill = skill

    def setCost(self, cost: int):
        self._cost = cost
        return self

    def input(self, ear, skin, eye):
        # engage skill only if a reward is possible
        if self._axGamification.surplus(self._cost):
            self._skill.input(ear, skin, eye)

    def output(self, noiron):
        # charge reward if an algorithm is pending
        if self._skill.pendingAlgorithm():
            self._axGamification.reward(self._cost)
            self._skill.output(noiron)
 
Top