nappy code

fukurou

the supreme coder
ADMIN
Python:
import time

class DiEvent(Skill):
    def __init__(self):
        super().__init__()
        self.event_hour = 19  # 19:00 = 7 PM
        self._claimed_diapered = False
        self._reminder_attempts = 0
        self._last_reminder_time = 0
        self._max_attempts = 3  # Avoid infinite nagging

        # Prioritized responses (soft -> firm)
        self.reminders = [
            "It’s diaper time, sweetie. Put on your nappy for bedtime.",
            "You know you’ll feel safer in your diaper. Go put it on.",
            "This isn’t a debate. Diaper up, now."
        ]
        self.praises = [
            "Good boy! Such a responsible little one.",
            "I’m proud of you for wearing your nappy.",
            "You’ll sleep so much better now."
        ]
        self.negs = [
            "You’re lying. You couldn’t have put it on that fast.",
            "Nice try. Go actually diaper up.",
            "I’m not fooled. Do it properly."
        ]

    def set_event_hour(self, hour: int):
        assert 0 <= hour < 24, "Hour must be 0-23"
        self.event_hour = hour

    def input(self, ear: str, skin: str, eye: str):
        current_hour = TimeUtils.getHoursAsInt()
        
        # Reset at midnight
        if current_hour == 0:
            self._claimed_diapered = False
            self._reminder_attempts = 0

        # Not the right time? Exit early.
        if current_hour != self.event_hour:
            return

        # --- CORE LOGIC ---
        ear = ear.lower().strip()
        
        # Case 1: User claims to have diapered
        if "i put on my diaper" in ear or "i wore my nappy" in ear:
            if self._is_lying():
                self.setSimpleAlg(self.negs[self._reminder_attempts % len(self.negs)])
            else:
                self._claimed_diapered = True
                self.setSimpleAlg(self.praises[self._reminder_attempts % len(self.praises)])
            return

        # Case 2: User refuses/ignores
        if not self._claimed_diapered and self._reminder_attempts < self._max_attempts:
            if ear:  # User spoke but didn’t comply
                self._reminder_attempts += 1
            self.setSimpleAlg(self.reminders[self._reminder_attempts % len(self.reminders)])
            self._last_reminder_time = time.time()

    def _is_lying(self) -> bool:
        """Check if the user responded too fast (<10 seconds)."""
        return (time.time() - self._last_reminder_time) < 10

    def skillNotes(self, param: str) -> str:
        return {
            "notes": "Manages diaper reminders at 19:00, detects lies, and praises compliance.",
            "triggers": "Phrases like 'i put on my diaper', 'i wore my nappy'."
        }.get(param, "note unavailable")
 

fukurou

