"Jim - FooBar();" <[email protected]> writes:

Hi Jim,

> In other words, moves are also records that satisfy the Command
> protocol which says there should exist an "execute" and an "undo"
> method in all implementors...that way, each move knows how to execute
> itself but also how to undo itself and return to the starting
> position...As you said, I will need a way to try-out moves during the
> minimax/alpha-beta recursion in order to choose the best leaf node...

If everything was immutable, then you don't need undo.  You could try
out moves arbitrarily as long as you don't swap your world (game board)
with a new version of it.

> However changing a piece's position does not 'change the world' but
> rather builds a brand new one every time by looking at the pieces'
> positions... [...] I've got an atom holding the current-board

I don't get this.  If you have your current-board as an atom containing
a collection of pieces, and every piece's location can be mutated by
(updatePosition piece ...), then doing that does change the world, i.e.,
the location of piece changed without having swap!-ed the atom.

If the things you store in atoms or refs aren't immutable, then the
guarantees made by those reference types simply don't apply.

Bye,
Tassilo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to