Telling if a zone is empty or not...possible?

Hi all,

I have a module where at the beginning of each round several cards are laid out in a row, then the person whose turn it is can pick several cards from those shown.

At the end of his turn, the cards are all shifted to the left and new cards are placed to fill up the empty spots at the end.

What I would love to do is have a button on the main window that, when pressed, moves the cards to the left and then randomly draws cards from a deck on the same map and fills the empty spots in the row.

I don’t really want the cards to snap to a grid, as the scoring grids are all very close to the card row…well, if it was automated, this probably wouldn’t be an issue, so I guess I’m open to doing it either with the cards snapping to a grid or not.

What I can’t figure out is a way to tell Vassal, “Move this card to the left until you hit the last empty space, then stop”, and “Now place a card in a grid location or zone where no other cards are, but not in zones where other cards are placed”.

Any ideas?

Dave

Hi,

Is it important that the cards ‘move to the left’, or is it sufficient just to auto-deal to the empty slots?

Here is one idea to auto-deal to empty slots. It can be adapted to Zones or grids. Here is an example with Zones.

  1. Create a Zone over each card slot and give it a name (Say A, B, C, D, E)

  2. Create a Map Global property for each zone (call these A, B, etc.)

  3. Use an at-start stack to create an invisible, non-stacking piece in the middle of each Zone. Let’s call this the Control Piece.

Essentially, your redeal key will use a GlobalKeyCommand to send a command to each of the Control Pieces in turn to handle the redeal for it’s zone

Use a Trigger Action on the Control piece to the following in sequence:

a) Set the matching Global Property to 0

b) Use a Global Key Command to send a Key Command Ctrl-X to all normal Cards in this Zone. Command Ctrl-X on a normal command invoices a Set Global Property trait to add 1 to the Global Property that has the same name as the Zone the card is currently in ($CurrentZone$).

c) Set the name of the Zone (A) into the Global Property ‘Destination’

d) In Zone A, GlobalProperty $A$ will now be set to 0 depending on whether or not there is a card in the zone. Invoke another Trigger which checks this and if it is 0, then use a Global Key Command to send the comamnd Ctrl-Y to the top card in the Deck. Ctrl-Y on a normal command is a ‘Send to Location’ command with a destination of the named zone $Destination$.

That handles the dealing part.

If the order of the cards is not significant, then I would handle the shuffle left part by sending the remaining cards to a invisible, non-shuffling deck on the board, then sending them back out to the Zones using homing Send To Locations.

Hope that gives you some ideas,
Cheers,
Brent.

*********** REPLY SEPARATOR ***********

On 16/04/2008 at 9:13 PM Neumannium wrote:


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@uws.edu.au


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Actually, the cost for picking the cards decreases the farther to the left the cards are in the row, so the order of cards does matter.

That said, you’ve given me some great ideas here and I’ll see what I can create with this.

Thanks!

Dave