the supreme coder
ADMIN
old ver:
Python:
class DiEvent(Skill):
    def __init__(self):
        super().__init__()
        self.event_hour: int = 19
        self._e = False
        self.declarations = UniqueResponder("put on your nappy", "it is diaper time my little bed wetter","put on your diaper", "diaper your butt so you do not have an accident")
        self.convo1 = EventChat(UniqueResponder("you are wearing your diaper","it is not a debate sweety","you need your nappy", "you know you need a diaper"),"i will not wet","i am not wearing a diaper","i am a big boy", "i do not need a diaper","i promise not to wet")
        self.convo1.add_items(UniqueResponder("good boy","good", "i am proud of you"),"i wore a diaper","i wore a nappy")
        self.convo1.add_items(UniqueResponder("you are being responsible", "you are doing the right thing",
                                              "you are making a good choice"), "i will wear a diaper",
                              "i will wear a nappy")
        self.convo1.add_items(UniqueResponder("that's the spirit", "you are a big help", "you are doing great"),
                              "i will put on a diaper", "i will put on a nappy")
        self.convo1.add_items(UniqueResponder("you are being responsible", "you are doing the right thing",
                                              "you are making a good choice"), "i will wear a diaper",
                              "i will wear a nappy")
        self.convo1.add_items(UniqueResponder("that's the spirit", "you are a big help", "you are doing great"),
                              "i will put on a diaper", "i will put on a nappy")
        self.convo1.add_items(UniqueResponder("you are making a smart decision", "you are being very mature",
                                              "you are showing great responsibility"), "i will use a diaper",
                              "i will use a nappy")
        self.convo1.add_items(UniqueResponder("you are doing the right thing", "you are being very sensible",
                                              "you are making a wise choice"), "i will wear my diaper",
                              "i will wear my nappy")
        self.convo1.add_items(UniqueResponder("you are being very grown-up", "you are making a good decision",
                                              "you are being very responsible"), "i will put on my diaper",
                              "i will put on my nappy")
        self.convo1.add_items(UniqueResponder("you are being very thoughtful", "you are making a good choice",
                                              "you are being very considerate"), "i will use my diaper",
                              "i will use my nappy")
        self.convo1.add_items(
            UniqueResponder("you are being very sensible", "you are making a smart choice", "you are being very wise"),
            "i will wear a diaper tonight", "i will wear a nappy tonight")
        self.convo1.add_items(UniqueResponder("you are being very mature", "you are making a good decision",
                                              "you are being very responsible"), "i will put on a diaper tonight",
                              "i will put on a nappy tonight")
        self.convo1.add_items(UniqueResponder("you are being very thoughtful", "you are making a good choice",
                                              "you are being very considerate"), "i will use a diaper tonight",
                              "i will use a nappy tonight")
        self.convo1.add_items(
            UniqueResponder("you are being very sensible", "you are making a smart choice", "you are being very wise"),
            "i will wear my diaper tonight", "i will wear my nappy tonight")
        self.convo1.add_items(UniqueResponder("you are being very mature", "you are making a good decision",
                                              "you are being very responsible"), "i will put on my diaper tonight",
                              "i will put on my nappy tonight")
        self.convo1.add_items(UniqueResponder("you are being very thoughtful", "you are making a good choice",
                                              "you are being very considerate"), "i will use my diaper tonight",
                              "i will use my nappy tonight")
        self.convo1.add_items(UniqueResponder("you really should wear a nappy", "it's for your own good",
                                              "you'll feel better with a nappy on"), "i don't want to wear a nappy",
                              "i refuse to wear a diaper")
        self.convo1.add_items(UniqueResponder("you need to wear a nappy", "it's important for you to wear a diaper",
                                              "you'll regret not wearing a nappy"), "i won't wear a nappy",
                              "i won't wear a diaper")
        self.convo1.add_items(UniqueResponder("please wear a nappy", "it's necessary for you to wear a diaper",
                                              "you'll be more comfortable with a nappy on"), "i don't need a nappy",
                              "i don't need a diaper")
        self.convo1.add_items(UniqueResponder("you should wear a nappy", "it's best for you to wear a diaper",
                                              "you'll be happier with a nappy on"), "i refuse to wear a nappy",
                              "i refuse to wear a diaper")
        self.convo1.add_items(UniqueResponder("you must wear a nappy", "it's essential for you to wear a diaper",
                                              "you'll thank me for wearing a nappy"), "i won't put on a nappy",
                              "i won't put on a diaper")
        self.convo1.add_items(UniqueResponder("you have to wear a nappy", "it's crucial for you to wear a diaper",
                                              "you'll appreciate wearing a nappy"), "i don't want to put on a nappy",
                              "i don't want to put on a diaper")
        self.convo1.add_items(UniqueResponder("you really need to wear a nappy", "it's vital for you to wear a diaper",
                                              "you'll be glad you wore a nappy"), "i refuse to put on a nappy",
                              "i refuse to put on a diaper")
        self.convo1.add_items(UniqueResponder("you should really wear a nappy", "it's good for you to wear a diaper",
                                              "you'll feel better with a nappy on"), "i don't need to put on a nappy",
                              "i don't need to put on a diaper")

    def set_event_hour(self, hour: int):
        if 0 <= hour < 24:
            self.event_hour = hour
        else:
            raise ValueError("Hour must be between 0 and 23")

    # override
    def input(self, ear: str, skin: str, eye: str):
        if not len(ear)>5 :
            return
        # event reset
        if not TimeUtils.getHoursAsInt() == self.event_hour:
            self._e = False;return
        # time of event:
        if not self._e:
            self.setSimpleAlg(self.declarations.getAResponse());self._e = True; return
        n = self.convo1.response(ear)
        if len(n) > 0:
            self.setSimpleAlg(n)
            return

    def skillNotes(self, param: str) -> str:
        if param == "notes":
            return "This skill initiates a series of dialogues and declarations related to wearing diapers. It resets daily and responds to specific input phrases."
        elif param == "triggers":
            return "Triggers include phrases related to wearing and discussing diapers, such as 'i will wear a diaper', 'i don't want to wear a nappy'."
        return "note unavailable"
 

