next question, friends! i have sequence of phases that happen "in order", which I've wired together normally. However, as this is a complex card game, various card effects can interrupt or change the order of those phases. For example, normally after the "approach server" phase, you "access cards" (sorry for terminology). However, a card effect says "the first time the "approach server" phase happens, move them back to the "approach ice" phase"
it's a state machine, but the available state machine tools that i've seen are a little more rigid than what I'm looking for
does anyone have experience rolling your own finite state machine for this purpose? I experimented with multimethods, but writing the dispatch felt awkward
should I just write a massive dispatch function that tries to take all of the exceptions into account?
ya know -- letfn
in conjunction with trampoline
is not a bad way to do it. Now -- I don't know how well that would work on the scale of a full game. But it works really well for simple state machines
if you happen to have a copy of "Joy of Clojure" they cover how to implement mutually recursive state machines with that technique
https://clojuredocs.org/clojure.core/trampoline#example-5552b71ee4b01ad59b65f4cf
(there's a link to the code from "Joy of Clojure")
this is a great reason to finally buy a copy! thank you, i'll check that out