Re: AisleRiot: two new games



On Wed, 2005-09-07 at 23:37 -0500, Zachary Keene wrote:
>    I noticed that actually, but it didn't fix my problem (which 
> admittedly I had explained poorly in my original post.)
> 
>    Try this: start a new game, then play awhile until you replace some 
> card in the leftmost column with a two (which will then be locked into 
> place.) Hit undo a few times until the original card is back, then try 
> to move it somewhere. It'll be locked as if it were the two still in 
> that slot.

I see. The problem is the use of vector-set! In scheme names are bound
to variables: i.e. they are pointers. Normally they look like variables
because when you reassign them they point to a different object.
However, if you directly manipulate the object they refer to (as
vector-set! does) things get confused.

e.g.

(define a #(1 2))
(define b a)

a => #(1 2)
b => #(1 2)

(vector-set! a 0 2)

a => #(2 2)
b => #(2 2)

Because a and b refer to the same thing. 

The same problem would occur with lists if list-set! was used, but the
standard list idioms aren't prone to these problems. 

I'm not sure what a good answer is (to quote from the manual "... Guile
does not even contain procedures for copying vectors ...") but I'll see
what I can come up with.

 - Callum





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]