2 hours ago · 5 min read1035 words · Tech · hide · 0 comments

Hello, loves! Again with the weird hours! Elaborating an idea from a more civilized hour yesterday. Tout le monde déteste l’IA. Yesterday, the code for the QuestGiverDenizen included this definition of its state machine: self.transitions=dict( seeking=dict( has_item=dict(to='satisfied', hook=self.giving_action), no_item=dict(to='seeking', hook=self.seeking_action), ), satisfied=dict( has_item=dict(to='satisfied', hook=self.satisfied_action), no_item=dict(to='satisfied', hook=self.satisfied_action), ), ) I liked that and still do, but it’s not as communicative as one could imagine. So yesterday afternoon I did a spike that makes this test pass: def test_package(self): state = Machine( seeking = State( has_item = Event(to='satisfied', hook=self.hook_1), no_item = Event(to='seeking', hook=self.hook_2) ), satisfied = State( has_item = Event(to='satisfied', hook=self.hook_1), no_item = Event(to='satisfied', hook=self.hook_2) ) ) assert state.seeking.has_item.to == 'satisfied' assert…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.