Page 1 of 1
Multiple decks & ordered discard pile
Posted: 19 April 2020, 14:53
by phranklon
I’m working on Hand & Foot, a variation of canasta. It calls for four decks.
What’s the easiest way to create a deck with four copies of each card?
Also, players are often able to draw from the top of the discard pile, (house rules debate if it’s the top 5 or top 7). The Cookbook talks about making a card sql table and mentions that most locations don’t need an order of cards their locations, but these would definitely need it. Also, when a player took the top 5 cards, could those entries in the dB in which these card were housed be able to be replaced/cleared?
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 15:49
by RicardoRix
If you're using the stand deck of cards BD table, then think you can use one of the fields for card_location_arg. You are also free to add new fields to this table.
-- card_id
-- card_type == CardSuit as in 'Heart', 'Spade'
-- card_type_arg == CardValue as in 'King'
-- card_location == 'hand', 'deck', etc..
-- card_location_arg == PlayerId: id of the location, so if it's in the hand of a player. ** Use this for played order when 'played'.
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 15:54
by tchobello
hi...
Have a look at Deck :
http://en.doc.boardgamearena.com/Deck
if you want 4 decks, 'nbr' is 4 like 4 instances of each card.
Code: Select all
// Create cards
$cards = array();
foreach( $this->colors as $color_id => $color ) // spade, heart, diamond, club
{
for( $value=2; $value<=14; $value++ ) // 2, 3, 4, ... K, A
{
$cards[] = array( 'type' => $color_id, 'type_arg' => $value, 'nbr' => 1);
}
}
$this->cards->createCards( $cards, 'deck' );
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 16:15
by apollo1001
Agree with the others:
Deck component (server side)
Stock component (client side)
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 16:47
by phranklon
Thank you all for the suggestions.

Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 17:02
by phranklon
Follow-up question,
And to add jokers to this deck, can I just make a separate img file and add those cards to the deck and stock? or would it be easier to modify the cards jpg to have jokers on a new row?
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 17:20
by Victoria_La
You should add the to existing jpg. Btw find something better than default one from hearts, this one really low res and not good overall
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 17:32
by phranklon
will do. gotta find a good one with creative commons. Any suggestions where to look?
Re: Multiple decks & ordered discard pile
Posted: 19 April 2020, 18:24
by Victoria_La
Re: Multiple decks & ordered discard pile
Posted: 20 April 2020, 05:36
by phranklon
Thank you for the link, I'll definitely use these. They look good.
So just to be clear what I am doing in terms of adding jokers...
When I create the stock using the jpg (in which the Jokers are alone on a 5th row in the same columns as the 2's and 3's), I still reference the entire row as having 13 images just like the first 4. However, since I will only list values 2 and 3 on the 5th row among the "create cards" coding in the game.php file, those blanks won't exist in my deck, right? If I am right, would anyone be so kind as to tell me if my game.php I created below is written correctly?
My stock code would look like this in .js:
Code: Select all
// Create cards types:
for (var color = 1; color <= 5; color++) {
for (var value = 2; value <= 14; value++) {
// Build card type id
var card_type_id = this.getCardUniqueId(color, value);
this.playerHand.addItemType(card_type_id, card_type_id, g_gamethemeurl + 'img/cards.jpg', card_type_id);
}
}
My game.php would look like this creating a deck with Jokers:
Code: Select all
// Create cards
$cards = array ();
for ($color = 1; $color <= 4; $color ++) {
// spade, heart, diamond, club
for ($value = 2; $value <= 14; $value ++) {
// 2, 3, 4, ... K, A
$cards [] = array ('type' => $color,'type_arg' => $value,'nbr' => 4 );
// 208 cards total 52 card deck times 4
}
}
for ($color = 5) {
//Joker "suit" (row on img file)
for ($value = 2; $value <= 3; $value ++) {
// red joker, black joker
$cards [] = array ('type' => $color, 'type_arg' => $value,'nbr' => 4 );
// 8 cards total: 4 red jokers, 4 black jokers
}
}
// 216 cards total
$this->cards->createCards( $cards, 'deck' );