👨‍💻 dev diinsulted

development

fukurou

the supreme coder
ADMIN
Python:
def count_occurrences(lst, element):
    return lst.count(element)

# Example usage:
my_list = [1, 2, 3, 2, 4, 2, 5]
element_to_count = 2
count = count_occurrences(my_list, element_to_count)
print(f"The element {element_to_count} appears {count} times in the list.")
 

fukurou

the supreme coder
ADMIN
Python:
class AnnoyedQ:

    def __init__(self, queLim: int):
        self._q1: RefreshQ = RefreshQ(queLim)
        self._q2: RefreshQ = RefreshQ(queLim)

    def learn(self, ear: str):
        if self._q1.contains(ear):
            self._q2.insert(ear)
            return
        self._q1.insert(ear)

    def isAnnoyed(self, ear: str) -> bool:
        return self._q2.strContainsResponse(ear)

    def reset(self):
        # Insert unique throwaway strings to reset the state
        for i in range(self._q1.getLimit()):
            self.learn(f"throwaway_string_{i}")

    def AnnoyedLevel(self, ear: str, level: int) -> bool:
        return self._q2.queue.count(ear) == level
 

fukurou

the supreme coder
ADMIN
Python:
class DiCusser(Skill):
    def __init__(self, responder: Responder, memory_size: int = 15, reply_chance: int = 90, ):
        super().__init__()
        self.npc: AXNPC2 = AXNPC2(memory_size, reply_chance)
        self._temp_str: str = ""
        self.splitter: AXStringSplit = AXStringSplit()
        self._initialized: bool = False
        self.filter: Responder = responder
        self._excluder: Excluder = Excluder()
        self._excluder.add_starts_with("tell me")
        self._excluder.add_ends_with("over")
        self.annoyedq: AnnoyedQ = AnnoyedQ(5)
        self.violenceTRG: PercentDripper = PercentDripper()

    def input(self, ear: str, skin: str, eye: str):
        # prevent class with other skills
        if self._excluder.exclude(ear):
            return
        if not self._initialized:
            self.npc.responder.queue = self.splitter.split(self.getKokoro().grimoireMemento.simpleLoad("blabberv4"))
            self._initialized = True
        if len(ear) == 0: # ***
            return
        # auto
        if not len(super().getKokoro().toHeart.get("diblabber", "")) == 0:
            super().getKokoro().toHeart["diblabber"] = ""
            t = self.npc.forceRespond()
            if len(t) == 0:
                t = "hadouken"
            self.algPartsFusion(4, APMad(t))
            return
        # triggered by usage of remembered repeating strings
        self.annoyedq.learn(ear)
        if self.annoyedq.AnnoyedLevel(ear,2):
            if self.violenceTRG.drip():
                self.algPartsFusion(4, APMad("attacking"))
                return
            self.algPartsFusion(4, APMad(self.npc.forceRespond()))
            return
        # filter escape
        if not self.filter.strContainsResponse(ear):
            return
        # blabber
        self._temp_str = self.npc.strRespond(ear)
        if len(self._temp_str) > 0:
            self.algPartsFusion(4, APMad(self.npc.forceRespond()))
        if not self.npc.learn(ear):
            # str learn
            if not self.npc.strLearn(ear):
                return
        self.getKokoro().grimoireMemento.simpleSave("blabberv4", self.splitter.stringBuilder(self.npc.responder.queue))

    def skillNotes(self, param: str) -> str:
        if param == "notes":
            return "cussing skill"
        elif param == "triggers":
            return "try cussing"
        return "note unavalible"
 

fukurou

the supreme coder
ADMIN
Python:
class DiBanter(Skill):
    def __init__(self, responder: Responder, memory_size: int = 15, reply_chance: int = 90, ):
        super().__init__()
        self.npc: AXNPC2 = AXNPC2(memory_size, reply_chance)
        self._temp_str: str = ""
        self.splitter: AXStringSplit = AXStringSplit()
        self._initialized: bool = False
        self.filter: Responder = responder
        self._excluder: Excluder = Excluder()
        self._excluder.add_starts_with("tell me")
        self._excluder.add_ends_with("over")
        self.annoyedq: AnnoyedQ = AnnoyedQ(5)
        self.violenceTRG: PercentDripper = PercentDripper()

    def input(self, ear: str, skin: str, eye: str):
        # prevent class with other skills
        if self._excluder.exclude(ear):
            return
        if not self._initialized:
            self.npc.responder.queue = self.splitter.split(self.getKokoro().grimoireMemento.simpleLoad("blabberv4"))
            self._initialized = True
        if len(ear) == 0: # ***
            return
        # auto
        if not len(super().getKokoro().toHeart.get("diblabber", "")) == 0:
            super().getKokoro().toHeart["diblabber"] = ""
            t = self.npc.forceRespond()
            if len(t) == 0:
                t = "hadouken"
            self.algPartsFusion(4, APMad(t))
            return
        # triggered by usage of remembered repeating strings
        self.annoyedq.learn(ear)
        if self.annoyedq.AnnoyedLevel(ear,1):
            if self.violenceTRG.drip():
                self.algPartsFusion(4, APMad("attacking"))
                return
            self.algPartsFusion(4, APMad(self.npc.forceRespond()))
            return
        # filter escape
        if not self.filter.strContainsResponse(ear):
            return
        # blabber
        self._temp_str = self.npc.strRespond(ear)
        if len(self._temp_str) > 0:
            self.algPartsFusion(4, APMad(self.npc.forceRespond()))
        if not self.npc.learn(ear):
            # str learn
            if not self.npc.strLearn(ear):
                return
        self.getKokoro().grimoireMemento.simpleSave("blabberv4", self.splitter.stringBuilder(self.npc.responder.queue))

    def skillNotes(self, param: str) -> str:
        if param == "notes":
            return "cussing skill"
        elif param == "triggers":
            return "try cussing"
        return "note unavalible"
 
Top