![AI hormone example. AH1 the first AI hormone for the livingrimoire Blond-anime-cyberpunk-girl-in-action-teen-style](https://i.ibb.co/L13xFmf/blond-anime-cyberpunk-girl-in-action-teen-style.jpg)
AI hormones exemplified with AH1
AH1 is an AI hormone. It is a special livingrimoire skill that can add or remove Skills.
Code:
from __future__ import annotations # for the builder pattern
from AXPython import TimeGate
from LivinGrimoire23 import Skill, Chobits
class AH1(Skill):
def __init__(self, chobit: Chobits):
super().__init__() # Call the parent class constructor
self._chobit: Chobits = chobit
self._isActive: bool = False
self._skills: list[Skill] = []
self._tg: TimeGate = TimeGate(5)
def input(self, ear, skin, eye):
# hormone trigger
if ear == "inject":
self._tg.openForPauseMinutes()
# equip skills if not already are
if not self._isActive:
self._chobit.addSkills(*self._skills)
self._isActive = True
self.setSimpleAlg("hormone engaged")
return
# hormone wear off event:
if self._isActive and self._tg.isClosed():
self._isActive = False
for skill in self._skills:
self._chobit.removeSkill(skill)
self.setSimpleAlg("hormone disengaged")
def add_skill(self, skill: Skill) -> AH1:
self._skills.append(skill)
return self
def add_skills(self, *skills: Skill) -> AH1:
for skill in skills:
self._skills.append(skill)
return self
def set_effect_duration(self, duration: int):
self._tg.setPause(duration)
Here are 2 ways to add it:
Code:
brain.add_skillAware(AH1(brain.logicChobit).add_skills(DiJokerV2(), DiBored()))
# brain.add_skillAware(AH1(brain.logicChobit).add_skill(DiJokerV2()).add_skill(DiFapHero()))
The AI hormone is constructed with a Chobit attribute.
The AI hormone is equipped with a bunch of Skills.
The AI hormone adds or removes said skills from the Chobit it is housed in based on the AI hormone's logic.
Each AI hormone has its own logic. In this example, when triggered, the skills attached to the AI hormone are active for only a set amount of time.
Dynamic skill management in the context of AI is the adding/removing of AI skills while the AI is running its code.
Merits:
1. Setting activation logic for skill bundles: time range, special activation or deactivation triggers, and such.
2. Efficiency, as only the required skills will be active.
3. Promote code readability, because bundled skill packs can focus on small aspects of skills. This can be triggered by specified input for adding/removing of skills (which is the AI hormone).