Page 1 of 1

"pile" style Deck location

Posted: 16 December 2014, 18:38
by sparr
getCardOnTop( $location )
Get the card on top of the given ("pile" style) location
This "pile" concept is mentioned in a few places in the Deck documentation, and it's mentioned that the standard "deck" location is a pile, but I can't find any info on what, if anything, makes another location a "pile". One of the locations in my game is pile-like, and I'd like to keep cards in it in order, if possible.

Re: "pile" style Deck location

Posted: 05 July 2020, 18:31
by panyakali
I know that this post is *super* old, but I was actually just wondering the same thing... Can anyone help?

Re: "pile" style Deck location

Posted: 05 July 2020, 18:54
by Tisaac
I think any location is actually a pile but you must not use the location_arg that store the position of the card in the pile.

Re: "pile" style Deck location

Posted: 06 July 2020, 17:43
by Brainchild
That's my understanding too. As long as you don't change the location_arg, that location will behave as a pile. Each card in the pile will have an auto-incremented location_arg value that identifies where it is in the pile relative to the other cards.

Re: "pile" style Deck location

Posted: 06 July 2020, 18:35
by joezg
My understanding is similar.

When you shuffle the location, all items in that location get random int in location_arg which is order of cards in a pile.

I think that "pile" is just that: a location that has unique int in location_arg representing the order of items in that location. It is not important if the location was shuffled or not, but every item has to have unique int in location_arg.

Re: "pile" style Deck location

Posted: 06 July 2020, 19:39
by panyakali
OK, so, just to chime in here- from what I've discovered from fiddling around with BGA "Deck" methods, when you create a set of cards to go into a specific deck, they are *NOT* in a "pile" format by default. To get each element in the deck to have a unique location_arg, you must first call the shuffle('my_location_name') on the deck, and this will both shuffle the cards and turn the location into a "pile" deck.

Re: "pile" style Deck location

Posted: 06 July 2020, 23:30
by Brainchild
panyakali wrote: 06 July 2020, 19:39 OK, so, just to chime in here- from what I've discovered from fiddling around with BGA "Deck" methods, when you create a set of cards to go into a specific deck, they are *NOT* in a "pile" format by default. To get each element in the deck to have a unique location_arg, you must first call the shuffle('my_location_name') on the deck, and this will both shuffle the cards and turn the location into a "pile" deck.
I have not observed this behaviour in the game I'm implementing. I'm using a pile (unique location_arg for each card) and I never call shuffle(). I do however call insertCardOnExtremePosition() with a 'true' value for the third argument, which may be another way to trigger pile semantics.

Re: "pile" style Deck location

Posted: 07 July 2020, 01:36
by panyakali
I'm using a pile (unique location_arg for each card) and I never call shuffle(). I do however call insertCardOnExtremePosition() with a 'true' value for the third argument, which may be another way to trigger pile semantics.
Perhaps. When I'm making these new piles I use the typical array structure:

Code: Select all

array ('type' => $type,'type_arg' => $value,'nbr' => $nbr );
...and then I just call createCards without any bells and whistles:

Code: Select all

createCards( $card_creation_array, 'new_pile');
...so that may be it.

I'm still learning the framework- is insertCardOnExtremePosition typically a better way to go?

Re: "pile" style Deck location

Posted: 07 July 2020, 07:31
by Brainchild
panyakali wrote: 07 July 2020, 01:36 I'm still learning the framework- is insertCardOnExtremePosition typically a better way to go?
No, what you're doing is correct. I also call createCards() but for my game the deck order isn't important and each player starts with every card already in their hand anyway. It's a unique situation.