Re: How do you copy an array?



Dan Bensen wrote:

Kim Minh Kaplan wrote:

Usually you don't really need several nodes of the minimax tree at
once. Hence you don't need to copy your grid; just play and takeback
the moves as you traverse the tree.

Yes, I'm doing that. Iterating through the moves explicitly. But what
do "play" and "takeback" mean? I'm creating a new grid for each node,
otherwise how else do you pass all the previous moves to a child node?

First, the *child* node does not need the previous moves to do its job,
so do not pass it. It is the *parent* node that wants to know the
result of the minimax algorithm i.e. the outcome of the game: the list
of moves that will be played and the corresponding score¹. That
really means that minimax takes as input the only board and returns the
predicted list of moves and score.

As for the question of passing (really returning as I explained) a list
of moves you could choose whatever mean you want to represent a move
and a list of move but it seems that a Common Lisp list of (integer 1
9) fit the bill perfectly.

¹ Strictly speaking it does not need the score as it could be
calculated from the list of moves but as it has already been calculated
it is really better to return it.
--
Kim Minh.
http://www.kim-minh.com/

.



Relevant Pages

  • Locking of nodes in tree for concurrent access
    ... I'm working on a tree where the node classes store their child nodes ... Now I don't want to lock the entire tree when elements ... When I traverse down the tree I close each ... node's own read write lock when looking for the appropriate child node ...
    (comp.lang.java.programmer)
  • Re: Count all nodes in a treeview
    ... ItemIndex of the nodes in the tree. ... Parent Node: 0 ... Child Node: 0 ... a friend who codes in Delphi and has been using C# for quite a while. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Treeview saga continued
    ... The tree view control 'node click' events pass the node bing clicked into it ... child node and .Next returns the next node in line (use the .Next property ... > Also when I refer to the Parent property of a node that is ...
    (microsoft.public.access.formscoding)
  • Re: XML TreeNode.Parent property when using 2.0 TreeView?
    ... when a child node with the value of 'name' is selected ... Now the next mystery is how to determine *which* parent and child have been ... smartest way to identify the group of nodes in a tree or if there is some ... selected when the tree contains redundantly named instances. ...
    (microsoft.public.dotnet.xml)
  • Re: Review of Mueckenheims book.
    ... Then U) is not a tree, or at least is not a CIBT. ... it is only a failure of WM's models to represent infinite trees. ... Every partition of N into two subsets, ... child node and one right child node. ...
    (sci.math)