Thanks for your input, I appreciate it. On Friday, April 20, 2012 10:16:51 AM UTC-5, kurtharriger wrote: > > And you just need to keep the resulting state, no need to reapply the > moves. > Your main method might use a reduce or loop recur. > > (loop [game (new-game)] > (if-not (complete? game) > (recur (make-random-move game))) >
The problem I have with this is that it does encapsulate game state completely, including input (the moves), but I want to just encapsulate board state. Imagine that the moves come from an external source, i.e. the web, my game state can't be stuck down in a function somewhere, the move is sent from the web, the game state is retrieved from somewhere (a session? a database?), and updated with the incoming move. I wasn't clear in stating my problem, but I want to decouple game state and board state for this reason. And because that's where I'm headed, it might make sense for me to approach this using atoms as others have suggested. I appreciate the different perspectives though, it's helping me understand! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en