On 7/5/07, Diodeus <[EMAIL PROTECTED]> wrote:
>
> You could also change the list of droppables, so that the piece could
> simply not be dropped on an illegal square. You would have to fetch
> (or determine) the list of legal target squares before the move
> begins.
>

Which is pretty much where I was going with it.  The "revert=true"
doesn't have to be a boolean.  With newer versions of scriptaculous,
revert can be a generic function reference that does a check after the
movement stops.

http://wiki.script.aculo.us/scriptaculous/show/Draggable

You could also have your Ajax call return an array of "legal" moves
and create a droppable for each one?

For an even more fun approach, you could make your grid a bunch of
droppables - then change the 'accept' array in each box to only allow
certain pieces - sort of a grid-based vs a piece-based movement around
the board.

>
> It shouldn't matter whether I use ajax to verify the move or store the legal
> moves locally. The ajax verification happens pretty instantaneously
>

What if your chess game gets linked from Ajaxian.com, Digg or some
other high-traffic site? - are you sure you have the bandwidth to have
"instant" response from the call?

Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to