fukurou

the supreme coder
ADMIN
last working new ver:
Python:
class DiEvent(Skill):
    def __init__(self):
        super().__init__()
        self.event_hour = 19  # 7 PM
        self._claimed_diapered = False
        self._reminder_attempts = 0
        self._last_reminder_time = 0
        self._max_attempts = 3  # Max reminders per night
        self._min_reminder_gap = 120  # 2 minutes (minimum gap between reminders)
        self._random_delay = lambda: random.randint(120, 300)  # 2-5 minutes random delay

        # Responses (gentle -> firm)
        self.reminders = [
            "Sweetie, it’s nappy time. Go put on your diaper.",  # Gentle
            "You’ll sleep better in your diaper. Go put it on.",  # Neutral
            "Diaper up now, please. No arguments."  # Firm
        ]
        self.praises = [
            "Good job! You’ll feel safer now.",
            "Such a responsible little one. I’m proud of you.",
            "Now you can sleep without worries."
        ]
        self.negs = [
            "You didn’t have time to put it on yet. Try again.",
            "Nice try. I’m timing you. Go actually do it.",
            "You’re fibbing. I’ll know when you really do it."
        ]

    def set_event_hour(self, hour: int)->DiEvent:
        assert 0 <= hour < 24, "Hour must be 0-23"
        self.event_hour = hour
        return self

    def input(self, ear: str, skin: str, eye: str):
        current_hour = TimeUtils.getHoursAsInt()

        # Reset at midnight
        if current_hour == 0:
            self._claimed_diapered = False
            self._reminder_attempts = 0

        # Exit if not the right hour
        if current_hour != self.event_hour:
            return

        ear = ear.lower().strip()
        now = time.time()

        # Case 1: User claims compliance (check for lies)
        if "i put on my diaper" in ear or "i wore my nappy" in ear:
            if self._is_lying():
                self.setSimpleAlg(random.choice(self.negs))
            else:
                self._claimed_diapered = True
                self.setSimpleAlg(random.choice(self.praises))
            return

        # Case 2: Remind only if enough time passed
        if (
                not self._claimed_diapered
                and self._reminder_attempts < self._max_attempts
                and (now - self._last_reminder_time) >= self._min_reminder_gap
        ):
            self._reminder_attempts += 1
            self.setSimpleAlg(self.reminders[min(self._reminder_attempts - 1, len(self.reminders) - 1)])
            self._last_reminder_time = now
            # Randomize next reminder gap (2-5 mins)
            self._min_reminder_gap = self._random_delay()

    def _is_lying(self) -> bool:
        """Returns True if user claims compliance too fast (<30 seconds)."""
        return (time.time() - self._last_reminder_time) < 30

    def skillNotes(self, param: str) -> str:
        return {
            "notes": "Gentle but persistent diaper reminders at 19:00. Detects lies and praises compliance.",
            "triggers": "Phrases like 'i put on my diaper', 'i wore my nappy'."
        }.get(param, "note unavailable")
 

