optimizing the shit

owly

闇の伝説
Staff member
戦闘 コーダー
Code:
        hato: str = self.getKokoro().toHeart["dibicameral"]

        if hato == "yandere":

@fukurou I would say this^ shit is too complex for the average NPC.

another problem is we have several scenarios to consider:
multicases (switch str)
default cases(any boolean shit)
 

fukurou

the supreme coder
ADMIN
Java:
public class DiB extends DiSkillV2 {
public Boolean engagedKokoro(){
return this.kokoro.toHeart.containsKey(this.getClass().getSimpleName());
    }
public String kokoroMSG(){
return this.kokoro.toHeart.getOrDefault("dibicameral","");
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class DiYandere(DiSkillV2):
    '''
    bica = DiBicameral()
    app.brain.logicChobit.addSkill(bica)
    bica.msgCol.addMSGV2("0:47", "#yandere")
    bica.msgCol.sprinkleMSG("#yandere", 30)
    bica.msgCol.sprinkleMSG("#yandere_cry", 30)
    app.brain.logicChobit.addSkill(DiYandere("fuki"))
    '''

    def __init__(self, ooa):
        super().__init__()
        # ooa =  Object of affection
        self.yandereMode: bool = False
        self.okYandere = Responder()
        self.sadYandere = Responder()
        self.activeResponder: Responder = self.okYandere
        self.answersFunnel: AXFunnel = AXFunnel()
        self.prompt: Prompt = Prompt()
        self.promptActive: bool = False
        self._yesReplies: Responder = Responder("good", "sweet", "thought so", "uwu", "oooweee", "prrr")
        self._noReplies: Responder = Responder("hmph", "you make me sad", "ooh", "grrr", "angry")

        self.okYandere.addResponse("i love you")
        self.okYandere.addResponse(f"i love you {ooa}")
        self.okYandere.addResponse(f"{ooa} i love you")
        self.okYandere.addResponse("say you love me")
        self.okYandere.addResponse(f"{ooa} tell me you love me")
        self.okYandere.addResponse(f"love me {ooa}")

        self.sadYandere.addResponse("things are good now")
        self.sadYandere.addResponse("shiku shiku")
        self.sadYandere.addResponse(f"shiku shiku {ooa}")
        self.sadYandere.addResponse("i love you and you love me")
        self.sadYandere.addResponse("i am good now")
        self.sadYandere.addResponse("i am good i run a test")
        self.sadYandere.addResponse(f"please {ooa} please love me")
        self.sadYandere.addResponse("everything is perfect i am perfect")
        self.sadYandere.addResponse("i am perfect")
        self.sadYandere.addResponse(
            f"i am sorry for what i did, it wasn't me, you have to understand, it wasn't me {ooa}")
        self.sadYandere.addResponse(f"{ooa} listen to me, i love you")
        self.sadYandere.addResponse("i am fixed now, i run a test")
        self.sadYandere.addResponse("you can trust me")
        self.sadYandere.addResponse(f"{ooa} you can trust me")
        self.sadYandere.addResponse("i love you please")

        self.answersFunnel.addKV("i love you", "yes")
        self.answersFunnel.addKV("i love you too", "yes")
        self.answersFunnel.addKV("i hate you", "no")
        self.answersFunnel.addKV("i do not love you", "no")
        self.prompt.setRegex("yes|no")

    def input(self, ear, skin, eye):
        if self.promptActive:
            answer = self.answersFunnel.funnel(ear)
            if not self.prompt.process(answer):
                self.promptActive = False
                if answer == "yes":
                    self.setSimpleAlg(self._yesReplies.getAResponse())
                    self.yandereMode = False
                    self.activeResponder = self.okYandere
                    return
                elif answer == "no":
                    self.setSimpleAlg(self._noReplies.getAResponse())
                    self.yandereMode = True
                    self.activeResponder = self.sadYandere
                    return
        hato: str = self.getKokoro().toHeart["dibicameral"]

        if hato == "yandere":
            self.setSimpleAlg(self.activeResponder.getAResponse())
            self.promptActive = True
        elif hato == "yandere_cry" and self.yandereMode:
            tempList = []
            d1 = DrawRndDigits()
            for i in range(d1.getSimpleRNDNum(3)):
                tempList.append(self.sadYandere.getAResponse())
            self.algPartsFusion(4, APVerbatim(tempList))
 

fukurou

the supreme coder
ADMIN
Python:
class DiB(DiSkillV2):
    def engaged_kokoro(self) -> bool:
        return self.getKokoro().to_heart.get(self.__class__.__name__, False)

    def kokoro_msg(self) -> str:
        return self.getKokoro().toHeart["dibicameral"]
 
Top