Recent content by fukurou

  1. fukurou

    [MEDIA]

  2. fukurou

    🐍 python hp convo trigger

    class TrgHP: def __init__(self, low: int=-10, high: int=10, regen: int=5): self.hp = 4 self.low = low self.high = high self.regen: TrgEveryNMinutes = TrgEveryNMinutes(regen) self.hit: set[str] = {"shut up", "quiet", "be quiet", "silence"} def...
  3. fukurou

    👨‍💻 dev hawk tuah skill

    fruits = ["apple", "banana", "orange", "grape", "mango"] vegetables = ["carrot", "tomato", "cucumber", "onion", "pepper"] def contains_fruit_and_vegi(text: str) -> bool: text = text.lower() has_fruit = any(f in text for f in fruits) has_vegi = any(v in text for v in vegetables)...
  4. fukurou

    [MEDIA]

  5. fukurou

    [MEDIA]

  6. fukurou

    [MEDIA]

  7. fukurou

    👨‍💻 dev automata

    operations: dict[int, Callable[..., Any]]
  8. fukurou

    👨‍💻 dev automata

    from typing import Callable, Any operations: dict[int, Callable[..., Any]] = {}
  9. fukurou

    👨‍💻 dev automata

    from functools import partial class Calculator: def add(self, a, b): return a + b def sub(self, a, b): return a - b calc = Calculator() operations = { 1: partial(calc.add, 10, 3), # add(10, 3) 2: partial(calc.sub, 10, 3), # sub(10, 3) }...
  10. fukurou

    👨‍💻 dev automata

    class Calculator: def add(self, a, b): return a + b def sub(self, a, b): return a - b calc = Calculator() operations = { 1: calc.add, 2: calc.sub, } print(operations[1](10, 3)) # 13 print(operations[2](10, 3)) # 7
  11. fukurou

    👨‍💻 dev automata

    def greet(): print("Hello!") def farewell(): print("Goodbye!") def add(a, b): print(a + b) # Dictionary mapping int → function actions = { 1: greet, 2: farewell, 3: lambda: add(5, 7), # using a lambda wrapper } # Using the dictionary actions[1]() # calls greet()...
  12. fukurou

    [MEDIA]

  13. fukurou

    🐍 python once per hour

    from datetime import datetime class EveningGate: def __init__(self, hour=19): self.hour = hour self._triggered_today = False self._current_day = None def trigger(self): now = datetime.now() today = now.date() if...
  14. fukurou

    🐍 python once per hour

    from datetime import datetime class EveningGate: def __init__(self): self._triggered_today = False self._current_day = None def trigger(self): now = datetime.now() today = now.date() if self._current_day != today...
  15. fukurou

    AlgRelay

    class AlgRelay: def __init__(self): super().__init__() self.dic: dict[str, int] = {} # code 1: next mode # code 2: goal achieved # code 3: error/failure # code 4: empty str # code 5: any other str def add_next_mode(self, *keys: str) -> None: for key in keys...
Top