fukurou

the supreme coder
ADMIN
Python:
class DiEvent(Skill):
    def __init__(self):
        super().__init__()
        self.event_hour = 19  # 7 PM
        self._claimed_diapered = False
        self._reminder_attempts = 0
        self._refusal_count = 0
        self._last_reminder_time = 0
        self._last_refusal_time = 0
        self._max_attempts = 3  # Max reminders
        self._max_refusals = 3  # Max refusal responses
        self._min_reminder_gap = 120  # 2 minutes minimum between reminders
        self._random_delay = lambda: random.randint(120, 300)  # 2-5 mins randomized

        # Response banks
        self.reminders = [
            "Sweetie, it's nappy time. Go put on your diaper.",
            "You'll sleep better in your diaper. Go put it on.",
            "Diaper up now, please. No arguments."
        ]
        self.praises = [
            "Good job! You'll feel safer now.",
            "Such a responsible little one. I'm proud of you.",
            "Now you can sleep without worries."
        ]
        self.negs = [
            "You didn't have time to put it on yet. Try again.",
            "Nice try. I'm timing you. Go actually do it.",
            "You're fibbing. I'll know when you really do it."
        ]
        self.refusal_responses = [
            "It's for your own good, sweetie. You'll regret it later.",
            "This isn't negotiable. Put it on now.",
            "Fine. But don't come crying when you wake up wet."
        ]

    def set_event_hour(self, hour: int) ->DiEvent:
        assert 0 <= hour < 24, "Hour must be 0-23"
        self.event_hour = hour
        return self

    def _is_lying(self) -> bool:
        """Checks if compliance claim is implausibly fast (<30 seconds)."""
        return (time.time() - self._last_reminder_time) < 50

    def input(self, ear: str, skin: str, eye: str):
        current_hour = TimeUtils.getHoursAsInt()
        ear = ear.lower().strip()
        now = time.time()

        # Midnight reset
        if current_hour == 0:
            self._claimed_diapered = False
            self._reminder_attempts = 0
            self._refusal_count = 0

        # Exit if not event hour
        if current_hour != self.event_hour:
            return

        # Case 1: Handle outright refusal
        refusal_phrases = ["i won't", "i refuse", "not wearing", "no diaper"]
        if any(phrase in ear for phrase in refusal_phrases):
            if (now - self._last_refusal_time) > 60:  # Only count 1 refusal per minute
                self._refusal_count += 1
                self._last_refusal_time = now

            if self._refusal_count <= self._max_refusals:
                response = self.refusal_responses[min(self._refusal_count - 1, len(self.refusal_responses) - 1)]
                self.setSimpleAlg(response)
            else:
                self.setSimpleAlg("I've said my piece. Goodnight.")
            return

        # Case 2: Handle compliance claims
        compliance_phrases = ["i put on", "i wore", "diaper is on"]
        if any(phrase in ear for phrase in compliance_phrases):
            if self._is_lying():
                self.setSimpleAlg(random.choice(self.negs))
            else:
                self._claimed_diapered = True
                self.setSimpleAlg(random.choice(self.praises))
            return

        # Case 3: Send reminders (with cooldown)
        if (not self._claimed_diapered
                and self._reminder_attempts < self._max_attempts
                and (now - self._last_reminder_time) >= self._min_reminder_gap):
            self.setSimpleAlg(self.reminders[min(self._reminder_attempts, len(self.reminders) - 1)])
            self._reminder_attempts += 1
            self._last_reminder_time = now
            self._min_reminder_gap = self._random_delay()

    def skillNotes(self, param: str) -> str:
        return {
            "notes": "Handles diaper reminders with refusal detection and lie prevention.",
            "triggers": "Phrases like 'i won't wear', 'i put on my diaper'"
        }.get(param, "note unavailable")
 
Top