<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.doc.boardgamearena.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RavingWanderer</id>
	<title>Board Game Arena - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.doc.boardgamearena.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RavingWanderer"/>
	<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/Special:Contributions/RavingWanderer"/>
	<updated>2026-09-23T00:16:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=29087</id>
		<title>Gamehelphandandfoot</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=29087"/>
		<updated>2026-03-22T13:00:21Z</updated>

		<summary type="html">&lt;p&gt;RavingWanderer: de-emphasizing less common variants and those not available on BGA&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Hand and Foot&#039;&#039;&#039; is a traditional card game for 2 or more players, acting either individually or in teams.  It uses a large number of card decks (typically one or two more than the number of players), and is a rummy-style meld-building game based on Canasta.&lt;br /&gt;
[[Category:Card games]]&lt;br /&gt;
==Game duration and number of players==&lt;br /&gt;
A game is divided into &#039;&#039;rounds&#039;&#039;, each consisting of the play of one deal of cards.  Play can either be for a set number of rounds (typically 4), or until a team reaches a threshold score.  The team with the highest score wins the game.&lt;br /&gt;
&lt;br /&gt;
A typical four-round game with four players takes about two hours to complete when played in person. On BGA it is more typically 45 minutes to one hour.&lt;br /&gt;
&lt;br /&gt;
==Round setup==&lt;br /&gt;
Players are seated so that partners are opposite each other at the table.  If teams have more than two players, they are seated so team members are equidistant from each other.&lt;br /&gt;
&lt;br /&gt;
The number of decks used is typically one or two more than the number of players, with the jokers included.  For faster play, non-joker cards with proper card backs can also be mixed in; in BGA this is represented as allowing more than two joker per deck.  The decks are all shuffled together, and each player is dealt two piles of cards.  House rules differ on the number of cards: some dictate the piles are 11 cards, others say 13.  One pile is not looked at, and is the &#039;&#039;foot&#039;&#039;.  The other is picked up by the player and is the &#039;&#039;hand&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The undealt cards are stacked into a &#039;&#039;draw pile&#039;&#039;, while a &#039;&#039;discard pile&#039;&#039; is formed next to it to accumulated discarded cards.&lt;br /&gt;
&lt;br /&gt;
==Game objective==&lt;br /&gt;
&lt;br /&gt;
The objective of the game is to create &#039;&#039;melds&#039;&#039; consisting of 3-7 (or sometimes more, depending on house rules) cards of the same rank, possibly including &#039;&#039;wild cards&#039;&#039;.  Wild cards are deuces and jokers.  Melds of seven cards (or more) are considered to be &#039;&#039;complete&#039;&#039;, and may be referred to as &#039;&#039;books&#039;&#039;; bonuses are awarded for these melds.  Melds with less than 7 cards are considered &#039;&#039;open&#039;&#039;.  A book with no wild cards is considered &#039;&#039;clean&#039;&#039; or &#039;&#039;red&#039;&#039;, and will score a higher bonus than a &#039;&#039;dirty&#039;&#039; or &#039;&#039;black&#039;&#039; book, which has at least one wild card.  If the house rules allow or require, a meld of all wild cards may be formed, which will score an even higher bonus than clean books.  &lt;br /&gt;
&lt;br /&gt;
A team must reach a predetermined &#039;&#039;contract&#039;&#039; before a round can be ended.  The contract is typically for a set number of clean, dirty, and wild books, and is the same for each team and each round of play.  A common contract for teams of two is two each clean and dirty books.&lt;br /&gt;
&lt;br /&gt;
==Scoring and card valuation==&lt;br /&gt;
Cards are valued by their rank:&lt;br /&gt;
*Jokers are worth 50 points&lt;br /&gt;
*Aces and deuces are worth 20 points&lt;br /&gt;
*8 through King are worth 10 points&lt;br /&gt;
*4 through 7 are worth 5 points&lt;br /&gt;
The values of 3s depend on house rules.  In common variants, red 3s are worth either 100 or 300 points.  Black 3s are typically worth 5 points against you, and cannot be melded or taken from the top of the discard pile (but see [[#Taking the discard|Taking the discard]] below).  In some variants Black 3s count 100 points against you, and in others they can be melded, but still count againsts you.&lt;br /&gt;
&lt;br /&gt;
Cards played on the board are scored for the team, while those left in the hand (and foot) are scored against the team.&lt;br /&gt;
&lt;br /&gt;
===Going out and meld completion bonuses===&lt;br /&gt;
The team that goes out to end a round of play is awarded 100 or 200 points for doing so.  If the draw pile is exhausted, the round ends and no team gets this bonus.&lt;br /&gt;
&lt;br /&gt;
Meld bonuses are awarded when a meld reaches seven cards in length, and is denoted in the BGA version of the game by displaying the meld sideways.  The most common meld completion bonuses are:&lt;br /&gt;
* Clean books score 500&lt;br /&gt;
* Dirty books score 300&lt;br /&gt;
* Wild books score 1500&lt;br /&gt;
Less common scores (not available as options on BGA):&lt;br /&gt;
* Clean book of 7s scores 1500 &lt;br /&gt;
==Order of play==&lt;br /&gt;
* High card begins the play, or the player to the dealer&#039;s left begins&lt;br /&gt;
* Play goes clockwise around the table&lt;br /&gt;
* Play and Discard&lt;br /&gt;
* Either draw two cards, or take the discard (you cannot take the discard which consists of the top 3 cards if your team has not melded your initial meld (1st round-50pts) (2nd round (90 points) (3rd Round 120 points) ( 4th round 150 points)&lt;br /&gt;
* Optionally create new melds for the team, or play cards to existing team melds, assuming &#039;&#039;opening criteria&#039;&#039; are met&lt;br /&gt;
* If still holding cards, discard one to end play. &lt;br /&gt;
&lt;br /&gt;
If the player runs out of cards without discarding, they can pick their foot and immediately continue playing from it; this is called &#039;&#039;running to the foot&#039;&#039;.  If the player discards their last card, they can pick up their foot, but not play from it until their next turn; this is called &#039;&#039;walking&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The round ends when a team has completed the required contract, and one of its players plays out both their hand and their foot.  &lt;br /&gt;
&lt;br /&gt;
A team must meet certain criteria in order to open play on their board.  The requirement is that the opening player must put down cards with a minimum card point value, and typically varies by either which round of play (increasing with each successive round), or by the team&#039;s score.  The most common opening criteria are:&lt;br /&gt;
* Round 1: 50 points to open&lt;br /&gt;
* Round 2: 90 points to open&lt;br /&gt;
* Round 3: 120 points to open&lt;br /&gt;
* Round 4: 150 points to open&lt;br /&gt;
If a tie-breaking fifth round is needed, it will also require 150 points to open.  The point score does not include meld completion bonuses, or any played red 3s.  For example, a completed book of 5s scores 35 points, with a bonus of 500 points for being complete, but is insufficient to open even round 1.&lt;br /&gt;
&lt;br /&gt;
===Playing red 3s===&lt;br /&gt;
The most common game variants include the automatic play of red 3s. When it is a player&#039;s turn, any red 3s in the hand are played and replaced with new cards. This occurs *before* the player draws or takes the discard.  In discard-only variants, red 3s can only be discarded, and cannot be taken from the discard pile. &lt;br /&gt;
&lt;br /&gt;
===Drawing cards===&lt;br /&gt;
Draw 2 cards. After play discard 1 card. &lt;br /&gt;
&lt;br /&gt;
===Taking the discard===&lt;br /&gt;
If the player is allowed by the house rules, they may pick up the top discard.  Common house rules require the player to (1) have two cards of the same rank in their hand, and (2) be able to immediately play all three cards to the board.  Among other things, this means that their team either (a) has already opened its board, or (b) the player taking the discard can meet the opening criteria for the round.  It also means that the top card is not a black 3, or any other card where it is forbidden by house rules to take it.  (Some house variants forbid the taking of wild cards, and house rules requiring red 3s to be discarded also typically forbid their taking.)&lt;br /&gt;
&lt;br /&gt;
Once the player has taken and played the discard and associated meld cards, most rules require the taking of additional cards from the discard pile.  This is generally six cards, or the entire pile if it is less, but there are house rules that require the pile to have at least six more cards in it, or that require the taking of the entire discard pile in the manner of traditional Canasta rules.  A discard pile rich in black 3s can discourage the taking of discards.&lt;br /&gt;
&lt;br /&gt;
===Playing cards===&lt;br /&gt;
Playing cards to the board consists of selecting a group of matching cards (all of the same rank with optional wild cards), and clicking on either the &amp;quot;New Meld&amp;quot; panel or the meld of the given rank on the team&#039;s meld board.  If melds are limited in size, you will not be allowed to make a meld have more than seven cards.&lt;br /&gt;
&lt;br /&gt;
You can have only one meld of a given rank open at any time.  In order to create a meld, you must have at least three cards to play to it.  You must always have more non-wild than wild cards in a meld, and common house rules limit the number of wild cards in a completed meld to either 2 or 3.  The BGA version of the game enforces this by a &amp;quot;ratio rule&amp;quot;, requiring a certain percentage of the cards in a meld at any given time to be non-wild.&lt;br /&gt;
&lt;br /&gt;
The card plays you make (other than the required play of red 3s) are not shown to other players until one of several actions take place.  These actions include:&lt;br /&gt;
*Discarding to end your turn&lt;br /&gt;
*Playing out, either to end the round or to run to your foot&lt;br /&gt;
*Taking extra discards&lt;br /&gt;
&lt;br /&gt;
It is possible to &#039;&#039;undo&#039;&#039; moves up the last instance of one of these in your turn.  This may become necessary for three reasons.  First, if you attempt to open, but do not have sufficient points to make the opening criteria, you must undo your moves and make a discard instead.  Second, you cannot play the last card from your foot unless your team has made the contracted melds. The game will not allow you to play out, so you must undo your moves.  Third, if the game rules are that you must be able to play all your cards in your foot without a discard, but your last card is not playable. &lt;br /&gt;
&lt;br /&gt;
===Discarding===&lt;br /&gt;
To discard, select a single card, and place it  on the discard pile.  If it is the last card of your foot, you will not be allowed to discard it if your team does not have the contracted melds.  In that case, you will have to undo your moves, and play so as to have at least one card remaining in your hand after discarding.&lt;br /&gt;
&lt;br /&gt;
=== Permission to go out ===&lt;br /&gt;
If a player sees that they are able to go out, after drawing, the player may ask &amp;quot;Partner,may I go out?&amp;quot; The partner must answer &amp;quot;Yes&amp;quot; or &amp;quot;No,&amp;quot; and the answer is binding.&lt;br /&gt;
&lt;br /&gt;
==Round and game summaries==&lt;br /&gt;
At the end of each round, a scoring summary is prepared.  At the end of the game, the report includes all of the game rounds.&lt;/div&gt;</summary>
		<author><name>RavingWanderer</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Main_game_logic:_Game.php&amp;diff=5985</id>
		<title>Main game logic: Game.php</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Main_game_logic:_Game.php&amp;diff=5985"/>
		<updated>2020-10-27T14:32:56Z</updated>

		<summary type="html">&lt;p&gt;RavingWanderer: /* States functions */ add to checkAction which player is being checked&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
This is the main file for your game logic. Here you initialize the game, persist data, implement the rules and notify the client interface of changes.&lt;br /&gt;
&lt;br /&gt;
== File Structure ==&lt;br /&gt;
&lt;br /&gt;
The details of how the file is structured are described directly with comments in the code skeleton provided to you.&lt;br /&gt;
 &lt;br /&gt;
Here is the basic structure:&lt;br /&gt;
&lt;br /&gt;
* Constructor: where you define global variables.&lt;br /&gt;
* setupNewGame: initial setup of the game. Takes an array of players, indexed by player_id. Structure of each player is...?&lt;br /&gt;
* getAllDatas: where you retrieve all game data during a complete reload of the game.&lt;br /&gt;
* getGameProgression: where you compute the game progression indicator.&lt;br /&gt;
* Utility functions: your utility functions.&lt;br /&gt;
* Player actions: the entry points for players actions. &lt;br /&gt;
* Game state arguments: methods to return additional data on specific game states ([http://en.doc.boardgamearena.com/Your_game_state_machine:_states.inc.php#args more info here]).&lt;br /&gt;
* Game state actions: the logic to run when entering a new game state ([http://en.doc.boardgamearena.com/Your_game_state_machine:_states.inc.php#action more info here]).&lt;br /&gt;
* zombieTurn: what to do it&#039;s the turn of a zombie player.&lt;br /&gt;
* upgradeTableDb: function to migrate database if you change it after release on production.&lt;br /&gt;
&lt;br /&gt;
== Accessing player information ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: In the following methods, be mindful of the difference between the &amp;quot;active&amp;quot; player and the &amp;quot;current&amp;quot; player. The &#039;&#039;&#039;active&#039;&#039;&#039; player is the player whose turn it is - not necessarily the player who sent a request! The &#039;&#039;&#039;current&#039;&#039;&#039; player is the player who sent the request and will see the results returned by your methods: not necessarily the player whose turn it is!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; getPlayersNumber()&lt;br /&gt;
: Returns the number of players playing at the table&lt;br /&gt;
: Note: doesn&#039;t work in setupNewGame (use count($players) instead).&lt;br /&gt;
&lt;br /&gt;
; getActivePlayerId()&lt;br /&gt;
: Get the &amp;quot;active_player&amp;quot;, whatever what is the current state type.&lt;br /&gt;
: Note: it does NOT mean that this player is active right now, because state type could be &amp;quot;game&amp;quot; or &amp;quot;multiplayer&amp;quot;&lt;br /&gt;
: Note: avoid using this method in a &amp;quot;multiplayer&amp;quot; state because it does not mean anything.&lt;br /&gt;
&lt;br /&gt;
; getActivePlayerName()&lt;br /&gt;
: Get the &amp;quot;active_player&amp;quot; name&lt;br /&gt;
: Note: avoid using this method in a &amp;quot;multiplayer&amp;quot; state because it does not mean anything.&lt;br /&gt;
&lt;br /&gt;
; loadPlayersBasicInfos()&lt;br /&gt;
: Get an associative array with generic data about players (ie: not game specific data).&lt;br /&gt;
: The key of the associative array is the player id. The returned table is cached, so ok to call multiple times without performance concerns.&lt;br /&gt;
: The content of each value is:&lt;br /&gt;
: * player_name - the name of the player&lt;br /&gt;
: * player_color (ex: ff0000) - the color code of the player&lt;br /&gt;
: * player_no - the position of the player at the start of the game in natural table order, i.e. 1,2,3&lt;br /&gt;
&lt;br /&gt;
; getCurrentPlayerId()&lt;br /&gt;
: Get the &amp;quot;current_player&amp;quot;. The current player is the one from which the action originated (the one who sent the request).&lt;br /&gt;
: &#039;&#039;&#039;Be careful&#039;&#039;&#039;: This is not necessarily the active player!&lt;br /&gt;
: In general, you shouldn&#039;t use this method, unless you are in &amp;quot;multiplayer&amp;quot; state.&lt;br /&gt;
: &#039;&#039;&#039;Very important&#039;&#039;&#039;: in your setupNewGame and zombieTurn function, you must never use getCurrentPlayerId() or getCurrentPlayerName(), otherwise it will fail with a &amp;quot;Not logged&amp;quot; error message (these actions are triggered from the main site and propagated to the gameserver from a server, not from a browser. As a consequence, there is no current player associated to these actions).&lt;br /&gt;
&lt;br /&gt;
; getCurrentPlayerName()&lt;br /&gt;
: Get the &amp;quot;current_player&amp;quot; name&lt;br /&gt;
: Be careful using this method (see above).&lt;br /&gt;
&lt;br /&gt;
; getCurrentPlayerColor()&lt;br /&gt;
: Get the &amp;quot;current_player&amp;quot; color&lt;br /&gt;
: Be careful using this method (see above).&lt;br /&gt;
&lt;br /&gt;
; isCurrentPlayerZombie()&lt;br /&gt;
: Check the &amp;quot;current_player&amp;quot; zombie status. If true, player is zombie, i.e. left or was kicked out of the game.&lt;br /&gt;
&lt;br /&gt;
; getActivePlayerColor()&lt;br /&gt;
: This function does not seems to exist in API, if you need it here is implementation&lt;br /&gt;
      function getActivePlayerColor() {&lt;br /&gt;
        $player_id = self::getActivePlayer();&lt;br /&gt;
        $players = self::loadPlayersBasicInfos();&lt;br /&gt;
        if( isset( $players[ $player_id ]) )&lt;br /&gt;
            return $players[ $player_id ][&#039;player_color&#039;];&lt;br /&gt;
        else&lt;br /&gt;
            return null;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
== Accessing the database ==&lt;br /&gt;
&lt;br /&gt;
The main game logic should be the only point from which you should access the game database. You access your database using SQL queries with the methods below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
BGA uses [http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-transactions.html database transactions]. This means that your database changes WON&#039;T BE APPLIED to the database until your request ends normally (web request, not database request). Using transactions is in fact very useful for you; at any time, if your game logic detects that something is wrong (example: a disallowed move), you just have to throw an exception and all changes to the game situation will be removed. This also means that you need not (and in fact cannot) use your own transactions for multiple related database operations.&lt;br /&gt;
&lt;br /&gt;
; DbQuery( $sql )&lt;br /&gt;
: This is the generic method to access the database.&lt;br /&gt;
: It can execute any type of SELECT/UPDATE/DELETE/REPLACE/INSERT query on the database.&lt;br /&gt;
: You should use it for UPDATE/DELETE/REPLACE/INSERT queries. For SELECT queries, the specialized methods below are much better.&lt;br /&gt;
&lt;br /&gt;
; getUniqueValueFromDB( $sql )&lt;br /&gt;
: Returns a unique value from DB or null if no value is found.&lt;br /&gt;
: $sql must be a SELECT query.&lt;br /&gt;
: Raise an exception if more than 1 row is returned.&lt;br /&gt;
&lt;br /&gt;
; getCollectionFromDB( $sql, $bSingleValue=false )&lt;br /&gt;
: Returns an associative array of rows for a sql SELECT query.&lt;br /&gt;
: The key of the resulting associative array is the first field specified in the SELECT query.&lt;br /&gt;
: The value of the resulting associative array is an associative array with all the field specified in the SELECT query and associated values.&lt;br /&gt;
: First column must be a primary or alternate key.&lt;br /&gt;
: The resulting collection can be empty.&lt;br /&gt;
: If you specified $bSingleValue=true and if your SQL query request 2 fields A and B, the method returns an associative array &amp;quot;A=&amp;gt;B&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Example 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
self::getCollectionFromDB( &amp;quot;SELECT player_id id, player_name name, player_score score FROM player&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
Result:&lt;br /&gt;
array(&lt;br /&gt;
 1234 =&amp;gt; array( &#039;id&#039;=&amp;gt;1234, &#039;name&#039;=&amp;gt;&#039;myuser0&#039;, &#039;score&#039;=&amp;gt;1 ),&lt;br /&gt;
 1235 =&amp;gt; array( &#039;id&#039;=&amp;gt;1235, &#039;name&#039;=&amp;gt;&#039;myuser1&#039;, &#039;score&#039;=&amp;gt;0 )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Example 2:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
self::getCollectionFromDB( &amp;quot;SELECT player_id id, player_name name FROM player&amp;quot;, true );&lt;br /&gt;
&lt;br /&gt;
Result:&lt;br /&gt;
array(&lt;br /&gt;
 1234 =&amp;gt; &#039;myuser0&#039;,&lt;br /&gt;
 1235 =&amp;gt; &#039;myuser1&#039;&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; getNonEmptyCollectionFromDB( $sql )&lt;br /&gt;
: Idem than previous one, but raise an exception if the collection is empty&lt;br /&gt;
&lt;br /&gt;
; getObjectFromDB( $sql )&lt;br /&gt;
: Returns one row for the sql SELECT query as an associative array or null if there is no result&lt;br /&gt;
: Raise an exception if the query return more than one row&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
self::getObjectFromDB( &amp;quot;SELECT player_id id, player_name name, player_score score FROM player WHERE player_id=&#039;$player_id&#039;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
Result:&lt;br /&gt;
array(&lt;br /&gt;
  &#039;id&#039;=&amp;gt;1234, &#039;name&#039;=&amp;gt;&#039;myuser0&#039;, &#039;score&#039;=&amp;gt;1 &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; getNonEmptyObjectFromDB( $sql )&lt;br /&gt;
: Idem than previous one, but raise an exception if no row is found&lt;br /&gt;
&lt;br /&gt;
; getObjectListFromDB( $sql, $bUniqueValue=false )&lt;br /&gt;
: Return an array of rows for a sql SELECT query.&lt;br /&gt;
: the result if the same than &amp;quot;getCollectionFromDB&amp;quot; except that the result is a simple array (and not an associative array).&lt;br /&gt;
: The result can be empty.&lt;br /&gt;
: If you specified $bUniqueValue=true and if your SQL query request 1 field, the method returns directly an array of values.&lt;br /&gt;
&lt;br /&gt;
Example 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
self::getObjectListFromDB( &amp;quot;SELECT player_id id, player_name name, player_score score FROM player&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
Result:&lt;br /&gt;
array(&lt;br /&gt;
 array( &#039;id&#039;=&amp;gt;1234, &#039;name&#039;=&amp;gt;&#039;myuser0&#039;, &#039;score&#039;=&amp;gt;1 ),&lt;br /&gt;
 array( &#039;id&#039;=&amp;gt;1235, &#039;name&#039;=&amp;gt;&#039;myuser1&#039;, &#039;score&#039;=&amp;gt;0 )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Example 2:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
self::getObjectListFromDB( &amp;quot;SELECT player_name name FROM player&amp;quot;, true );&lt;br /&gt;
&lt;br /&gt;
Result:&lt;br /&gt;
array(&lt;br /&gt;
 &#039;myuser0&#039;,&lt;br /&gt;
 &#039;myuser1&#039;&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; getDoubleKeyCollectionFromDB( $sql, $bSingleValue=false )&lt;br /&gt;
: Return an associative array of associative array, from a SQL SELECT query.&lt;br /&gt;
: First array level correspond to first column specified in SQL query.&lt;br /&gt;
: Second array level correspond to second column specified in SQL query.&lt;br /&gt;
: If bSingleValue = true, keep only third column on result&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; DbGetLastId()&lt;br /&gt;
: Return the PRIMARY key of the last inserted row (see PHP mysql_insert_id function).&lt;br /&gt;
&lt;br /&gt;
; DbAffectedRow()&lt;br /&gt;
: Return the number of row affected by the last operation&lt;br /&gt;
&lt;br /&gt;
; escapeStringForDB( $string )&lt;br /&gt;
: You must use this function on every string type data in your database that contains unsafe data.&lt;br /&gt;
: (unsafe = can be modified by a player).&lt;br /&gt;
: This method makes sure that no SQL injection will be done through the string used.&lt;br /&gt;
: Note: if you using standard types in ajax actions, like AT_alphanum it is sanitized before arrival,&lt;br /&gt;
: this is only needed if you manage to get unchecked string, like in the games where user has to enter text as a response.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: see Editing [[Game database model: dbmodel.sql]] to know how to define your database model.&lt;br /&gt;
&lt;br /&gt;
== Use globals ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you want a single global integer value for your game, and you don&#039;t want to create a DB table specifically for it.&lt;br /&gt;
&lt;br /&gt;
You can do this with the BGA framework &amp;quot;global.&amp;quot; Your value will be stored in the &amp;quot;global&amp;quot; table in the database, and you can access it with simple methods.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;initGameStateLabels&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method should be located at the beginning of &#039;&#039;yourgamename.php.&#039;&#039; This is where you define the globals used in your game logic, by assigning them IDs.&lt;br /&gt;
&lt;br /&gt;
You can define up to 79 globals, with IDs from 10 to 89 (inclusive). You must &#039;&#039;&#039;not&#039;&#039;&#039; use globals outside this range, as those values are used by other components of the framework.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        self::initGameStateLabels( array( &lt;br /&gt;
                &amp;quot;my_first_global_variable&amp;quot; =&amp;gt; 10,&lt;br /&gt;
                &amp;quot;my_second_global_variable&amp;quot; =&amp;gt; 11&lt;br /&gt;
        ) );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;setGameStateInitialValue( $value_label, $value_value )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Initialize your global value. Must be called before any use of your global, so you should call this method from your &amp;quot;setupNewGame&amp;quot; method.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getGameStateValue( $value_label )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Retrieve the current value of a global.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;setGameStateValue( $value_label, $value_value )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the current value of a global.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;incGameStateValue( $value_label, $increment )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Increment the current value of a global. If increment is negative, decrement the value of the global.&lt;br /&gt;
&lt;br /&gt;
Return the final value of the global.&lt;br /&gt;
&lt;br /&gt;
== Game states and active players ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Activate player handling ===&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;activeNextPlayer()&lt;br /&gt;
: Make the next player active in the natural player order.&lt;br /&gt;
: Note: you CANNOT use this method in a &amp;quot;activeplayer&amp;quot; or &amp;quot;multipleactiveplayer&amp;quot; state. You must use a &amp;quot;game&amp;quot; type game state for this.&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;activePrevPlayer()&lt;br /&gt;
: Make the previous player active (in the natural player order).&lt;br /&gt;
: Note: you CANNOT use this method in a &amp;quot;activeplayer&amp;quot; or &amp;quot;multipleactiveplayer&amp;quot; state. You must use a &amp;quot;game&amp;quot; type game state for this.&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;changeActivePlayer( $player_id )&lt;br /&gt;
: You can call this method to make any player active.&lt;br /&gt;
: Note: you CANNOT use this method in a &amp;quot;activeplayer&amp;quot; or &amp;quot;multipleactiveplayer&amp;quot; state. You must use a &amp;quot;game&amp;quot; type game state for this.&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;getActivePlayerId()&lt;br /&gt;
: Return the &amp;quot;active_player&amp;quot; id&lt;br /&gt;
: Note: it does NOT mean that this player is active right now, because state type could be &amp;quot;game&amp;quot; or &amp;quot;multipleactiveplayer&amp;quot;&lt;br /&gt;
: Note: avoid using this method in a &amp;quot;multipleactiveplayer&amp;quot; state because it does not mean anything.&lt;br /&gt;
&lt;br /&gt;
=== Multiple activate player handling ===&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;setAllPlayersMultiactive()&lt;br /&gt;
: All playing players are made active. Update notification is sent to all players (triggers onUpdateActionButtons).&lt;br /&gt;
: Usually, you use this method at the beginning (ex: &amp;quot;st&amp;quot; action method) of a multiplayer game state when all players have to do some action. Do not use method if you going to do some more chages in active player list, i.e. if you want to take away multi-active right after, use setPlayersMultiactive instead.&lt;br /&gt;
&lt;br /&gt;
Example of usage:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    function st_MultiPlayerInit() {&lt;br /&gt;
        $this-&amp;gt;gamestate-&amp;gt;setAllPlayersMultiactive();&lt;br /&gt;
    }&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
And this is declaration of state:&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    2 =&amp;gt; array(&lt;br /&gt;
    		&amp;quot;name&amp;quot; =&amp;gt; &amp;quot;playerTurnPlace&amp;quot;,&lt;br /&gt;
    		&amp;quot;description&amp;quot; =&amp;gt; clienttranslate(&#039;Other player must place ships&#039;),&lt;br /&gt;
    		&amp;quot;descriptionmyturn&amp;quot; =&amp;gt; clienttranslate(&#039;${you} must place ships (click on YOUR SHIPS board to place)&#039;),&lt;br /&gt;
    		&amp;quot;type&amp;quot; =&amp;gt; &amp;quot;multipleactiveplayer&amp;quot;,&lt;br /&gt;
                &#039;action&#039; =&amp;gt; &#039;st_MultiPlayerInit&#039;,&lt;br /&gt;
                &#039;args&#039; =&amp;gt; &#039;arg_playerTurnPlace&#039;,&lt;br /&gt;
    	     	&amp;quot;possibleactions&amp;quot; =&amp;gt; array( &amp;quot;actionBla&amp;quot; ),&lt;br /&gt;
                &amp;quot;transitions&amp;quot; =&amp;gt; array( &amp;quot;next&amp;quot; =&amp;gt; 4, &amp;quot;last&amp;quot; =&amp;gt; 99)&lt;br /&gt;
    ),&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;setAllPlayersNonMultiactive( $next_state )&lt;br /&gt;
: All playing players are made inactive. Transition to next state&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;setPlayersMultiactive( $players, $next_state, $bExclusive = false )&lt;br /&gt;
: Make a specific list of players active during a multiactive gamestate. Update notification is sent to all players who&#039;s state changed.&lt;br /&gt;
: &amp;quot;players&amp;quot; is the array of player id that should be made active.&lt;br /&gt;
: If &amp;quot;exclusive&amp;quot; parameter is not set or false it doesn&#039;t deactivate other previously active players. If its set to true, the players who will be multiactive at the end are only these in &amp;quot;$players&amp;quot; array&lt;br /&gt;
&lt;br /&gt;
: In case &amp;quot;players&amp;quot; is empty, the method trigger the &amp;quot;next_state&amp;quot; transition to go to the next game state.&lt;br /&gt;
: returns true if state transition happened, false otherwise&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;setPlayerNonMultiactive( $player_id, $next_state )&lt;br /&gt;
: During a multiactive game state, make the specified player inactive.&lt;br /&gt;
: Usually, you call this method during a multiactive game state after a player did his action. It is also possible to call it directly from multiplayer action handler.&lt;br /&gt;
: If this player was the last active player, the method trigger the &amp;quot;next_state&amp;quot; transition to go to the next game state.&lt;br /&gt;
: returns true if state transition happened, false otherwise&lt;br /&gt;
Example of usage (see state declaration of playerTurnPlace above):&lt;br /&gt;
    &amp;lt;pre&amp;gt;&lt;br /&gt;
    function actionBla($args) {&lt;br /&gt;
        self::checkAction(&#039;actionBla&#039;);&lt;br /&gt;
        // handle the action using $this-&amp;gt;getCurrentPlayerId()&lt;br /&gt;
        $this-&amp;gt;gamestate-&amp;gt;setPlayerNonMultiactive( $this-&amp;gt;getCurrentPlayerId(), &#039;next&#039;);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;getActivePlayerList()&lt;br /&gt;
: With this method you can retrieve the list of the active player at any time.&lt;br /&gt;
: During a &amp;quot;game&amp;quot; type gamestate, it will return a void array.&lt;br /&gt;
: During a &amp;quot;activeplayer&amp;quot; type gamestate, it will return an array with one value (the active player id).&lt;br /&gt;
: During a &amp;quot;multipleactiveplayer&amp;quot; type gamestate, it will return an array of the active players id.&lt;br /&gt;
: Note: you should only use this method in the latter case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;  $this-&amp;gt;gamestate-&amp;gt;updateMultiactiveOrNextState( $next_state_if_none )&lt;br /&gt;
: Sends update notification about multiplayer changes. All multiactive set* functions above do that, however if you want to change state manually using db queries for complex calculations, you have to call this yourself after. Do not call this if you calling one of the other setters above.&lt;br /&gt;
Example: you have player teams and you want to activate all players in one team&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $sql = &amp;quot;UPDATE player SET player_is_multiactive=&#039;0&#039;&amp;quot;;&lt;br /&gt;
        self::DbQuery( $sql );&lt;br /&gt;
        $sql = &amp;quot;UPDATE player SET player_is_multiactive=&#039;1&#039; WHERE player_id=&#039;$player_id&#039; AND player_team=&#039;$team_no&#039;&amp;quot;;&lt;br /&gt;
        self::DbQuery( $sql );&lt;br /&gt;
        &lt;br /&gt;
        $this-&amp;gt;gamestate-&amp;gt;updateMultiactiveOrNextState( &#039;error&#039; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; updating database manually&lt;br /&gt;
: Use this helper function to change multiactive state without sending notification&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    /**&lt;br /&gt;
     * Changes values of multiactivity in db, does not sent notifications.&lt;br /&gt;
     * To send notifications after use updateMultiactiveOrNextState&lt;br /&gt;
     * @param number $player_id, player id &amp;lt;=0 or null - means ALL&lt;br /&gt;
     * @param number $value - 1 multiactive, 0 non multiactive&lt;br /&gt;
     */&lt;br /&gt;
    function dbSetPlayerMultiactive($player_id = -1, $value = 1) {&lt;br /&gt;
        if (! $value)&lt;br /&gt;
            $value = 0;&lt;br /&gt;
        else&lt;br /&gt;
            $value = 1;&lt;br /&gt;
        $sql = &amp;quot;UPDATE player SET player_is_multiactive = &#039;$value&#039; WHERE player_zombie = 0 and player_eliminated = 0&amp;quot;;&lt;br /&gt;
        if ($player_id &amp;gt; 0) {&lt;br /&gt;
            $sql .= &amp;quot; AND player_id = $player_id&amp;quot;;&lt;br /&gt;
        }&lt;br /&gt;
        self::DbQuery($sql);&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== States functions ===&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;nextState( $transition )&lt;br /&gt;
: Change current state to a new state. Important: the $transition parameter is the name of the transition, and NOT the name of the target game state, see [[Your game state machine: states.inc.php]] for more information about states.&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;checkAction( $actionName, $bThrowException=true )&lt;br /&gt;
: Check if the current player can perform a specific action in the current game state, and optionally throw an exception if they can&#039;t.&lt;br /&gt;
: The action is valid if it is listed in the &amp;quot;possibleactions&amp;quot; array for the current game state (see game state description).&lt;br /&gt;
: This method MUST be the first one called in ALL your PHP methods that handle player actions, in order to make sure a player doesn&#039;t perform an action not allowed by the rules at the point in the game.  It should not be called from methods where the current player is not necessarily the active player, otherwise it may fail with an &amp;quot;It is not your turn&amp;quot; exception.&lt;br /&gt;
: If &amp;quot;bThrowException&amp;quot; is set to &amp;quot;false&amp;quot;, the function returns &#039;&#039;&#039;false&#039;&#039;&#039; in case of failure instead of throwing an exception. This is useful when several actions are possible, in order to test each of them without throwing exceptions.&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;checkPossibleAction( $action )&lt;br /&gt;
: (rarely used)&lt;br /&gt;
: This works exactly like &amp;quot;checkAction&amp;quot; (above), except that it does NOT check if the current player is active.&lt;br /&gt;
: This is used specifically in certain game states when you want to authorize additional actions for players that are not active at the moment.&lt;br /&gt;
: Example: in &#039;&#039;Libertalia&#039;&#039;, you want to authorize players to change their mind about the card played. They are of course not active at the time they change their mind, so you cannot use &amp;quot;checkAction&amp;quot;; use &amp;quot;checkPossibleAction&amp;quot; instead.&lt;br /&gt;
&lt;br /&gt;
This is how PHP action looks that returns player to active state (only for multiplayeractive states). To be able to execute on js side do not checkAction on js side for this specific one.&lt;br /&gt;
&lt;br /&gt;
   function actionUnpass() {&lt;br /&gt;
        $this-&amp;gt;gamestate-&amp;gt;checkPossibleAction(&#039;actionUnpass&#039;); // player chane mind about passing while others were thinking&lt;br /&gt;
        $this-&amp;gt;gamestate-&amp;gt;setPlayersMultiactive(array ($this-&amp;gt;getCurrentPlayerId() ), &#039;error&#039;, false);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
; $this-&amp;gt;gamestate-&amp;gt;state()&lt;br /&gt;
: Get an associative array of current game state attributes, see [[Your game state machine: states.inc.php]] for state attributes.&lt;br /&gt;
  $state=$this-&amp;gt;gamestate-&amp;gt;state(); if( $state[&#039;name&#039;] == &#039;myGameState&#039; ) {...}&lt;br /&gt;
&lt;br /&gt;
== Players turn order ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getNextPlayerTable()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return an associative array which associate each player with the next player around the table.&lt;br /&gt;
&lt;br /&gt;
In addition, key 0 is associated to the first player to play.&lt;br /&gt;
&lt;br /&gt;
Example: if three player with ID 1, 2 and 3 are around the table, in this order, the method returns:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   array( &lt;br /&gt;
    1 =&amp;gt; 2, &lt;br /&gt;
    2 =&amp;gt; 3, &lt;br /&gt;
    3 =&amp;gt; 1, &lt;br /&gt;
    0 =&amp;gt; 1 &lt;br /&gt;
   );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPrevPlayerTable()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Same as above, but the associative array associate the previous player around the table. Here seems also the &amp;quot;0&amp;quot; missing.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPlayerAfter( $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get player playing after given player in natural playing order.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPlayerBefore( $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get player playing before given player in natural playing order.&lt;br /&gt;
&lt;br /&gt;
Note: There is no API to modify this order, if you have custom player order you have to maintain it in your database&lt;br /&gt;
and have custom function to access it.&lt;br /&gt;
&lt;br /&gt;
== Notify players ==&lt;br /&gt;
&lt;br /&gt;
To understand notifications, please read [http://www.slideshare.net/boardgamearena/the-bga-framework-at-a-glance The BGA Framework at a glance] first.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Notifications are sent at the very end of the request, when it ends normally. It means that if you throw an exception for any reason (ex: move not allowed), no notifications will be sent to players.&lt;br /&gt;
Notifications sent between the game start (setupNewGame) and the end of the &amp;quot;action&amp;quot; method of the first active state will never reach their destination.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;notifyAllPlayers( $notification_type, $notification_log, $notification_args )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Send a notification to all players of the game.&lt;br /&gt;
&lt;br /&gt;
* notification_type:&lt;br /&gt;
A string that defines the type of your notification.&lt;br /&gt;
&lt;br /&gt;
Your game interface Javascript logic will use this to know what is the type of the received notification (and to trigger the corresponding method).&lt;br /&gt;
&lt;br /&gt;
* notification_log:&lt;br /&gt;
A string that defines what is to be displayed in the game log.&lt;br /&gt;
&lt;br /&gt;
You can use an empty string here (&amp;quot;&amp;quot;). In this case, nothing is displayed in the game log.&lt;br /&gt;
&lt;br /&gt;
If you define a real string here, you should use &amp;quot;clienttranslate&amp;quot; method to make sure it can be translate.&lt;br /&gt;
&lt;br /&gt;
You can use arguments in your notification_log strings, that refers to values defines in the &amp;quot;notification_args&amp;quot; argument (see below). &lt;br /&gt;
Note: Make sure you only use single quotes (&#039;), otherwise PHP will try to interpolate the variable and will ignore the values in the args array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* notification_args:&lt;br /&gt;
The arguments of your notifications, as an associative array.&lt;br /&gt;
&lt;br /&gt;
This array will be transmitted to the game interface logic, in order the game interface can be updated.&lt;br /&gt;
&lt;br /&gt;
Complete notifyAllPlayers example (from &amp;quot;Reversi&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
self::notifyAllPlayers( &amp;quot;playDisc&amp;quot;, clienttranslate( &#039;${player_name} plays a disc and turns over ${returned_nbr} disc(s)&#039; ),&lt;br /&gt;
 array(&lt;br /&gt;
        &#039;player_id&#039; =&amp;gt; $player_id,&lt;br /&gt;
        &#039;player_name&#039; =&amp;gt; self::getActivePlayerName(),&lt;br /&gt;
        &#039;returned_nbr&#039; =&amp;gt; count( $turnedOverDiscs ),&lt;br /&gt;
        &#039;x&#039; =&amp;gt; $x,&lt;br /&gt;
        &#039;y&#039; =&amp;gt; $y&lt;br /&gt;
     ) );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see in the example above the use of the &amp;quot;clienttranslate&amp;quot; method, and the use of 2 arguments &amp;quot;player_name&amp;quot; and &amp;quot;returned_nbr&amp;quot; in the notification log.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: NO private data must be sent with this method, as a cheater could see it even it is not used explicitly by the game interface logic. If you want to send private information to a player, please use notifyPlayer below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: this array is serialized to be sent to the browsers, and will be saved with the notification to be able to replay the game later. If it is too big, it can make notifications slower / less reliable, and replay archives very big (to the point of failing). So as a general rule, you should send only the minimum of information necessary to update the client interface with no overhead in order to keep the notifications as light as possible.&lt;br /&gt;
&lt;br /&gt;
Note: you CAN use some HTML inside your notification log, however it not recommended for many reasons:&lt;br /&gt;
* Its bad architecture, ui elements leak into server now you have to manage ui in many places&lt;br /&gt;
* If you decided to change something in ui in future version, old games reply and tutorials may not work, since they use stored notifications&lt;br /&gt;
* When you read log preview for old games its unreadable (this is log before you enter the game reply, useful for troubleshooting or game analysis)&lt;br /&gt;
* Its more data to transfer and store in db&lt;br /&gt;
* Its nightmare for translators, at least don&#039;t put HTML tags inside the &amp;quot;clienttranslate&amp;quot; method. You can use a notification argument instead, and provide your HTML through this argument.&lt;br /&gt;
&lt;br /&gt;
If you still want to have pretty pictures in the log check this [[BGA_Studio_Cookbook#Inject_images_and_styled_html_in_the_log]].&lt;br /&gt;
&lt;br /&gt;
If your notification contains some phrases that build programmatically you may need to use recursive notifications. In this case the argument can be not only the string but&lt;br /&gt;
an array itself, which contains &#039;log&#039; and &#039;args&#039;, i.e.&lt;br /&gt;
&lt;br /&gt;
  $this-&amp;gt;notifyAllPlayers(&#039;playerLog&#039;,clienttranslate(&#039;Game moves ${token_name_rec}&#039;),&lt;br /&gt;
                   [&#039;token_name_rec&#039;=&amp;gt;[&#039;log&#039;=&amp;gt;&#039;${token_name} #${token_number}&#039;,&lt;br /&gt;
                                       &#039;args&#039;=&amp;gt; [&#039;token_name&#039;=&amp;gt;clienttranslate(&#039;Boo&#039;), &#039;token_number&#039;=&amp;gt;$number, &#039;i18n&#039;=&amp;gt;[&#039;token_name&#039;] ]&lt;br /&gt;
                                      ]&lt;br /&gt;
                   ]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;notifyPlayer( $player_id, $notification_type, $notification_log, $notification_args )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Same as above, except that the notification is sent to one player only.&lt;br /&gt;
&lt;br /&gt;
This method must be used each time some private information must be transmitted to a player.&lt;br /&gt;
&lt;br /&gt;
Important: the variable for player name must be ${player_name} in order to be highlighted with the player color in the game log&lt;br /&gt;
&lt;br /&gt;
== About random and randomness ==&lt;br /&gt;
&lt;br /&gt;
A large number of board games rely on random, most often based on dice, cards shuffling, picking some item in a bag, and so on. This is very important to ensure a high level of randomness for each of these situations.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s are a list of techniques you should use in these situations, from the best to the worst.&lt;br /&gt;
&lt;br /&gt;
=== Dice and bga_rand ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;bga_rand( min, max )&#039;&#039;&#039; &lt;br /&gt;
This is a BGA framework function that provides you a random number between &amp;quot;min&amp;quot; and &amp;quot;max&amp;quot; (inclusive), using the best available random method available on the system.&lt;br /&gt;
&lt;br /&gt;
This is the preferred function you should use, because we are updating it when a better method is introduced.&lt;br /&gt;
&lt;br /&gt;
As of now, bga_rand is based on the PHP function &amp;quot;random_int&amp;quot;, which ensures a cryptographic level of randomness.&lt;br /&gt;
&lt;br /&gt;
In particular, it is &#039;&#039;&#039;mandatory&#039;&#039;&#039; to use it for all &#039;&#039;&#039;dice throw&#039;&#039;&#039; (ie: games using other methods for dice throwing will be rejected by BGA during review).&lt;br /&gt;
&lt;br /&gt;
Note: rand() and mt_rand() are deprecated on BGA and should not be used anymore, as their randomness is not as good as &amp;quot;bga_rand&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== shuffle and cards shuffling ===&lt;br /&gt;
&lt;br /&gt;
To shuffle items, like a pile of cards, the best way is to use the BGA PHP [[Deck]] component and to use &amp;quot;shuffle&amp;quot; method. This ensures that the best available shuffling method is used, and that if in the future we improve it your game will be up to date.&lt;br /&gt;
&lt;br /&gt;
As of now, the Deck component shuffle method is based on PHP &amp;quot;shuffle&amp;quot; method, which has quite good randomness (even it is not as good as bga_rand). In consequence, we accept other shuffling methods during reviews, as long as they are based on PHP &amp;quot;shuffle&amp;quot; function (or similar, like &amp;quot;array_rand&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
=== Other methods ===&lt;br /&gt;
&lt;br /&gt;
Mysql &amp;quot;RAND()&amp;quot; function has not enough randomness to be a valid method to get a random element on BGA. This function has been used in some existing games and has given acceptable results, but now it should be avoided and you should use other methods instead.&lt;br /&gt;
&lt;br /&gt;
== Game statistics ==&lt;br /&gt;
&lt;br /&gt;
There are 2 types of statistics:&lt;br /&gt;
* a &amp;quot;player&amp;quot; statistic is a statistic associated to a player&lt;br /&gt;
* a &amp;quot;table&amp;quot; statistic is a statistic not associated to a player (global statistic for this game).&lt;br /&gt;
&lt;br /&gt;
See [[Game statistics: stats.inc.php]] to see how you define statistics for your game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;initStat( $table_or_player, $name, $value, $player_id = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create a statistic entry with a default value.&lt;br /&gt;
&lt;br /&gt;
This method must be called for each statistic of your game, in your setupNewGame method.&lt;br /&gt;
If you neglect to call this for a statistic, and also do not update the value during the course of a certain game using setStat or incStat, the value of the stat will be undefined rather than 0. This will result in it being ignored at the end of the game, as if it didn&#039;t apply to that particular game, and excluded from cumulative statistics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;$table_or_player&#039; must be set to &amp;quot;table&amp;quot; if this is a table statistic, or &amp;quot;player&amp;quot; if this is a player statistic.&lt;br /&gt;
&lt;br /&gt;
&#039;$name&#039; is the name of your statistic, as it has been defined in your stats.inc.php file.&lt;br /&gt;
&lt;br /&gt;
&#039;$value&#039; is the initial value of the statistic. If this is a player statistic and if the player is not specified by &amp;quot;$player_id&amp;quot; argument, the value is set for ALL players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;setStat( $value, $name, $player_id = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set a statistic $name to $value.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;$player_id&amp;quot; is not specified, setStat consider it is a TABLE statistic.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;$player_id&amp;quot; is specified, setStat consider it is a PLAYER statistic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;incStat( $delta, $name, $player_id = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Increment (or decrement) specified statistic value by $delta value. Same behavior as setStat function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getStat( $name, $player_id = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the value of statistic specified by $name. Useful when creating derivative statistics such as average.&lt;br /&gt;
&lt;br /&gt;
== Translations ==&lt;br /&gt;
&lt;br /&gt;
See [[Translations]]&lt;br /&gt;
&lt;br /&gt;
== Manage player scores and Tie breaker ==&lt;br /&gt;
&lt;br /&gt;
=== Normal scoring ===&lt;br /&gt;
&lt;br /&gt;
At the end of the game, players automatically get a rank depending on their score: the player with the biggest score is #1, the player with the second biggest score is #2, and so on...&lt;br /&gt;
&lt;br /&gt;
During the game, you update player&#039;s score directly by updating &amp;quot;player_score&amp;quot; field of &amp;quot;player&amp;quot; table in database.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  // +2 points to active player&lt;br /&gt;
  self::DbQuery( &amp;quot;UPDATE player SET player_score=player_score+2 WHERE player_id=&#039;&amp;quot;.self::getActivePlayerId().&amp;quot;&#039;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
  // Set score of active player to 5&lt;br /&gt;
  self::DbQuery( &amp;quot;UPDATE player SET player_score=5 WHERE player_id=&#039;&amp;quot;.self::getActivePlayerId().&amp;quot;&#039;&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: don&#039;t forget to notify the client side in order the score control can be updated accordingly.&lt;br /&gt;
&lt;br /&gt;
=== Tie breaker ===&lt;br /&gt;
&lt;br /&gt;
Tie breaker is used when two players get the same score at the end of a game.&lt;br /&gt;
&lt;br /&gt;
Tie breaker is using &amp;quot;player_score_aux&amp;quot; field of &amp;quot;player&amp;quot; table. It is updated exactly like the &amp;quot;player_score&amp;quot; field.&lt;br /&gt;
&lt;br /&gt;
Tie breaker score is displayed only for players who are tied at the end of the game. Most of the time, it is not supposed to be displayed explicitly during the game.&lt;br /&gt;
&lt;br /&gt;
When you are using &amp;quot;player_score_aux&amp;quot; functionality, you must describe the formula to use in your gameinfos.inc.php file like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         &#039;tie_breaker_description&#039; =&amp;gt; totranslate(&amp;quot;Describe here your tie breaker formula&amp;quot;),&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This description will be used as a tooltip to explain to players how this auxiliary score has been calculated.&lt;br /&gt;
&lt;br /&gt;
=== Co-operative game ===&lt;br /&gt;
&lt;br /&gt;
To make everyone win/lose together in a full-coop game:&lt;br /&gt;
&lt;br /&gt;
Add the following in gameinfos.inc.php :&lt;br /&gt;
&#039;is_coop&#039; =&amp;gt; 1, // full cooperative&lt;br /&gt;
&lt;br /&gt;
Assign a score of zero to everyone if it&#039;s a loss.&lt;br /&gt;
Assign the same score &amp;gt; 0 to everyone if it&#039;s a win.&lt;br /&gt;
&lt;br /&gt;
=== Semi-coop ===&lt;br /&gt;
&lt;br /&gt;
If the game is not full-coop, then everyone loses = everyone is tied. I.e. set score to 0 to everybody.&lt;br /&gt;
&lt;br /&gt;
=== Only &amp;quot;winners&amp;quot; and &amp;quot;losers&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
For some games, there is only a group (or a single) &amp;quot;winner&amp;quot;, and everyone else is a &amp;quot;loser&amp;quot;, with no &amp;quot;end of game rank&amp;quot; (1st, 2nd, 3rd...).&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* Coup&lt;br /&gt;
* Not Alone&lt;br /&gt;
* Werewolves&lt;br /&gt;
* Quantum&lt;br /&gt;
&lt;br /&gt;
In this case:&lt;br /&gt;
* Set the scores so that the winner has the best score, and the other players have the same (lower) score.&lt;br /&gt;
* Add the following lines to gameinfos.php:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// If in the game, all losers are equal (no score to rank them or explicit in the rules that losers are not ranked between them), set this to true &lt;br /&gt;
// The game end result will display &amp;quot;Winner&amp;quot; for the 1st player and &amp;quot;Loser&amp;quot; for all other players&lt;br /&gt;
&#039;losers_not_ranked&#039; =&amp;gt; true,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Werewolves and Coup are implemented like this, as you can see here:&lt;br /&gt;
* https://boardgamearena.com/#!gamepanel?game=werewolves&amp;amp;section=lastresults&lt;br /&gt;
* https://boardgamearena.com/#!gamepanel?game=coupcitystate&amp;amp;section=lastresults&lt;br /&gt;
&lt;br /&gt;
Adding this has the following effects:&lt;br /&gt;
* On game results for this game, &amp;quot;Winner&amp;quot; or &amp;quot;Loser&amp;quot; is going to appear instead of the usual &amp;quot;1st, 2nd, 3rd, ...&amp;quot;.&lt;br /&gt;
* When a game is over, the result of the game will be &amp;quot;End of game: Victory&amp;quot; or &amp;quot;End of game: Defeat&amp;quot; depending on the result of the CURRENT player (instead of the usual &amp;quot;Victory of XXX&amp;quot;).&lt;br /&gt;
* When calculating ELO points, if there is at least one &amp;quot;Loser&amp;quot;, no &amp;quot;victorious&amp;quot; player can lose ELO points, and no &amp;quot;losing&amp;quot; player can win ELO point. Usually it may happened because being tie with many players with a low rank is considered as a tie and may cost you points. If losers_not_ranked is set, we prevent this behavior and make sure you only gain/loss ELO when you get the corresponding results.&lt;br /&gt;
&lt;br /&gt;
Important: this SHOULD NOT be used for cooperative games (see is_coop parameter), or for 2 players games (it makes no sense in this case).&lt;br /&gt;
&lt;br /&gt;
=== Solo ===&lt;br /&gt;
&lt;br /&gt;
If game supports solo variant, a negative or zero score means defeat, a positive score means victory.&lt;br /&gt;
&lt;br /&gt;
=== Player elimination ===&lt;br /&gt;
&lt;br /&gt;
In some games, this is useful to eliminate a player from the game in order he/she can start another game without waiting for the current game end.&lt;br /&gt;
&lt;br /&gt;
This case should be rare. Please don&#039;t use player elimination feature if some player just has to wait the last 10% of the game for game end. This feature should be used only in games where players are eliminated all along the game (typical examples: &amp;quot;Perudo&amp;quot; or &amp;quot;The Werewolves of Miller&#039;s Hollow&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;br /&gt;
* Player to eliminate should NOT be active anymore (preferably use the feature in a &amp;quot;game&amp;quot; type game state).&lt;br /&gt;
* In your PHP code:&lt;br /&gt;
  self::eliminatePlayer( &amp;lt;player_to_eliminate_id&amp;gt; );&lt;br /&gt;
* the player is informed in a dialog box that he no longer have to played and can start another game if he/she wants too (whith buttons &amp;quot;stay at this table&amp;quot; &amp;quot;quit table and back to main site&amp;quot;). In any case, the player is free to start &amp;amp; join another table from now.&lt;br /&gt;
* When your game is over, all players who have been eliminated before receive a &amp;quot;notification&amp;quot; (the small &amp;quot;!&amp;quot; icon on the top right of the BGA interface) that indicate them that &amp;quot;the game has ended&amp;quot; and invite them to review the game results.&lt;br /&gt;
&lt;br /&gt;
=== Scoring Helper functions ===&lt;br /&gt;
&lt;br /&gt;
These functions should have been API but they are not, just add them to your php game and use for every game.&lt;br /&gt;
&lt;br /&gt;
    // get score&lt;br /&gt;
    function dbGetScore($player_id) {&lt;br /&gt;
        return $this-&amp;gt;getUniqueValueFromDB(&amp;quot;SELECT player_score FROM player WHERE player_id=&#039;$player_id&#039;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // set score&lt;br /&gt;
    function dbSetScore($player_id, $count) {&lt;br /&gt;
        $this-&amp;gt;DbQuery(&amp;quot;UPDATE player SET player_score=&#039;$count&#039; WHERE player_id=&#039;$player_id&#039;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // set aux score (tie breaker)&lt;br /&gt;
    function dbSetAuxScore($player_id, $score) {&lt;br /&gt;
        $this-&amp;gt;DbQuery(&amp;quot;UPDATE player SET player_score_aux=$score WHERE player_id=&#039;$player_id&#039;&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // increment score (can be negative too)&lt;br /&gt;
    function dbIncScore($player_id, $inc) {&lt;br /&gt;
        $count = $this-&amp;gt;dbGetScore($player_id);&lt;br /&gt;
        if ($inc != 0) {&lt;br /&gt;
            $count += $inc;&lt;br /&gt;
            $this-&amp;gt;dbSetScore($player_id, $count);&lt;br /&gt;
        }&lt;br /&gt;
        return $count;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
== Reflexion time ==&lt;br /&gt;
&lt;br /&gt;
; function giveExtraTime( $player_id, $specific_time=null )&lt;br /&gt;
: Give standard extra time to this player.&lt;br /&gt;
: Standard extra time depends on the speed of the game (small with &amp;quot;slow&amp;quot; game option, bigger with other options).&lt;br /&gt;
: You can also specify an exact time to add, in seconds, with the &amp;quot;specified_time&amp;quot; argument (rarely used).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Undo moves ==&lt;br /&gt;
&lt;br /&gt;
Please read our [[BGA Undo policy]] before.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: Before using these methods, you must also add the following to your &amp;quot;gameinfos.inc.php&amp;quot; file, otherwise these methods are ineffective:&lt;br /&gt;
  &#039;db_undo_support&#039; =&amp;gt; true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; function undoSavepoint( )&lt;br /&gt;
: Save the whole game situation inside an &amp;quot;Undo save point&amp;quot;.&lt;br /&gt;
: There is only ONE undo save point available (see BGA Undo policy).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; function undoRestorePoint()&lt;br /&gt;
: Restore the situation previously saved as an &amp;quot;Undo save point&amp;quot;.&lt;br /&gt;
: You must make sure that the active player is the same after and before the undoRestorePoint (ie: this is your responsibility to ensure that the player that is active when this method is called is exactly the same than the player that was active when the undoSavePoint method has been called).&lt;br /&gt;
&lt;br /&gt;
== Managing errors and exceptions ==&lt;br /&gt;
&lt;br /&gt;
Note: when you throw an exception, all database changes and all notifications are cancelled immediately. This way, the game situation that existed before the request is completely restored.&lt;br /&gt;
&lt;br /&gt;
; throw new BgaUserException ( $error_message)&lt;br /&gt;
: Base class to notify a user error&lt;br /&gt;
: You must throw this exception when a player wants to do something that he is not allowed to do.&lt;br /&gt;
: The error message will be shown to the player as a &amp;quot;red message&amp;quot;, so it must be translated.&lt;br /&gt;
: Throwing such an exception is NOT considered a bug, so it is not traced in BGA error logs.&lt;br /&gt;
&lt;br /&gt;
Example from Gomoku:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     throw new BgaUserException( self::_(&amp;quot;There is already a stone on this intersection, you can&#039;t play there&amp;quot;) );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; throw new BgaVisibleSystemException ( $error_message)&lt;br /&gt;
: You must throw this exception when you detect something that is not supposed to happened in your code.&lt;br /&gt;
: The error message is shown to the user as an &amp;quot;Unexpected error&amp;quot;, in order that he can report it in the forum.&lt;br /&gt;
: The error message is logged in BGA error logs. If it happens regularly, we will report it to you.&lt;br /&gt;
&lt;br /&gt;
; throw new BgaSystemException ( $error_message)&lt;br /&gt;
: Base class to notify a system exception. The message will be hidden from the user, but show in the logs. Use this if the message contains technical information.&lt;br /&gt;
: You shouldn&#039;t use this type of exception except if you think the information shown could be critical. Indeed: a generic error message will be shown to the user, so it&#039;s going to be difficult for you to see what happened.&lt;br /&gt;
&lt;br /&gt;
== Zombie mode ==&lt;br /&gt;
&lt;br /&gt;
When a player leaves a game for any reason (expelled, quit), he becomes a &amp;quot;zombie player&amp;quot;. In this case, the results of the game won&#039;t count for statistics, but this is cool if the other players can finish the game anyway. That&#039;s why zombie mode exists: allow the other player to finish the game, even if the situation is not ideal.&lt;br /&gt;
&lt;br /&gt;
While developing your zombie mode, keep in mind that:&lt;br /&gt;
* Do not refer to the rules, because this situation is not planned by the rules.&lt;br /&gt;
* Try to figure that you are playing with your friends and one of them has to leave: how can we finish the game without killing the spirit of the game?&lt;br /&gt;
* The idea is NOT to develop an artificial intelligence for the game.&lt;br /&gt;
* Do not try to end the game early, even in a two-player game. The zombie is there to allow the game to continue, not to end it. Trying to end the game is not supported by the framework and will likely cause unexpected errors.&lt;br /&gt;
&lt;br /&gt;
Most of the time, the best thing to do when it is zombie player turn is to jump immediately to a state where he is not active anymore. For example, if he is in a game state where he has a choice between playing A and playing B, the best thing to do is NOT to choose A or B, but to pass. So, even if there&#039;s no &amp;quot;pass&amp;quot; action in the rules, add a &amp;quot;zombiepass&amp;quot; transitition in your game state and use it.&lt;br /&gt;
&lt;br /&gt;
Each time a zombie player must play, your &amp;quot;zombieTurn&amp;quot; method is called.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
* $state: the name of the current game state.&lt;br /&gt;
* $active_player: the id of the active player.&lt;br /&gt;
&lt;br /&gt;
Most of the time, your zombieTurn method looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    function zombieTurn( $state, $active_player )&lt;br /&gt;
    {&lt;br /&gt;
    	$statename = $state[&#039;name&#039;];&lt;br /&gt;
&lt;br /&gt;
        if( $statename == &#039;myFirstGameState&#039;&lt;br /&gt;
             ||  $statename == &#039;my2ndGameState&#039;&lt;br /&gt;
             ||  $statename == &#039;my3rdGameState&#039;&lt;br /&gt;
               ....&lt;br /&gt;
           )&lt;br /&gt;
        {&lt;br /&gt;
            $this-&amp;gt;gamestate-&amp;gt;nextState( &amp;quot;zombiePass&amp;quot; );&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
            throw new BgaVisibleSystemException( &amp;quot;Zombie mode not supported at this game state: &amp;quot;.$statename );&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that in the example above, all corresponding game state should implement &amp;quot;zombiePass&amp;quot; as a transition.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Very important&#039;&#039;&#039;: your zombie code will be called when the player leaves the game. This action is triggered from the main site and propagated to the gameserver from a server, not from a browser. As a consequence, there is no current player associated to this action. In your zombieTurn function, you must &#039;&#039;&#039;never&#039;&#039;&#039; use getCurrentPlayerId() or getCurrentPlayerName(), otherwise it will fail with a &amp;quot;Not logged&amp;quot; error message.&lt;br /&gt;
&lt;br /&gt;
== Player color preferences ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BGA players (Club members) may now choose their preferred color for playing. For example, if they are used to play green for every board game, they can select &amp;quot;green&amp;quot; in their BGA preferences page.&lt;br /&gt;
&lt;br /&gt;
Making your game compatible with colors preferences is very easy and requires only 1 line of PHP and 1 configuration change :&lt;br /&gt;
&lt;br /&gt;
On your gameinfos.inc.php file, add the following lines :&lt;br /&gt;
&lt;br /&gt;
  // Favorite colors support : if set to &amp;quot;true&amp;quot;, support attribution of favorite colors based on player&#039;s preferences (see reattributeColorsBasedOnPreferences PHP method)&lt;br /&gt;
  // NB: this parameter is used only to flag games supporting this feature; you must use (or not use) reattributeColorsBasedOnPreferences PHP method to actually enable or disable the feature.&lt;br /&gt;
  &#039;favorite_colors_support&#039; =&amp;gt; true,&lt;br /&gt;
&lt;br /&gt;
Then, on your main &amp;lt;your_game&amp;gt;.game.php file, find the &amp;quot;reloadPlayersBasicInfos&amp;quot; call in your &amp;quot;setupNewGame&amp;quot; method and replace :&lt;br /&gt;
&lt;br /&gt;
        $sql .= implode( $values, &#039;,&#039; );&lt;br /&gt;
        self::DbQuery( $sql );&lt;br /&gt;
        self::reloadPlayersBasicInfos();&lt;br /&gt;
&lt;br /&gt;
By :&lt;br /&gt;
&lt;br /&gt;
        $sql .= implode( $values, &#039;,&#039; );&lt;br /&gt;
        self::DbQuery( $sql );&lt;br /&gt;
        self::reattributeColorsBasedOnPreferences( $players, array(  /* LIST HERE THE AVAILABLE COLORS OF YOUR GAME INSTEAD OF THESE ONES */&amp;quot;ff0000&amp;quot;, &amp;quot;008000&amp;quot;, &amp;quot;0000ff&amp;quot;, &amp;quot;ffa500&amp;quot;, &amp;quot;773300&amp;quot; ) );&lt;br /&gt;
        self::reloadPlayersBasicInfos();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;reattributeColorsBasedOnPreferences&amp;quot; method reattributes all colors, taking into account players color preferences and available colors.&lt;br /&gt;
&lt;br /&gt;
Note that you must update the colors to indicate the colors available for your game.&lt;br /&gt;
&lt;br /&gt;
2 important remarks :&lt;br /&gt;
* for some games (ex : Chess), the color has an influence on a mechanism of the game, most of the time by giving a special advantage to a player (ex : Starting the game). Color preference mechanism must NOT be used in such a case.&lt;br /&gt;
* your logic should NEVER consider that the first player has the color X, that the second player has the color Y, and so on. If this is the case, your game will NOT be compatible with reattributeColorsBasedOnPreferences as this method attribute colors to players based on their preferences and not based as their order at the table.&lt;br /&gt;
&lt;br /&gt;
Colours currently listed as a choice in preferences:&lt;br /&gt;
&lt;br /&gt;
* #ff0000 Red&lt;br /&gt;
* #008000 Green&lt;br /&gt;
* #0000ff Blue&lt;br /&gt;
* #ffa500 Yellow&lt;br /&gt;
* #000000 Black&lt;br /&gt;
* #ffffff White&lt;br /&gt;
* #e94190 Pink&lt;br /&gt;
* #982fff Purple&lt;br /&gt;
* #72c3b1 Cyan&lt;br /&gt;
* #f07f16 Orange&lt;br /&gt;
* #bdd002 Khaki green&lt;br /&gt;
* #7b7b7b Gray&lt;br /&gt;
&lt;br /&gt;
== Legacy games API ==&lt;br /&gt;
&lt;br /&gt;
For some very specific games (&amp;quot;legacy&amp;quot;, &amp;quot;campaign&amp;quot;), you need to keep some informations from a game to another.&lt;br /&gt;
&lt;br /&gt;
This should be an exceptional situation: the legacy API is costing resources on Board Game Arena databases, and is slowing down the game setup process + game end of game process. Please do not use it for things like:&lt;br /&gt;
* keeping a player preference/settings (=&amp;gt; player preferences and game options should be used instead)&lt;br /&gt;
* keeping a statistics, a score, or a ranking, while it is not planned in the physical board game, or while there is no added value compared to BGA statistics / rankings.&lt;br /&gt;
&lt;br /&gt;
You should use it for:&lt;br /&gt;
* legacy games: when some components of the game has been altered in a previous game and should be kept as it is.&lt;br /&gt;
* &amp;quot;campaign style&amp;quot; games: when a player is getting a &amp;quot;reward&amp;quot; at the end of a game, and should be able to use it in further games.&lt;br /&gt;
&lt;br /&gt;
Important: you cannot store more than 64k of data (serialized as JSON) per player per game. If you go over 64k, storeLegacyData function is going to FAIL, and there is a risk to create a major bug (= players blocked) in your game. You MUST make sure that no more than 64k of data is used for each player for your game. For example, if you are implementing a &amp;quot;campaign style&amp;quot; game and if you allow a player to start multiple campaign, you must LIMIT the number of different campaign so that the total data size to not go over the limit. We strongly recommend you to use this:&lt;br /&gt;
&lt;br /&gt;
  try &lt;br /&gt;
  {&lt;br /&gt;
  	$this-&amp;gt;storeLegacyTeamData( &#039;my_variable&#039;, $my_data );&lt;br /&gt;
  }&lt;br /&gt;
  catch( feException $e )&lt;br /&gt;
  {&lt;br /&gt;
  	if( $e-&amp;gt;getCode() == FEX_legacy_size_exceeded )&lt;br /&gt;
  	{&lt;br /&gt;
  		// Do something here to free some space in Legacy data (ex: by removing some variables)&lt;br /&gt;
  	}&lt;br /&gt;
  	else&lt;br /&gt;
  		throw $e;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; function storeLegacyData( $player_id, $key, $data, $ttl = 365 )&lt;br /&gt;
: Store some data associated with $key for the given user / current game&lt;br /&gt;
: In the opposite of all other game data, this data will PERSIST after the end of this table, and can be re-used&lt;br /&gt;
: in a future table with the same game.&lt;br /&gt;
: IMPORTANT: The only possible place where you can use this method is when the game is over at your table (last game action). Otherwise, there is a risk of conflicts between ongoing games.    &lt;br /&gt;
: TTL is a time-to-live: the maximum, and default, is 365 days.&lt;br /&gt;
: In any way, the total data (= all keys) you can store for a given user+game is 64k (note: data is store serialized as JSON data)&lt;br /&gt;
&lt;br /&gt;
; function retrieveLegacyData( $player_id, $key )&lt;br /&gt;
: Get data associated with $key for the current game&lt;br /&gt;
: This data is common to ALL tables from the same game for this player, and persist from one table to another.&lt;br /&gt;
: Note: calling this function has an important cost =&amp;gt; please call it few times (possibly: only ONCE) for each player for 1 game if possible&lt;br /&gt;
: Note: you can use &#039;%&#039; in $key to retrieve all keys matching the given patterns&lt;br /&gt;
&lt;br /&gt;
; function removeLegacyData( $player_id, $key )&lt;br /&gt;
: Remove some legacy data with the given key&lt;br /&gt;
: (useful to free some data to avoid going over 64k)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; function storeLegacyTeamData( $data, $ttl = 365 )&lt;br /&gt;
: Same as storeLegacyData, except that it stores some data for the whole team within the current table&lt;br /&gt;
: Ie: if players A, B and C are at a table, the legacy data will be saved for future table with (exactly) A, B and C on the table.&lt;br /&gt;
: This is useful for games which are intended to be played several time by the same team.&lt;br /&gt;
: Note: the data total size is still limited, so you must implement catch the FEX_legacy_size_exceeded exception if it happens&lt;br /&gt;
&lt;br /&gt;
; function retrieveLegacyTeamData()&lt;br /&gt;
: Same as retrieveLegacyData, except that it retrieves some data for the whole team within the current table (set by storeLegacyTeamData)&lt;br /&gt;
&lt;br /&gt;
; function removeLegacyTeamData()&lt;br /&gt;
: Same as removeLegacyData, except that it retrieves some data for the whole team within the current table (set by storeLegacyTeamData)&lt;br /&gt;
&lt;br /&gt;
== Language dependent games API ==&lt;br /&gt;
&lt;br /&gt;
This API is used for games that are heavily language dependent. Two most common use cases are:&lt;br /&gt;
* Games that have a language dependent component that are not necessarily translatable, typically a list of words. (Think of games like Codenames, Decrypto, Just One...)&lt;br /&gt;
* Games with massive communication where players would like to ensure that all participants speak the same language. (Think of games like Werewolf, The Resistance, maybe even dixit...)&lt;br /&gt;
&lt;br /&gt;
If this option is used, the table created will be limited only to users that have specific language in their profile. Player starting the game would be able to chose one of the languages he speaks.&lt;br /&gt;
&lt;br /&gt;
There is a new property language_dependency in gameinfos.inc.php which can be set like this:&lt;br /&gt;
  &#039;language_dependecy&#039; =&amp;gt; false,  //or if the property is missing, the game is not language dependent&lt;br /&gt;
  &#039;language_dependecy&#039; =&amp;gt; true, //all players at the table must speak the same language&lt;br /&gt;
  &#039;language_dependecy&#039; =&amp;gt; array( 1 =&amp;gt; &#039;en&#039;, 2 =&amp;gt; &#039;fr&#039;, 3 =&amp;gt; &#039;it&#039; ), //1-based list of supported languages&lt;br /&gt;
&lt;br /&gt;
In the gamename.game.php file, you can get the id of selected language with the method &#039;&#039;&#039;getGameLanguage&#039;&#039;&#039;.&lt;br /&gt;
; function getGameLanguage()&lt;br /&gt;
: Returns an index of the selected language as defined in gameinfos.inc.php.&lt;br /&gt;
&lt;br /&gt;
Languages currently available on BGA are:&lt;br /&gt;
  &#039;ar&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;العربية&amp;quot;, &#039;code&#039; =&amp;gt; &#039;ar_AE&#039; ),             // arabic&lt;br /&gt;
  &#039;be&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;беларуская мова&amp;quot;, &#039;code&#039; =&amp;gt; &#039;be_BY&#039; ),    // Belarusian&lt;br /&gt;
  &#039;bn&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;বাংলা&amp;quot;, &#039;code&#039; =&amp;gt; &#039;bn_BD&#039; ),                  // bengali&lt;br /&gt;
  &#039;bg&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;български език&amp;quot;, &#039;code&#039; =&amp;gt; &#039;bg_BG&#039; ),     // bulgarian&lt;br /&gt;
  &#039;ca&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;català&amp;quot;, &#039;code&#039; =&amp;gt; &#039;ca_ES&#039; ),              // catalan&lt;br /&gt;
  &#039;cs&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;čeština&amp;quot;, &#039;code&#039; =&amp;gt; &#039;cs_CZ&#039; ),             // czech&lt;br /&gt;
  &#039;da&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;dansk&amp;quot;, &#039;code&#039; =&amp;gt; &#039;da_DK&#039; ),              // danish&lt;br /&gt;
  &#039;de&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;deutsch&amp;quot;, &#039;code&#039; =&amp;gt; &#039;de_DE&#039; ),            // deutsch&lt;br /&gt;
  &#039;el&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Ελληνικά&amp;quot;, &#039;code&#039; =&amp;gt; &#039;el_GR&#039; ),           // greek&lt;br /&gt;
  &#039;en&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;English&amp;quot;, &#039;code&#039; =&amp;gt; &#039;en_US&#039; ),            // english&lt;br /&gt;
  &#039;es&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;español&amp;quot;, &#039;code&#039; =&amp;gt; &#039;es_ES&#039; ),            // spanish&lt;br /&gt;
  &#039;et&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;eesti keel&amp;quot;, &#039;code&#039; =&amp;gt; &#039;et_EE&#039; ),          // estonian       &lt;br /&gt;
  &#039;fi&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;suomi&amp;quot;, &#039;code&#039; =&amp;gt; &#039;fi_FI&#039; ),               // finnish&lt;br /&gt;
  &#039;fr&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;français&amp;quot;, &#039;code&#039; =&amp;gt; &#039;fr_FR&#039; ),            // french&lt;br /&gt;
  &#039;he&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;עברית&amp;quot;, &#039;code&#039; =&amp;gt; &#039;he_IL&#039; ),                // hebrew       &lt;br /&gt;
  &#039;hi&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;हिन्दी&amp;quot;, &#039;code&#039; =&amp;gt; &#039;hi_IN&#039; ),                  // hindi&lt;br /&gt;
  &#039;hr&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Hrvatski&amp;quot;, &#039;code&#039; =&amp;gt; &#039;hr_HR&#039; ),           // croatian&lt;br /&gt;
  &#039;hu&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;magyar&amp;quot;, &#039;code&#039; =&amp;gt; &#039;hu_HU&#039; ),             // hungarian&lt;br /&gt;
  &#039;id&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Bahasa Indonesia&amp;quot;, &#039;code&#039; =&amp;gt; &#039;id_ID&#039; ),   // indonesian&lt;br /&gt;
  &#039;ms&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Bahasa Malaysia&amp;quot;, &#039;code&#039; =&amp;gt; &#039;ms_MY&#039; ),    // malaysian&lt;br /&gt;
  &#039;it&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;italiano&amp;quot;, &#039;code&#039; =&amp;gt; &#039;it_IT&#039; ),            // italian&lt;br /&gt;
  &#039;ja&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;日本語&amp;quot;, &#039;code&#039; =&amp;gt; &#039;ja_JP&#039; ),               // japanese&lt;br /&gt;
  &#039;jv&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Basa Jawa&amp;quot;, &#039;code&#039; =&amp;gt; &#039;jv_JV&#039; ),           // javanese                       &lt;br /&gt;
  &#039;ko&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;한국어&amp;quot;, &#039;code&#039; =&amp;gt; &#039;ko_KR&#039; ),                 // korean&lt;br /&gt;
  &#039;lt&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;lietuvių&amp;quot;, &#039;code&#039; =&amp;gt; &#039;lt_LT&#039; ),             // lithuanian&lt;br /&gt;
  &#039;lv&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;latviešu&amp;quot;, &#039;code&#039; =&amp;gt; &#039;lv_LV&#039; ),             // latvian&lt;br /&gt;
  &#039;nl&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;nederlands&amp;quot;, &#039;code&#039; =&amp;gt; &#039;nl_NL&#039; ),            // dutch&lt;br /&gt;
  &#039;no&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;norsk&amp;quot;, &#039;code&#039; =&amp;gt; &#039;nb_NO&#039; ),               // Norwegian&lt;br /&gt;
  &#039;oc&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;occitan&amp;quot;, &#039;code&#039; =&amp;gt; &#039;oc_FR&#039; ),              // Occitan&lt;br /&gt;
  &#039;pl&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;polski&amp;quot;, &#039;code&#039; =&amp;gt; &#039;pl_PL&#039; ),             // polish&lt;br /&gt;
  &#039;pt&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;português&amp;quot;,  &#039;code&#039; =&amp;gt; &#039;pt_PT&#039; ),            // portugese&lt;br /&gt;
  &#039;ro&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;română&amp;quot;,  &#039;code&#039; =&amp;gt; &#039;ro_RO&#039;  ),            // romanian&lt;br /&gt;
  &#039;ru&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Русский язык&amp;quot;, &#039;code&#039; =&amp;gt; &#039;ru_RU&#039; ),       // russian&lt;br /&gt;
  &#039;sk&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;slovenčina&amp;quot;, &#039;code&#039; =&amp;gt; &#039;sk_SK&#039; ),         // slovak&lt;br /&gt;
  &#039;sl&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;slovenščina&amp;quot;, &#039;code&#039; =&amp;gt; &#039;sl_SI&#039; ),        // slovenian       &lt;br /&gt;
  &#039;sr&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Српски&amp;quot;, &#039;code&#039; =&amp;gt; &#039;sr_RS&#039; ),              // serbian       &lt;br /&gt;
  &#039;sv&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;svenska&amp;quot;, &#039;code&#039; =&amp;gt; &#039;sv_SE&#039; ),            // swedish&lt;br /&gt;
  &#039;tr&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Türkçe&amp;quot;, &#039;code&#039; =&amp;gt; &#039;tr_TR&#039; ),              // turkish       &lt;br /&gt;
  &#039;uk&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;Українська мова&amp;quot;, &#039;code&#039; =&amp;gt; &#039;uk_UA&#039; ),    // Ukrainian&lt;br /&gt;
  &#039;zh&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;中文 (漢)&amp;quot;,  &#039;code&#039; =&amp;gt; &#039;zh_TW&#039; ),          // Traditional Chinese (Hong Kong, Macau, Taiwan)&lt;br /&gt;
  &#039;zh-cn&#039; =&amp;gt; array( &#039;name&#039; =&amp;gt; &amp;quot;中文 (汉)&amp;quot;, &#039;code&#039; =&amp;gt; &#039;zh_CN&#039; ),        // Simplified Chinese (Mainland China, Singapore)&lt;br /&gt;
&lt;br /&gt;
== Debugging and Tracing ==&lt;br /&gt;
&lt;br /&gt;
To debug php code you can use some tracing functions available from the parent class such as debug, trace, error, warn, dump.&lt;br /&gt;
  &lt;br /&gt;
  self::debug(&amp;quot;Ahh!&amp;quot;);&lt;br /&gt;
  self::dump(&#039;my_var&#039;,$my_var);&lt;br /&gt;
&lt;br /&gt;
See [[Practical_debugging]] section for complete information about debugging interfaces and where to find logs.&lt;/div&gt;</summary>
		<author><name>RavingWanderer</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=5580</id>
		<title>Gamehelphandandfoot</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=5580"/>
		<updated>2020-09-13T21:49:49Z</updated>

		<summary type="html">&lt;p&gt;RavingWanderer: more on undo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Hand and Foot&#039;&#039;&#039; is a traditional card game for 2 or more players, acting either individually or in teams.  It uses a large number of card decks (typically one or two more than the number of players), and is a rummy-style meld-building game based on Canasta.&lt;br /&gt;
&lt;br /&gt;
==Game duration and number of players==&lt;br /&gt;
A game is divided into &#039;&#039;rounds&#039;&#039;, each consisting of the play of one deal of cards.  Play can either be for a set number of rounds (typically 4), or until a team reaches a threshold score.  The team with the highest score wins the game.&lt;br /&gt;
&lt;br /&gt;
A typical four-round game with four players takes about two hours to complete.  The BGA version of the game supports from two to seven individual players, and up to 12 when playing in teams.&lt;br /&gt;
&lt;br /&gt;
==Round setup==&lt;br /&gt;
Players are seated so that partners are opposite each other at the table.  If teams have more than two players, they are seated so team members are equidistant from each other.&lt;br /&gt;
&lt;br /&gt;
The number of decks used is typically one or two more than the number of players, with the jokers included.  For faster play, non-joker cards with proper card backs can also be mixed in; in BGA this is represented as allowing more than two joker per deck.  The decks are all shuffled together, and each player is dealt two piles of cards.  House rules differ on the number of cards: some dictate the piles are 11 cards, others say 13.  One pile is not looked at, and is the &#039;&#039;foot&#039;&#039;.  The other is picked up by the player and is the &#039;&#039;hand&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The undealt cards are stacked into a &#039;&#039;draw pile&#039;&#039;.  Optionally, one card is turned over to start the &#039;&#039;discard pile&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Game objective==&lt;br /&gt;
&lt;br /&gt;
The objective of the game is to create &#039;&#039;melds&#039;&#039; consisting of 3-7 (or sometimes more, depending on house rules) cards of the same rank, possibly including &#039;&#039;wild cards&#039;&#039;.  Wild cards are deuces and jokers.  Melds of seven cards (or more) are considered to be &#039;&#039;complete&#039;&#039;, and may be referred to as &#039;&#039;books&#039;&#039;; bonuses are awarded for these melds.  Melds with less than 7 cards are considered &#039;&#039;open&#039;&#039;.  A book with no wild cards is considered &#039;&#039;clean&#039;&#039; or &#039;&#039;red&#039;&#039;, and will score a higher bonus than a &#039;&#039;dirty&#039;&#039; or &#039;&#039;black&#039;&#039; book, which has at least one wild card.  If the house rules allow or require, a meld of all wild cards may be formed, which will score an even higher bonus than clean books.  Melds are depicted in the BGA version of the game by red cards with blue borders if they are clean, black cards with brown borders if they are dirty, and jokers bordered by gold cards if they are wild.&lt;br /&gt;
&lt;br /&gt;
A team must reach a predetermined &#039;&#039;contract&#039;&#039; before a round can be ended.  The contract is typically for a set number of clean, dirty, and wild books, and is the same for each team and each round of play.  A common contract for teams of two is two each clean and dirty books, and one wild book.&lt;br /&gt;
&lt;br /&gt;
==Scoring and card valuation==&lt;br /&gt;
Cards are valued by their rank:&lt;br /&gt;
*Jokers are worth 50 points&lt;br /&gt;
*Aces and deuces are worth 20 points&lt;br /&gt;
*8 through King are worth 10 points&lt;br /&gt;
*4 through 7 are worth 5 points&lt;br /&gt;
The values of 3s depend on house rules.  In common variants, red 3s are worth 100 points, and are played automatically and replaced with a new card when it is the player&#039;s turn.  Black 3s are typically worth 5 points, and cannot be melded at all, or taken from the top of the discard pile (but see [[#Taking the discard|Taking the discard]] below).&lt;br /&gt;
&lt;br /&gt;
Cards played on the board are scored for the team, while those left in the hand (and foot) are scored against the team.&lt;br /&gt;
&lt;br /&gt;
===Going out and meld completion bonuses===&lt;br /&gt;
The team that goes out to end a round of play is awarded 100 points for doing so.  If the draw pile is exhausted, the round ends and no team gets this bonus.&lt;br /&gt;
&lt;br /&gt;
Meld bonuses are awarded when a meld reaches seven cards in length, and is denoted in the BGA version of the game by displaying the meld sideways.  The most common meld completion bonuses are:&lt;br /&gt;
* Clean books score 500&lt;br /&gt;
* Dirty books score 300&lt;br /&gt;
* Wild books score 1500&lt;br /&gt;
&lt;br /&gt;
==Order of play==&lt;br /&gt;
The player to the left of the dealer begins play.  Each player&#039;s turn includes the following steps:&lt;br /&gt;
* Play and replace any red 3s in the hand&lt;br /&gt;
* Either draw two cards (playing and replacing drawn red 3s if necessary), or take the discard&lt;br /&gt;
* Optionally create new melds for the team, or play cards to existing team melds, assuming &#039;&#039;opening criteria&#039;&#039; are met&lt;br /&gt;
* If still holding cards, discard one&lt;br /&gt;
&lt;br /&gt;
If the player runs out of cards without discarding, they can pick their foot and immediately continue playing from it; this is called &#039;&#039;running to the foot&#039;&#039;.  If the player discards their last card, they can pick up their foot, but not play from it until their next turn; this is called &#039;&#039;walking&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The round ends when a team has completed the required contract, and one of its players plays out both their hand and their foot.  Some house rules require the last card to be discarded, while others allow it to be played.&lt;br /&gt;
&lt;br /&gt;
===Opening criteria===&lt;br /&gt;
A team must meet certain criteria in order to open play on their board.  The requirement is that the opening player must put down cards with a minimum card point value, and typically varies by either which round of play (increasing with each successive round), or by the team&#039;s score.  The most common opening criteria are:&lt;br /&gt;
* Round 1: 50 points to open&lt;br /&gt;
* Round 2: 90 points to open&lt;br /&gt;
* Round 3: 120 points to open&lt;br /&gt;
* Round 4: 150 points to open&lt;br /&gt;
If a tie-breaking fifth round is needed, it will also require 150 points to open.  The point score does not include meld completion bonuses, or any played red 3s.  For example, a completed book of 5s scores 35 points, with a bonus of 500 points for being complete, but is insufficient to open even round 1.&lt;br /&gt;
&lt;br /&gt;
===Playing red 3s===&lt;br /&gt;
A common house rule requires that red 3s are played into a special pile, and immediately replaced &#039;&#039;when it is the player&#039;s turn&#039;&#039;.  This may occur before the draw when the player first plays from either their hand or foot, or when they draw a red 3.  Red 3s played in this manner do not count toward opening criteria.&lt;br /&gt;
&lt;br /&gt;
===Drawing cards===&lt;br /&gt;
Once a player has played any red 3s in their hand, they may choose (or be forced to) draw cards.  This takes place in BGA by clicking on the draw pile, and delivers two cards into the hand.&lt;br /&gt;
&lt;br /&gt;
===Taking the discard===&lt;br /&gt;
If the player is allowed by the house rules, they may pick up the top discard.  Common house rules require the player to (1) have two cards of the same rank in their hand, and (2) be able to immediately play all three cards to the board.  Among other things, this means that his team either (a) has already opened its board, or (b) the player taking the discard can meet the opening criteria for the round.  It also means that the top card is not a black 3, or any other card where it is forbidden by house rules to take it.  (Some house variants forbid the taking of wild cards, and house rules requiring red 3s to be discarded also typically forbid their taking.)&lt;br /&gt;
&lt;br /&gt;
Once the player has taken and played the discard and associated meld cards, most rules require the taking of additional cards from the discard pile.  This is generally six cards, or the entire pile if it is less, but there are house rules that require the pile to have at least six more cards in it, or that require the taking of the entire discard pile in the manner of traditional Canasta rules.  A discard pile rich in black 3s can discourage the taking of discards.&lt;br /&gt;
&lt;br /&gt;
===Playing cards===&lt;br /&gt;
Playing cards to the board consists of selecting a group of matching cards (all of the same rank with optional wild cards), and clicking on either the &amp;quot;New Meld&amp;quot; panel or the meld of the given rank on the team&#039;s meld board.  If melds are limited in size, you will not be allowed to make a meld have more than seven cards.&lt;br /&gt;
&lt;br /&gt;
You can have only one meld of a given rank open at any time.  In order to create a meld, you must have at least three cards to play to it.  You must always have more non-wild than wild cards in a meld, and common house rules limit the number of wild cards in a completed meld to either 2 or 3.  The BGA version of the game enforces this by a &amp;quot;ratio rule&amp;quot;, requiring a certain percentage of the cards in a meld at any given time to be non-wild.&lt;br /&gt;
&lt;br /&gt;
The card plays you make (other than the required play of red 3s) are not shown to other players until one of several actions take place.  These actions include:&lt;br /&gt;
*Discarding to end your turn&lt;br /&gt;
*Playing out, either to end the round or to run to your foot&lt;br /&gt;
*Taking extra discards&lt;br /&gt;
&lt;br /&gt;
It is possible to &#039;&#039;undo&#039;&#039; moves up the last instance of one of these in your turn.  This may become necessary for three reasons.  First, if you attempt to open, but do not have sufficient points to make the opening criteria, you must undo your moves and make a discard instead.  Second, you cannot play the last card from your foot unless your team has made the contracted melds.  The game will not allow you to play out, so you must undo your moves.  Third, if the game rules require you to discard the last card from your foot, you will not be allowed to play it.  If you do not have the contract, you will also not be allowed to discard it.  In the latter two cases, you may be able to repeat &#039;&#039;some&#039;&#039; of the undone moves, but you must be able to make a valid discard to end your turn.&lt;br /&gt;
&lt;br /&gt;
===Discarding===&lt;br /&gt;
To discard, select a single card, and click on the discard pile.  If it is the last card of your foot, you will not be allowed to discard it if your team does not have the contracted melds.  In that case, you will have to undo your moves, and play so as to have at least one card remaining in your hand after discarding.&lt;br /&gt;
&lt;br /&gt;
==Round and game summaries==&lt;br /&gt;
At the end of each round, a scoring summary is displayed, showing how each team made its points in the round.  At the end of the game, the report includes all of the game rounds.&lt;/div&gt;</summary>
		<author><name>RavingWanderer</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=5557</id>
		<title>Gamehelphandandfoot</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=5557"/>
		<updated>2020-09-10T19:09:56Z</updated>

		<summary type="html">&lt;p&gt;RavingWanderer: more variant stuff&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Hand and Foot&#039;&#039;&#039; is a traditional card game for 2 or more players, acting either individually or in teams.  It uses a large number of card decks (typically one or two more than the number of players), and is a rummy-style meld-building game based on Canasta.&lt;br /&gt;
&lt;br /&gt;
==Game duration and number of players==&lt;br /&gt;
A game is divided into &#039;&#039;rounds&#039;&#039;, each consisting of the play of one deal of cards.  Play can either be for a set number of rounds (typically 4), or until a team reaches a threshold score.  The team with the highest score wins the game.&lt;br /&gt;
&lt;br /&gt;
A typical four-round game with four players takes about two hours to complete.  The BGA version of the game supports from two to seven individual players, and up to 12 when playing in teams.&lt;br /&gt;
&lt;br /&gt;
==Round setup==&lt;br /&gt;
Players are seated so that partners are opposite each other at the table.  If teams have more than two players, they are seated so team members are equidistant from each other.&lt;br /&gt;
&lt;br /&gt;
The number of decks used is typically one or two more than the number of players, with the jokers included.  For faster play, non-joker cards with proper card backs can also be mixed in; in BGA this is represented as allowing more than two joker per deck.  The decks are all shuffled together, and each player is dealt two piles of cards.  House rules differ on the number of cards: some dictate the piles are 11 cards, others say 13.  One pile is not looked at, and is the &#039;&#039;foot&#039;&#039;.  The other is picked up by the player and is the &#039;&#039;hand&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The undealt cards are stacked into a &#039;&#039;draw pile&#039;&#039;.  Optionally, one card is turned over to start the &#039;&#039;discard pile&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Game objective==&lt;br /&gt;
&lt;br /&gt;
The objective of the game is to create &#039;&#039;melds&#039;&#039; consisting of 3-7 (or sometimes more, depending on house rules) cards of the same rank, possibly including &#039;&#039;wild cards&#039;&#039;.  Wild cards are deuces and jokers.  Melds of seven cards (or more) are considered to be &#039;&#039;complete&#039;&#039;, and may be referred to as &#039;&#039;books&#039;&#039;; bonuses are awarded for these melds.  Melds with less than 7 cards are considered &#039;&#039;open&#039;&#039;.  A book with no wild cards is considered &#039;&#039;clean&#039;&#039; or &#039;&#039;red&#039;&#039;, and will score a higher bonus than a &#039;&#039;dirty&#039;&#039; or &#039;&#039;black&#039;&#039; book, which has at least one wild card.  If the house rules allow or require, a meld of all wild cards may be formed, which will score an even higher bonus than clean books.  Melds are depicted in the BGA version of the game by red cards with blue borders if they are clean, black cards with brown borders if they are dirty, and jokers bordered by gold cards if they are wild.&lt;br /&gt;
&lt;br /&gt;
A team must reach a predetermined &#039;&#039;contract&#039;&#039; before a round can be ended.  The contract is typically for a set number of clean, dirty, and wild books, and is the same for each team and each round of play.  A common contract for teams of two is two each clean and dirty books, and one wild book.&lt;br /&gt;
&lt;br /&gt;
==Scoring and card valuation==&lt;br /&gt;
Cards are valued by their rank:&lt;br /&gt;
*Jokers are worth 50 points&lt;br /&gt;
*Aces and deuces are worth 20 points&lt;br /&gt;
*8 through King are worth 10 points&lt;br /&gt;
*4 through 7 are worth 5 points&lt;br /&gt;
The values of 3s depend on house rules.  In common variants, red 3s are worth 100 points, and are played automatically and replaced with a new card when it is the player&#039;s turn.  Black 3s are typically worth 5 points, and cannot be melded at all, or taken from the top of the discard pile (but see [[#Taking the discard|Taking the discard]] below).&lt;br /&gt;
&lt;br /&gt;
Cards played on the board are scored for the team, while those left in the hand (and foot) are scored against the team.&lt;br /&gt;
&lt;br /&gt;
===Going out and meld completion bonuses===&lt;br /&gt;
The team that goes out to end a round of play is awarded 100 points for doing so.  If the draw pile is exhausted, the round ends and no team gets this bonus.&lt;br /&gt;
&lt;br /&gt;
Meld bonuses are awarded when a meld reaches seven cards in length, and is denoted in the BGA version of the game by displaying the meld sideways.  The most common meld completion bonuses are:&lt;br /&gt;
* Clean books score 500&lt;br /&gt;
* Dirty books score 300&lt;br /&gt;
* Wild books score 1500&lt;br /&gt;
&lt;br /&gt;
==Order of play==&lt;br /&gt;
The player to the left of the dealer begins play.  Each player&#039;s turn includes the following steps:&lt;br /&gt;
* Play and replace any red 3s in the hand&lt;br /&gt;
* Either draw two cards (playing and replacing drawn red 3s if necessary), or take the discard&lt;br /&gt;
* Optionally create new melds for the team, or play cards to existing team melds, assuming &#039;&#039;opening criteria&#039;&#039; are met&lt;br /&gt;
* If still holding cards, discard one&lt;br /&gt;
&lt;br /&gt;
If the player runs out of cards without discarding, they can pick their foot and immediately continue playing from it; this is called &#039;&#039;running to the foot&#039;&#039;.  If the player discards their last card, they can pick up their foot, but not play from it until their next turn; this is called &#039;&#039;walking&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The round ends when a team has completed the required contract, and one of its players plays out both their hand and their foot.  Some house rules require the last card to be discarded, while others allow it to be played.&lt;br /&gt;
&lt;br /&gt;
===Opening criteria===&lt;br /&gt;
A team must meet certain criteria in order to open play on their board.  The requirement is that the opening player must put down cards with a minimum card point value, and typically varies by either which round of play (increasing with each successive round), or by the team&#039;s score.  The most common opening criteria are:&lt;br /&gt;
* Round 1: 50 points to open&lt;br /&gt;
* Round 2: 90 points to open&lt;br /&gt;
* Round 3: 120 points to open&lt;br /&gt;
* Round 4: 150 points to open&lt;br /&gt;
If a tie-breaking fifth round is needed, it will also require 150 points to open.  The point score does not include meld completion bonuses, or any played red 3s.  For example, a completed book of 5s scores 35 points, with a bonus of 500 points for being complete, but is insufficient to open even round 1.&lt;br /&gt;
&lt;br /&gt;
===Playing red 3s===&lt;br /&gt;
A common house rule requires that red 3s are played into a special pile, and immediately replaced &#039;&#039;when it is the player&#039;s turn&#039;&#039;.  This may occur before the draw when the player first plays from either their hand or foot, or when they draw a red 3.  Red 3s played in this manner do not count toward opening criteria.&lt;br /&gt;
&lt;br /&gt;
===Drawing cards===&lt;br /&gt;
Once a player has played any red 3s in their hand, they may choose (or be forced to) draw cards.  This takes place in BGA by clicking on the draw pile, and delivers two cards into the hand.&lt;br /&gt;
&lt;br /&gt;
===Taking the discard===&lt;br /&gt;
If the player is allowed by the house rules, they may pick up the top discard.  Common house rules require the player to (1) have two cards of the same rank in their hand, and (2) be able to immediately play all three cards to the board.  Among other things, this means that his team either (a) has already opened its board, or (b) the player taking the discard can meet the opening criteria for the round.  It also means that the top card is not a black 3, or any other card where it is forbidden by house rules to take it.  (Some house variants forbid the taking of wild cards, and house rules requiring red 3s to be discarded also typically forbid their taking.)&lt;br /&gt;
&lt;br /&gt;
Once the player has taken and played the discard and associated meld cards, most rules require the taking of additional cards from the discard pile.  This is generally six cards, or the entire pile if it is less, but there are house rules that require the pile to have at least six more cards in it, or that require the taking of the entire discard pile in the manner of traditional Canasta rules.  A discard pile rich in black 3s can discourage the taking of discards.&lt;br /&gt;
&lt;br /&gt;
===Playing cards===&lt;br /&gt;
Playing cards to the board consists of selecting a group of matching cards (all of the same rank with optional wild cards), and clicking on either the &amp;quot;New Meld&amp;quot; panel or the meld of the given rank on the team&#039;s meld board.  If melds are limited in size, you will not be allowed to make a meld have more than seven cards.&lt;br /&gt;
&lt;br /&gt;
You can have only one meld of a given rank open at any time.  In order to create a meld, you must have at least three cards to play to it.  You must always have more non-wild than wild cards in a meld, and common house rules limit the number of wild cards in a completed meld to either 2 or 3.  The BGA version of the game enforces this by a &amp;quot;ratio rule&amp;quot;, requiring a certain percentage of the cards in a meld at any given time to be non-wild.&lt;br /&gt;
&lt;br /&gt;
You cannot play the last card from your foot unless your team has made the contracted melds.  It is for this reason you can &#039;&#039;undo&#039;&#039; your moves.&lt;br /&gt;
&lt;br /&gt;
===Discarding===&lt;br /&gt;
To discard, select a single card, and click on the discard pile.  If it is the last card of your foot, you will not be allowed to discard it if your team does not have the contracted melds.  In that case, you will have to undo your moves, and play so as to have at least one card remaining in your hand after discarding.&lt;br /&gt;
&lt;br /&gt;
==Round and game summaries==&lt;br /&gt;
At the end of each round, a scoring summary is displayed, showing how each team made its points in the round.  At the end of the game, the report includes all of the game rounds.&lt;/div&gt;</summary>
		<author><name>RavingWanderer</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=5556</id>
		<title>Gamehelphandandfoot</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelphandandfoot&amp;diff=5556"/>
		<updated>2020-09-10T19:03:24Z</updated>

		<summary type="html">&lt;p&gt;RavingWanderer: rule summary&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Hand and Foot&#039;&#039;&#039; is a traditional card game for 2 or more players, acting either individually or in teams.  It uses a large number of card decks (typically one or two more than the number of players), and is a rummy-style meld-building game based on Canasta.&lt;br /&gt;
&lt;br /&gt;
==Game duration and number of players==&lt;br /&gt;
A game is divided into &#039;&#039;rounds&#039;&#039;, each consisting of the play of one deal of cards.  Play can either be for a set number of rounds (typically 4), or until a team reaches a threshold score.  The team with the highest score wins the game.&lt;br /&gt;
&lt;br /&gt;
A typical four-round game with four players takes about two hours to complete.  The BGA version of the game supports from two to seven individual players, and up to 12 when playing in teams.&lt;br /&gt;
&lt;br /&gt;
==Round setup==&lt;br /&gt;
Players are seated so that partners are opposite each other at the table.  If teams have more than two players, they are seated so team members are equidistant from each other.&lt;br /&gt;
&lt;br /&gt;
The number of decks used is typically one or two more than the number of players, with the jokers included.  For faster play, non-joker cars with proper card backs can also be mixed in.  The decks are all shuffled together, and each player is dealt two piles of cards.  House rules differ on the number of cards: some dictate the piles are 11 cards, others say 13.  One pile is not looked at, and is the &#039;&#039;foot&#039;&#039;.  The other is picked up by the player and is the &#039;&#039;hand&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The undealt cards are stacked into a &#039;&#039;draw pile&#039;&#039;.  Optionally, one card is turned over to start the &#039;&#039;discard pile&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Game objective==&lt;br /&gt;
&lt;br /&gt;
The objective of the game is to create &#039;&#039;melds&#039;&#039; consisting of 3-7 (or sometimes more, depending on house rules) cards of the same rank, possibly including &#039;&#039;wild cards&#039;&#039;.  Wild cards are deuces and jokers.  Melds of seven cards (or more) are considered to be &#039;&#039;complete&#039;&#039;, and may be referred to as &#039;&#039;books&#039;&#039;; bonuses are awarded for these melds.  Melds with less than 7 cards are considered &#039;&#039;open&#039;&#039;.  A book with no wild cards is considered &#039;&#039;clean&#039;&#039; or &#039;&#039;red&#039;&#039;, and will score a higher bonus than a &#039;&#039;dirty&#039;&#039; or &#039;&#039;black&#039;&#039; book, which has at least one wild card.  If the house rules allow or require, a meld of all wild cards may be formed, which will score an even higher bonus than clean books.  Melds are depicted in the BGA version of the game by red cards with blue borders if they are clean, black cards with brown borders if they are dirty, and jokers bordered by gold cards if they are wild.&lt;br /&gt;
&lt;br /&gt;
A team must reach a predetermined &#039;&#039;contract&#039;&#039; before a round can be ended.  The contract is typically for a set number of clean, dirty, and wild books, and is the same for each team and each round of play.  A common contract for teams of two is two each clean and dirty books, and one wild book.&lt;br /&gt;
&lt;br /&gt;
==Scoring and card valuation==&lt;br /&gt;
Cards are valued by their rank:&lt;br /&gt;
*Jokers are worth 50 points&lt;br /&gt;
*Aces and deuces are worth 20 points&lt;br /&gt;
*8 through King are worth 10 points&lt;br /&gt;
*4 through 7 are worth 5 points&lt;br /&gt;
The values of 3s depend on house rules.  In common variants, red 3s are worth 100 points, and are played automatically and replaced with a new card when it is the player&#039;s turn.  Black 3s are typically worth 5 points, and cannot be melded at all, or taken from the top of the discard pile (but see [[#Taking the discard|Taking the discard]] below).&lt;br /&gt;
&lt;br /&gt;
Cards played on the board are scored for the team, while those left in the hand (and foot) are scored against the team.&lt;br /&gt;
&lt;br /&gt;
===Going out and meld completion bonuses===&lt;br /&gt;
The team that goes out to end a round of play is awarded 100 points for doing so.  If the draw pile is exhausted, the round ends and no team gets this bonus.&lt;br /&gt;
&lt;br /&gt;
Meld bonuses are awarded when a meld reaches seven cards in length, and is denoted in the BGA version of the game by displaying the meld sideways.  The most common meld completion bonuses are:&lt;br /&gt;
* Clean books score 500&lt;br /&gt;
* Dirty books score 300&lt;br /&gt;
* Wild books score 1500&lt;br /&gt;
&lt;br /&gt;
==Order of play==&lt;br /&gt;
The player to the left of the dealer begins play.  Each player&#039;s turn includes the following steps:&lt;br /&gt;
* Play and replace any red 3s in the hand&lt;br /&gt;
* Either draw two cards, or take the discard&lt;br /&gt;
* Optionally create new melds for the team, or play cards to existing team melds, assuming &#039;&#039;opening criteria&#039;&#039; are met&lt;br /&gt;
* If still holding cards, discard one&lt;br /&gt;
&lt;br /&gt;
If the player runs out of cards without discarding, they can pick their foot and immediately continue playing from it; this is called &#039;&#039;running to the foot&#039;&#039;.  If the player discards their last card, they can pick up their foot, but not play from it until their next turn; this is called &#039;&#039;walking&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The round ends when a team has completed the required contract, and one of its players plays out both their hand and their foot.  Some house rules require the last card to be discarded, while others allow it to be played.&lt;br /&gt;
&lt;br /&gt;
===Opening criteria===&lt;br /&gt;
A team must meet certain criteria in order to open play on their board.  The requirement is that the opening player must put down cards with a minimum card point value, and typically varies by either which round of play (increasing with each successive round), or by the team&#039;s score.  The most common opening criteria are:&lt;br /&gt;
* Round 1: 50 points to open&lt;br /&gt;
* Round 2: 90 points to open&lt;br /&gt;
* Round 3: 120 points to open&lt;br /&gt;
* Round 4: 150 points to open&lt;br /&gt;
If a tie-breaking fifth round is needed, it will also require 150 points to open.  The point score does not include meld completion bonuses, or any played red 3s.  For example, a completed book of 5s scores 35 points, with a bonus of 500 points for being complete, but is insufficient to open even round 1.&lt;br /&gt;
&lt;br /&gt;
===Playing red 3s===&lt;br /&gt;
A common house rule requires that red 3s are played into a special pile, and immediately replaced &#039;&#039;when it is the player&#039;s turn&#039;&#039;.  This may occur before the draw when the player first plays from either their hand or foot, or when they draw a red 3.  Red 3s played in this manner do not count toward opening criteria.&lt;br /&gt;
&lt;br /&gt;
===Drawing cards===&lt;br /&gt;
Once a player has played any red 3s in their hand, they may choose (or be forced to) draw cards.  This takes place in BGA by clicking on the draw pile, and delivers two cards into the hand.&lt;br /&gt;
&lt;br /&gt;
===Taking the discard===&lt;br /&gt;
If the player is allowed by the house rules, they may pick up the top discard.  Common house rules require the player to (1) have two cards of the same rank in their hand, and (2) be able to immediately play all three cards to the board.  Among other things, this means that his team either (a) has already opened its board, or (b) the player taking the discard can meet the opening criteria for the round.&lt;br /&gt;
&lt;br /&gt;
Once the player has taken and played the discard and associated meld cards, most rules require the taking of additional cards from the discard pile.  This is generally six cards, or the entire pile if it is less, but there are house rules that require the pile to have at least six more cards in it, or that require the taking of the entire discard pile in the manner of traditional Canasta rules.  A discard pile rich in black 3s can discourage the taking of discards.&lt;br /&gt;
&lt;br /&gt;
===Playing cards===&lt;br /&gt;
Playing cards to the board consists of selecting a group of matching cards (all of the same rank with optional wild cards), and clicking on either the &amp;quot;New Meld&amp;quot; panel or the meld of the given rank on the team&#039;s meld board.  If melds are limited in size, you will not be allowed to make a meld have more than seven cards.&lt;br /&gt;
&lt;br /&gt;
You can have only one meld of a given rank open at any time.  In order to create a meld, you must have at least three cards to play to it.  You must always have more non-wild than wild cards in a meld, and common house rules limit the number of wild cards in a completed meld to either 2 or 3.  The BGA version of the game enforces this by a &amp;quot;ratio rule&amp;quot;, requiring a certain percentage of the cards in a meld at any given time to be non-wild.&lt;br /&gt;
&lt;br /&gt;
You cannot play the last card from your foot unless your team has made the contracted melds.  It is for this reason you can &#039;&#039;undo&#039;&#039; your moves.&lt;br /&gt;
&lt;br /&gt;
===Discarding===&lt;br /&gt;
To discard, select a single card, and click on the discard pile.  If it is the last card of your foot, you will not be allowed to discard it if your team does not have the contracted melds.  In that case, you will have to undo your moves, and play so as to have at least one card remaining in your hand after discarding.&lt;br /&gt;
&lt;br /&gt;
==Round and game summaries==&lt;br /&gt;
At the end of each round, a scoring summary is displayed, showing how each team made its points in the round.  At the end of the game, the report includes all of the game rounds.&lt;/div&gt;</summary>
		<author><name>RavingWanderer</name></author>
	</entry>
</feed>