Re: How do you copy an array?
- From: "Kim Minh Kaplan" <kmkaplan@xxxxxxxxx>
- Date: 31 Aug 2006 05:29:01 -0700
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/
.
- Follow-Ups:
- Re: How do you copy an array?
- From: Dan Bensen
- Re: How do you copy an array?
- References:
- How do you copy an array?
- From: Dan Bensen
- Re: How do you copy an array?
- From: Raffael Cavallaro
- Re: How do you copy an array?
- From: Dan Bensen
- Re: How do you copy an array?
- From: Barry Margolin
- Re: How do you copy an array?
- From: Dan Bensen
- Re: How do you copy an array?
- From: Raffael Cavallaro
- Re: How do you copy an array?
- From: Dan Bensen
- Re: How do you copy an array?
- From: Kim Minh Kaplan
- Re: How do you copy an array?
- From: Dan Bensen
- How do you copy an array?
- Prev by Date: Re: best drink for programming
- Next by Date: Re: perceived efficiency
- Previous by thread: Re: How do you copy an array?
- Next by thread: Re: How do you copy an array?
- Index(es):
Relevant Pages
|