<?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=Cpasbanal</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=Cpasbanal"/>
	<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/Special:Contributions/Cpasbanal"/>
	<updated>2026-11-21T02:37:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Using_Typescript_and_Scss&amp;diff=9278</id>
		<title>Using Typescript and Scss</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Using_Typescript_and_Scss&amp;diff=9278"/>
		<updated>2021-09-01T11:16:56Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* create skeleton */ Fix capitalization&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will help you set up your project to use Typescript client file and Scss style files, and automatically build Javascript (in ES5) files and CSS files so your project stay compatible to BGA framework requirements.&lt;br /&gt;
You can use only TS or only SCSS part if you want, they are not linked.&lt;br /&gt;
&lt;br /&gt;
== How to install the auto-build stack ==&lt;br /&gt;
&lt;br /&gt;
=== Install dev stack  ===&lt;br /&gt;
Install node/npm.  Here is an example to activate auto-build in Visual Studio Code, if you use another tool I strongly recommend to find an equivalent so you don&#039;t have to launch build manually after each modification.&lt;br /&gt;
&lt;br /&gt;
=== Auto build JS and CSS files ===&lt;br /&gt;
In VS Code, add extension https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave and then add to VSCode &amp;lt;code&amp;gt;config.json&amp;lt;/code&amp;gt; extension part :&lt;br /&gt;
        &amp;quot;commands&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;match&amp;quot;: &amp;quot;.*\\.ts$&amp;quot;,&lt;br /&gt;
                &amp;quot;isAsync&amp;quot;: true,&lt;br /&gt;
                &amp;quot;cmd&amp;quot;: &amp;quot;npm run build:ts&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;match&amp;quot;: &amp;quot;.*\\.scss$&amp;quot;,&lt;br /&gt;
                &amp;quot;isAsync&amp;quot;: true,&lt;br /&gt;
                &amp;quot;cmd&amp;quot;: &amp;quot;npm run build:scss&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        ]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;build:ts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;build:scss&amp;lt;/code&amp;gt; are script tasks we&#039;ll configure later.&lt;br /&gt;
&lt;br /&gt;
=== Auto-upload built files ===&lt;br /&gt;
Also add one auto-FTP upload extension (for example https://marketplace.visualstudio.com/items?itemName=lukasz-wronski.ftp-sync) and configure it. The extension will detected modified files in the workspace, including built ones, and upload them to remote server.&lt;br /&gt;
In ignored files section, you can put :&lt;br /&gt;
    &amp;quot;ignore&amp;quot;: [&lt;br /&gt;
        &amp;quot;\\.vscode&amp;quot;,&lt;br /&gt;
        &amp;quot;\\.git&amp;quot;,&lt;br /&gt;
        &amp;quot;\\.DS_Store&amp;quot;,&lt;br /&gt;
        &amp;quot;package.json&amp;quot;,&lt;br /&gt;
        &amp;quot;package-lock.json&amp;quot;,&lt;br /&gt;
        &amp;quot;yarn.lock&amp;quot;,&lt;br /&gt;
        &amp;quot;tsconfig.json&amp;quot;,&lt;br /&gt;
        &amp;quot;src&amp;quot;,&lt;br /&gt;
        &amp;quot;node_modules&amp;quot;,&lt;br /&gt;
        &amp;quot;README.md&amp;quot;&lt;br /&gt;
    ],&lt;br /&gt;
&lt;br /&gt;
=== Hint ===&lt;br /&gt;
Make sure &amp;lt;code&amp;gt;.vscode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;node_modules&amp;lt;/code&amp;gt; are in &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; if you commit your project somewhere.&lt;br /&gt;
&lt;br /&gt;
== Create skeleton ==&lt;br /&gt;
When you create your game in BGA Studio, a JS and CSS file are generated. As we will overwrite them with autobuild. You can put the TS/SCSS files on a &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder to separate them from built files, but that&#039;s not mandatory.&lt;br /&gt;
&lt;br /&gt;
=== Typescript file skeleton ===&lt;br /&gt;
Typescript example here have been stripped down of all comments for clarity. You can view full file with generated comments [https://github.com/thoun/bga-ts-example/blob/main/src/yourgamename.ts here].&lt;br /&gt;
Your TS code can be splitted in multiple files, you can have a look [https://github.com/thoun/bga-ts-example here] for inspiration.&lt;br /&gt;
To make this page concise, I removed comments and code samples. If it&#039;s your first game, I strongly recommend you to report them on the TS file before activating auto-build !&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;your game name&amp;gt;.ts&#039;&#039;&#039;&lt;br /&gt;
 declare const define;&lt;br /&gt;
 declare const ebg;&lt;br /&gt;
 declare const $;&lt;br /&gt;
 //declare const dojo/*: Dojo*/;&lt;br /&gt;
 declare const _;&lt;br /&gt;
 declare const g_gamethemeurl;&lt;br /&gt;
 &lt;br /&gt;
 class &amp;lt;Your game name&amp;gt; /*implements Game*/ {&lt;br /&gt;
 &lt;br /&gt;
     private gamedatas: any;&lt;br /&gt;
     private player_id: string;&lt;br /&gt;
     private players: { [playerId: number]: any /*Player*/ };&lt;br /&gt;
     private playerNumber: number;&lt;br /&gt;
 &lt;br /&gt;
     constructor() {}&lt;br /&gt;
     &lt;br /&gt;
     public setup(gamedatas: any) {&lt;br /&gt;
         this.setupNotifications();&lt;br /&gt;
     } &lt;br /&gt;
     public onEnteringState(stateName: string, args: any) {}&lt;br /&gt;
     public onLeavingState(stateName: string) {}&lt;br /&gt;
     public onUpdateActionButtons(stateName: string, args: any) {} &lt;br /&gt;
     public setupNotifications() {}&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
To plug the class with BGA framework, we&#039;ll also create another file :&lt;br /&gt;
&#039;&#039;&#039;define.ts&#039;&#039;&#039;&lt;br /&gt;
 define([&lt;br /&gt;
     &amp;quot;dojo&amp;quot;,&amp;quot;dojo/_base/declare&amp;quot;,&lt;br /&gt;
     &amp;quot;ebg/core/gamegui&amp;quot;,&lt;br /&gt;
     &amp;quot;ebg/counter&amp;quot;,&lt;br /&gt;
     &amp;quot;ebg/stock&amp;quot;&lt;br /&gt;
 ],&lt;br /&gt;
 function (dojo, declare) {&lt;br /&gt;
     return declare(&amp;quot;bgagame.&amp;lt;your game name&amp;gt;&amp;quot;, ebg.core.gamegui, new &amp;lt;Your game name&amp;gt;());             &lt;br /&gt;
 });&lt;br /&gt;
Copy &amp;lt;code&amp;gt;bgagame.&amp;lt;your game name&amp;gt;&amp;lt;/code&amp;gt; from original JS to avoid name mistakes. &amp;lt;code&amp;gt;new &amp;lt;Your game name&amp;gt;()&amp;lt;/code&amp;gt; must match your class name defined on previous file.&lt;br /&gt;
&lt;br /&gt;
=== SCSS file ===&lt;br /&gt;
Nothing special here, just write classic SCSS (will be compiled by Dart scss) and name it &#039;&#039;&#039;&amp;lt;your game name&amp;gt;.scss&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Your SCSS code can be splitted in multiple files, for example :&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;your game name&amp;gt;.scss&#039;&#039;&#039;&lt;br /&gt;
  @import &#039;gametable&#039;;&lt;br /&gt;
 &lt;br /&gt;
  /* some classes */&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;_gametable.scss&#039;&#039;&#039;&lt;br /&gt;
  /* _gametable related classes */&lt;br /&gt;
&lt;br /&gt;
=== Configure package.json and tsconfig.json ===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;code&amp;gt;package.json&amp;lt;/code&amp;gt; on the root folder, not on the src folder.&lt;br /&gt;
&#039;&#039;&#039;package.json&#039;&#039;&#039;&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;name&amp;quot;: &amp;quot;&amp;lt;your game name&amp;gt;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot;: &amp;quot;1.0.0&amp;quot;,&lt;br /&gt;
   &amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
   &amp;quot;main&amp;quot;: &amp;quot;&amp;lt;your game name&amp;gt;.js&amp;quot;,&lt;br /&gt;
   &amp;quot;scripts&amp;quot;: {&lt;br /&gt;
     &amp;quot;build:ts&amp;quot;: &amp;quot;tsc&amp;quot;,&lt;br /&gt;
     &amp;quot;build:scss&amp;quot;: &amp;quot;sass --no-source-map src/&amp;lt;your game name&amp;gt;.scss &amp;lt;your game name&amp;gt;.css&amp;quot;&lt;br /&gt;
   },&lt;br /&gt;
   &amp;quot;author&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
   &amp;quot;license&amp;quot;: &amp;quot;ISC&amp;quot;,&lt;br /&gt;
   &amp;quot;devDependencies&amp;quot;: {&lt;br /&gt;
     &amp;quot;sass&amp;quot;: &amp;quot;^1.32.6&amp;quot;,&lt;br /&gt;
     &amp;quot;typescript&amp;quot;: &amp;quot;^4.1.3&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
When package.json is created, run &amp;lt;code&amp;gt;npm i&amp;lt;/code&amp;gt; on the root folder to install builders (will generate a node_modules folder).&lt;br /&gt;
&lt;br /&gt;
For Typescript compilation we also need to set up a &amp;lt;code&amp;gt;tsconfig.json&amp;lt;/code&amp;gt; on the root folder.&lt;br /&gt;
&#039;&#039;&#039;tsconfig.json&#039;&#039;&#039;&lt;br /&gt;
 {&lt;br /&gt;
     &amp;quot;rootDir&amp;quot;: &amp;quot;.&amp;quot;, &lt;br /&gt;
     &amp;quot;compilerOptions&amp;quot;: {&lt;br /&gt;
       &amp;quot;target&amp;quot;: &amp;quot;es5&amp;quot;,&lt;br /&gt;
       &amp;quot;module&amp;quot;: &amp;quot;none&amp;quot;,&lt;br /&gt;
       &amp;quot;lib&amp;quot;: [&amp;quot;dom&amp;quot;, &amp;quot;esnext&amp;quot;],  &lt;br /&gt;
       &amp;quot;sourceMap&amp;quot;: false,&lt;br /&gt;
       &amp;quot;outFile&amp;quot;: &amp;quot;&amp;lt;your game name&amp;gt;.js&amp;quot;,&lt;br /&gt;
     },&lt;br /&gt;
     &amp;quot;files&amp;quot;: [&lt;br /&gt;
         &amp;quot;src/&amp;lt;your game name&amp;gt;.ts&amp;quot;,&lt;br /&gt;
         &amp;quot;src/define.ts&amp;quot;&lt;br /&gt;
     ]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
If you want to split your code onto multiple files, just add them in the file list (order is important for dependencies, new subpart should go on top of the list). No need to import classes or types from one file to another. In fact, you can&#039;t with this configuration. If you manage to make them work, please contact me and we&#039;ll update this documentation.&lt;br /&gt;
&lt;br /&gt;
=== Code completion ===&lt;br /&gt;
To add code completion on framework, doko, stock, ... you&#039;ll need definition files. Feel free to copy them from [https://github.com/thoun/bga-ts-example this repo] and reference them at the top of files array, even before your subpart files.&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Using_Typescript_and_Scss&amp;diff=9277</id>
		<title>Using Typescript and Scss</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Using_Typescript_and_Scss&amp;diff=9277"/>
		<updated>2021-09-01T11:15:59Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Install dev stack */ fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will help you set up your project to use Typescript client file and Scss style files, and automatically build Javascript (in ES5) files and CSS files so your project stay compatible to BGA framework requirements.&lt;br /&gt;
You can use only TS or only SCSS part if you want, they are not linked.&lt;br /&gt;
&lt;br /&gt;
== How to install the auto-build stack ==&lt;br /&gt;
&lt;br /&gt;
=== Install dev stack  ===&lt;br /&gt;
Install node/npm.  Here is an example to activate auto-build in Visual Studio Code, if you use another tool I strongly recommend to find an equivalent so you don&#039;t have to launch build manually after each modification.&lt;br /&gt;
&lt;br /&gt;
=== Auto build JS and CSS files ===&lt;br /&gt;
In VS Code, add extension https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave and then add to VSCode &amp;lt;code&amp;gt;config.json&amp;lt;/code&amp;gt; extension part :&lt;br /&gt;
        &amp;quot;commands&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;match&amp;quot;: &amp;quot;.*\\.ts$&amp;quot;,&lt;br /&gt;
                &amp;quot;isAsync&amp;quot;: true,&lt;br /&gt;
                &amp;quot;cmd&amp;quot;: &amp;quot;npm run build:ts&amp;quot;&lt;br /&gt;
            },&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;match&amp;quot;: &amp;quot;.*\\.scss$&amp;quot;,&lt;br /&gt;
                &amp;quot;isAsync&amp;quot;: true,&lt;br /&gt;
                &amp;quot;cmd&amp;quot;: &amp;quot;npm run build:scss&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        ]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;build:ts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;build:scss&amp;lt;/code&amp;gt; are script tasks we&#039;ll configure later.&lt;br /&gt;
&lt;br /&gt;
=== Auto-upload built files ===&lt;br /&gt;
Also add one auto-FTP upload extension (for example https://marketplace.visualstudio.com/items?itemName=lukasz-wronski.ftp-sync) and configure it. The extension will detected modified files in the workspace, including built ones, and upload them to remote server.&lt;br /&gt;
In ignored files section, you can put :&lt;br /&gt;
    &amp;quot;ignore&amp;quot;: [&lt;br /&gt;
        &amp;quot;\\.vscode&amp;quot;,&lt;br /&gt;
        &amp;quot;\\.git&amp;quot;,&lt;br /&gt;
        &amp;quot;\\.DS_Store&amp;quot;,&lt;br /&gt;
        &amp;quot;package.json&amp;quot;,&lt;br /&gt;
        &amp;quot;package-lock.json&amp;quot;,&lt;br /&gt;
        &amp;quot;yarn.lock&amp;quot;,&lt;br /&gt;
        &amp;quot;tsconfig.json&amp;quot;,&lt;br /&gt;
        &amp;quot;src&amp;quot;,&lt;br /&gt;
        &amp;quot;node_modules&amp;quot;,&lt;br /&gt;
        &amp;quot;README.md&amp;quot;&lt;br /&gt;
    ],&lt;br /&gt;
&lt;br /&gt;
=== Hint ===&lt;br /&gt;
Make sure &amp;lt;code&amp;gt;.vscode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;node_modules&amp;lt;/code&amp;gt; are in &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; if you commit your project somewhere.&lt;br /&gt;
&lt;br /&gt;
== create skeleton ==&lt;br /&gt;
When you create your game in BGA Studio, a JS and CSS file are generated. As we will overwrite them with autobuild. You can put the TS/SCSS files on a &amp;lt;code&amp;gt;src&amp;lt;/code&amp;gt; folder to separate them from built files, but that&#039;s not mandatory.&lt;br /&gt;
&lt;br /&gt;
=== Typescript file skeleton ===&lt;br /&gt;
Typescript example here have been stripped down of all comments for clarity. You can view full file with generated comments [https://github.com/thoun/bga-ts-example/blob/main/src/yourgamename.ts here].&lt;br /&gt;
Your TS code can be splitted in multiple files, you can have a look [https://github.com/thoun/bga-ts-example here] for inspiration.&lt;br /&gt;
To make this page concise, I removed comments and code samples. If it&#039;s your first game, I strongly recommend you to report them on the TS file before activating auto-build !&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;your game name&amp;gt;.ts&#039;&#039;&#039;&lt;br /&gt;
 declare const define;&lt;br /&gt;
 declare const ebg;&lt;br /&gt;
 declare const $;&lt;br /&gt;
 //declare const dojo/*: Dojo*/;&lt;br /&gt;
 declare const _;&lt;br /&gt;
 declare const g_gamethemeurl;&lt;br /&gt;
 &lt;br /&gt;
 class &amp;lt;Your game name&amp;gt; /*implements Game*/ {&lt;br /&gt;
 &lt;br /&gt;
     private gamedatas: any;&lt;br /&gt;
     private player_id: string;&lt;br /&gt;
     private players: { [playerId: number]: any /*Player*/ };&lt;br /&gt;
     private playerNumber: number;&lt;br /&gt;
 &lt;br /&gt;
     constructor() {}&lt;br /&gt;
     &lt;br /&gt;
     public setup(gamedatas: any) {&lt;br /&gt;
         this.setupNotifications();&lt;br /&gt;
     } &lt;br /&gt;
     public onEnteringState(stateName: string, args: any) {}&lt;br /&gt;
     public onLeavingState(stateName: string) {}&lt;br /&gt;
     public onUpdateActionButtons(stateName: string, args: any) {} &lt;br /&gt;
     public setupNotifications() {}&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
To plug the class with BGA framework, we&#039;ll also create another file :&lt;br /&gt;
&#039;&#039;&#039;define.ts&#039;&#039;&#039;&lt;br /&gt;
 define([&lt;br /&gt;
     &amp;quot;dojo&amp;quot;,&amp;quot;dojo/_base/declare&amp;quot;,&lt;br /&gt;
     &amp;quot;ebg/core/gamegui&amp;quot;,&lt;br /&gt;
     &amp;quot;ebg/counter&amp;quot;,&lt;br /&gt;
     &amp;quot;ebg/stock&amp;quot;&lt;br /&gt;
 ],&lt;br /&gt;
 function (dojo, declare) {&lt;br /&gt;
     return declare(&amp;quot;bgagame.&amp;lt;your game name&amp;gt;&amp;quot;, ebg.core.gamegui, new &amp;lt;Your game name&amp;gt;());             &lt;br /&gt;
 });&lt;br /&gt;
Copy &amp;lt;code&amp;gt;bgagame.&amp;lt;your game name&amp;gt;&amp;lt;/code&amp;gt; from original JS to avoid name mistakes. &amp;lt;code&amp;gt;new &amp;lt;Your game name&amp;gt;()&amp;lt;/code&amp;gt; must match your class name defined on previous file.&lt;br /&gt;
&lt;br /&gt;
=== SCSS file ===&lt;br /&gt;
Nothing special here, just write classic SCSS (will be compiled by Dart scss) and name it &#039;&#039;&#039;&amp;lt;your game name&amp;gt;.scss&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Your SCSS code can be splitted in multiple files, for example :&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;your game name&amp;gt;.scss&#039;&#039;&#039;&lt;br /&gt;
  @import &#039;gametable&#039;;&lt;br /&gt;
 &lt;br /&gt;
  /* some classes */&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;_gametable.scss&#039;&#039;&#039;&lt;br /&gt;
  /* _gametable related classes */&lt;br /&gt;
&lt;br /&gt;
=== Configure package.json and tsconfig.json ===&lt;br /&gt;
&lt;br /&gt;
Create a file named &amp;lt;code&amp;gt;package.json&amp;lt;/code&amp;gt; on the root folder, not on the src folder.&lt;br /&gt;
&#039;&#039;&#039;package.json&#039;&#039;&#039;&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;name&amp;quot;: &amp;quot;&amp;lt;your game name&amp;gt;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot;: &amp;quot;1.0.0&amp;quot;,&lt;br /&gt;
   &amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
   &amp;quot;main&amp;quot;: &amp;quot;&amp;lt;your game name&amp;gt;.js&amp;quot;,&lt;br /&gt;
   &amp;quot;scripts&amp;quot;: {&lt;br /&gt;
     &amp;quot;build:ts&amp;quot;: &amp;quot;tsc&amp;quot;,&lt;br /&gt;
     &amp;quot;build:scss&amp;quot;: &amp;quot;sass --no-source-map src/&amp;lt;your game name&amp;gt;.scss &amp;lt;your game name&amp;gt;.css&amp;quot;&lt;br /&gt;
   },&lt;br /&gt;
   &amp;quot;author&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
   &amp;quot;license&amp;quot;: &amp;quot;ISC&amp;quot;,&lt;br /&gt;
   &amp;quot;devDependencies&amp;quot;: {&lt;br /&gt;
     &amp;quot;sass&amp;quot;: &amp;quot;^1.32.6&amp;quot;,&lt;br /&gt;
     &amp;quot;typescript&amp;quot;: &amp;quot;^4.1.3&amp;quot;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
When package.json is created, run &amp;lt;code&amp;gt;npm i&amp;lt;/code&amp;gt; on the root folder to install builders (will generate a node_modules folder).&lt;br /&gt;
&lt;br /&gt;
For Typescript compilation we also need to set up a &amp;lt;code&amp;gt;tsconfig.json&amp;lt;/code&amp;gt; on the root folder.&lt;br /&gt;
&#039;&#039;&#039;tsconfig.json&#039;&#039;&#039;&lt;br /&gt;
 {&lt;br /&gt;
     &amp;quot;rootDir&amp;quot;: &amp;quot;.&amp;quot;, &lt;br /&gt;
     &amp;quot;compilerOptions&amp;quot;: {&lt;br /&gt;
       &amp;quot;target&amp;quot;: &amp;quot;es5&amp;quot;,&lt;br /&gt;
       &amp;quot;module&amp;quot;: &amp;quot;none&amp;quot;,&lt;br /&gt;
       &amp;quot;lib&amp;quot;: [&amp;quot;dom&amp;quot;, &amp;quot;esnext&amp;quot;],  &lt;br /&gt;
       &amp;quot;sourceMap&amp;quot;: false,&lt;br /&gt;
       &amp;quot;outFile&amp;quot;: &amp;quot;&amp;lt;your game name&amp;gt;.js&amp;quot;,&lt;br /&gt;
     },&lt;br /&gt;
     &amp;quot;files&amp;quot;: [&lt;br /&gt;
         &amp;quot;src/&amp;lt;your game name&amp;gt;.ts&amp;quot;,&lt;br /&gt;
         &amp;quot;src/define.ts&amp;quot;&lt;br /&gt;
     ]&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
If you want to split your code onto multiple files, just add them in the file list (order is important for dependencies, new subpart should go on top of the list). No need to import classes or types from one file to another. In fact, you can&#039;t with this configuration. If you manage to make them work, please contact me and we&#039;ll update this documentation.&lt;br /&gt;
&lt;br /&gt;
=== Code completion ===&lt;br /&gt;
To add code completion on framework, doko, stock, ... you&#039;ll need definition files. Feel free to copy them from [https://github.com/thoun/bga-ts-example this repo] and reference them at the top of files array, even before your subpart files.&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=9275</id>
		<title>Stock</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=9275"/>
		<updated>2021-08-31T16:49:31Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Creation */ update typo on horizontally&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stock&#039;&#039;&#039; is a javascript component that you can use in your game interface to display a set of elements of the same size that need to be arranged in single or multiple lines.&lt;br /&gt;
&lt;br /&gt;
Stock is very flexible and is the most used component in BGA games.&lt;br /&gt;
&lt;br /&gt;
Examples of stock use cases:&lt;br /&gt;
&lt;br /&gt;
* Display a set of cards, typically hands (examples: &#039;&#039;Hearts&#039;&#039;, &#039;&#039;Seasons&#039;&#039;, &#039;&#039;The Boss&#039;&#039;, &#039;&#039;Race for the Galaxy&#039;&#039;).&lt;br /&gt;
* Display items in player panels (examples: &#039;&#039;Takenoko&#039;&#039;, &#039;&#039;Amyitis&#039;&#039;, ...)&lt;br /&gt;
* ... Many other situations. For example, black dice and cubes on cards in &#039;&#039;Troyes&#039;&#039; are displayed with stock components.&lt;br /&gt;
&lt;br /&gt;
Using stock:&lt;br /&gt;
&lt;br /&gt;
* Your items are arranged nicely and sorted by type.&lt;br /&gt;
* When adding or removing items to a set, all items slide smoothly to their new position in the set.&lt;br /&gt;
* Selecting and unselecting items are built-in functions.&lt;br /&gt;
* You don&#039;t have to worry about inserting/removing HTML code; the entire life cycle of the stock is managed by the component.&lt;br /&gt;
&lt;br /&gt;
== Using stock: a simple example ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s have a look on how the stock is used in the game &#039;&#039;Hearts&#039;&#039; to display a hand of standard cards.&lt;br /&gt;
&lt;br /&gt;
First, don&#039;t forget to add &amp;quot;ebg/stock&amp;quot; as a dependency in your js file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
define([&lt;br /&gt;
    &amp;quot;dojo&amp;quot;,&amp;quot;dojo/_base/declare&amp;quot;,&lt;br /&gt;
    &amp;quot;ebg/core/gamegui&amp;quot;,&lt;br /&gt;
    &amp;quot;ebg/counter&amp;quot;,&lt;br /&gt;
    &amp;quot;ebg/stock&amp;quot;     /// &amp;lt;==== HERE&lt;br /&gt;
],&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The stock is initialized in the Javascript &amp;quot;setup&amp;quot; method like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Player hand&lt;br /&gt;
    this.playerHand = new ebg.stock();&lt;br /&gt;
    this.playerHand.create( this, $(&#039;myhand&#039;), this.cardwidth, this.cardheight );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanations:&lt;br /&gt;
* We create a new stock object for the player hand.&lt;br /&gt;
* As parameters of the &amp;quot;create&amp;quot; method, we provide the width/height of an item (a card), and the div container &amp;quot;myhand&amp;quot; - which is a simple empty &amp;quot;div&amp;quot; element defined in our HTML template (.tpl).&lt;br /&gt;
&lt;br /&gt;
Then, we must tell the stock what items it is going to display during its life: the 52 cards of a standard card game. Of course, we did not create 52 different images, but a &amp;quot;CSS sprite&amp;quot; image named &amp;quot;cards.jpg&amp;quot; with the cards arranged in 4 rows and 13 columns.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how we tell stock what items to display:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Specify that there are 13 images per row in the CSS sprite image&lt;br /&gt;
    this.playerHand.image_items_per_row = 13;&lt;br /&gt;
&lt;br /&gt;
    // Create card types:&lt;br /&gt;
    for( var color=1;color&amp;lt;=4;color++ )&lt;br /&gt;
    {&lt;br /&gt;
        for( var value=2;value&amp;lt;=14;value++ )&lt;br /&gt;
        {&lt;br /&gt;
            // Build card type id&lt;br /&gt;
            var card_type_id = this.getCardUniqueId( color, value );&lt;br /&gt;
            this.playerHand.addItemType( card_type_id, card_type_id, g_gamethemeurl+&#039;img/cards.jpg&#039;, card_type_id );&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation:&lt;br /&gt;
&lt;br /&gt;
* First, we tell the stock component that our CSS sprite contains 13 items per row. This way, it can find the correct image for each card type id.&lt;br /&gt;
* Then for the 4x13 cards, we call the &amp;quot;addItemType&amp;quot; method that creates the type. The arguments are the type id, the weight of the card (for sorting purpose), the URL of our CSS sprite, and the position of our card image in the CSS sprite.&lt;br /&gt;
&lt;br /&gt;
Note: In this specific example we need to generate a unique ID for each type of card based on its color and value. This is the only purpose of &amp;quot;getCardUniqueId&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
From now on, if we need to add a card - for example, the 5 of Hearts - to a player&#039;s hand, we can do this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
this.playerHand.addToStock( this.getCardUniqueId( 2 /* 2=hearts */, 5 ) );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In reality, cards have some IDs, which are useful to manipulate them. This is the reason we are using &amp;quot;addToStockWithId&amp;quot; instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
this.playerHand.addToStockWithId( this.getCardUniqueId( 2 /* 2=hearts */, 5 ), my_card_id );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If afterwards we want to remove this card from the stock:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
this.playerHand.removeFromStockById( my_card_id );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete stock component reference ==&lt;br /&gt;
&lt;br /&gt;
=== Creation ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;create( page, container_div, item_width, item_height ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With create, you create a new stock component.&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
* page: the container page. Usually: &amp;quot;this&amp;quot;.&lt;br /&gt;
* container_div: the container &amp;quot;div&amp;quot; element (an empty div element in your template, with an id).&lt;br /&gt;
* width and height (in pixels) for the stock component.&lt;br /&gt;
&lt;br /&gt;
(See &#039;&#039;Hearts&#039;&#039; example above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;addItemType( type, weight, image, image_position ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Define a new type of item and add it to the stock.&lt;br /&gt;
&lt;br /&gt;
This is mandatory to define a new item type before adding it to the stock. Example: if you want to have a stock contain cubes of 3 different colors, you must add 3 item types (one for each color).&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
* {int} type: id of the type to add. You can choose any positive integer. All item types must have distinct IDs.&lt;br /&gt;
* {int} weight: weight of items of this type. Weight value is used to sort items of the stock during the display. Note that you can specify the same weight for all items; in this case, they are not sorted and their order might change randomly at any time.&lt;br /&gt;
* {string} image: URL of item image. Most of the time, you will use a CSS sprite for stock items, so you have to specify CSS sprite image here.&lt;br /&gt;
&lt;br /&gt;
Be careful: you must specify the image url as this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  g_gamethemeurl+&#039;img/yourimage.png&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* image_position: if &amp;quot;image&amp;quot; specify the URL of a CSS sprite, you must specify the position of the item image in this CSS sprite. For example, if you have a CSS sprite with 3 cubes with a size of 20x20 pixels each (so your CSS image has for example a size of 20x60 or 60x20), you specify &amp;quot;0&amp;quot; for the first cube image, 1 for the second, 2 for the third.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Important&#039;&#039;: if there is more than one line of items in your CSS sprite,  you must specify how many items per line you have in your CSS sprite, see image_items_per_row below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;image_items_per_row&#039;&#039;&#039;&lt;br /&gt;
Class member to set number of columns in css sprite (or how many items per row). I.e. if you sprite is 4 cards horizontally and 6 vertically, you have to set it to 4.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Specify that there are 10 image items per row in images used in &amp;quot;myStockObject&amp;quot; control.&lt;br /&gt;
    this.myStockObject.image_items_per_row = 4;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add/Remove items ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;addToStock( type, from )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add an item to the stock, with the specified type, but without a unique ID.&lt;br /&gt;
&lt;br /&gt;
To make your life easier, in most cases we suggest you use &#039;&#039;&#039;addToStockWithId&#039;&#039;&#039; in order to give an ID to the item added. &#039;&#039;&#039;addToStock&#039;&#039;&#039; is suitable when you are using a stock to control items that are generic game materials that don&#039;t need to be tracked individually (example: a bunch of money tokens).&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
* type: ID of the item type to use (as specified in &amp;quot;addItemType&amp;quot;)&lt;br /&gt;
* from: OPTIONAL: if you specify an HTML item here, the item will appear on this item and will be slid to its position on the stock item.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  // Add a money token to the &amp;quot;player money&amp;quot; stock.&lt;br /&gt;
  // The money token will appear on &amp;quot;player_id&amp;quot; player panel and will move to its position.&lt;br /&gt;
  this.playerMoney.addToStock( MONEY_TOKEN, &#039;overall_player_board_&#039;+player_id );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Important: for a given stock control, you must use either &#039;&#039;&#039;addToStock&#039;&#039;&#039; or &#039;&#039;&#039;addToStockWithId&#039;&#039;&#039;, but NEVER BOTH OF THEM.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;addToStockWithId( type, id, from )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is the same method as &#039;&#039;&#039;addToStock&#039;&#039;&#039;, except that it also associates an ID with the newly created item.&lt;br /&gt;
&lt;br /&gt;
This is especially useful:&lt;br /&gt;
&lt;br /&gt;
* When you need to know which item(s) have been selected by the user (see &#039;&#039;&#039;getSelectedItems&#039;&#039;&#039;).&lt;br /&gt;
* When you need to remove a specific item from the stock with &#039;&#039;&#039;removeFromStockById&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeFromStock( type, to, noupdate )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Remove an item of the specific type from the stock.&lt;br /&gt;
&lt;br /&gt;
&#039;to&#039; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the Stock slides to this HTML element before it disappears. Note that this method does not expose the associated animation object, however, so it&#039;s not possible to trigger other actions when it finishes, for example. If you need to do that, use Dojo&#039;s slideToObject() instead.&lt;br /&gt;
&lt;br /&gt;
&#039;noupdate&#039; is an optional parameter. If set to &amp;quot;true&amp;quot; it will prevent the Stock display from changing. This is useful when multiple (but not all) items are removed at the same time, to avoid ghost items appearing briefly. If you pass noupdate you have to call updateDisplay() after all items are removed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeFromStockById( id, to, noupdate )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Remove an item with a specific ID from the stock.&lt;br /&gt;
&lt;br /&gt;
&#039;to&#039; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the Stock slides to this HTML element before it disappears. Note that this method does not expose the associated animation object, however, so it&#039;s not possible to trigger other actions when it finishes, for example. If you need to do that, use Dojo&#039;s slideToObject() instead.&lt;br /&gt;
&lt;br /&gt;
&#039;noupdate&#039; is an optional parameter. If set to &amp;quot;true&amp;quot; it will prevent the Stock display from changing. This is useful when multiple (but not all) items are removed at the same time, to avoid ghost items appearing briefly. If you pass noupdate you have to call updateDisplay() after all items are removed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeAll()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Remove all items from the stock.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeAllTo( to )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Remove all items from the stock. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock slides to this HTML element before it disappears.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Getters ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPresentTypeList()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return an array with all the types of items present in the stock right now.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    this.myStockControl.removeAll();&lt;br /&gt;
    this.myStockControl.addToStock( 65 );&lt;br /&gt;
    this.myStockControl.addToStock( 34 );&lt;br /&gt;
    this.myStockControl.addToStock( 89 );&lt;br /&gt;
    this.myStockControl.addToStock( 65 );&lt;br /&gt;
    &lt;br /&gt;
    // The following returns: { 34:1,  65:1,  89:1  }&lt;br /&gt;
    var item_types = this.myStockControl.getPresentTypeList();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;count():&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the total number of items in the stock right now.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getAllItems()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all items (same format as getSelectedItems and getUnselectedItems).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getItemDivId(id)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the div id using the stock item id (to manipulate element properties directly).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getItemById(id)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the Stock item with the id in parameter&lt;br /&gt;
ex : return the object { type:1,  id:  1001 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Selection ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;setSelectionMode( mode )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For each stock control, you can specify a selection mode:&lt;br /&gt;
* 0: no item can be selected by the player.&lt;br /&gt;
* 1: a maximum of one item can be selected by the player at a time.&lt;br /&gt;
* 2 (default): multiple items can be selected by the player at the same time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;setSelectionAppearance( type )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For each stock control, you can specify a selection highlighting type:&lt;br /&gt;
* &#039;border&#039;: there will be a red border around selected items (this is the default). The attribute &#039;apparenceBorderWidth&#039; can be used to manage the width of the border (in pixels).&lt;br /&gt;
* &#039;disappear&#039;: the selected item will fade out and disappear. This is useful when the selection has the effect of destroying the item.&lt;br /&gt;
* &#039;class&#039;: there will be an extra &#039;&#039;&#039;stockitem_selected&#039;&#039;&#039; css class added to the element when it is selected (and removed when unselected). The name of the class can be changed by using the &#039;&#039;&#039;selectionClass&#039;&#039;&#039; attribute. You can also override the default class in the css file for your game but beware of the &#039;&#039;&#039;!important&#039;&#039;&#039; keyword.&lt;br /&gt;
&lt;br /&gt;
By default this class definition is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
.stockitem_selected {&lt;br /&gt;
	border: 2px solid red ! important;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to override it (for example, to change the border color) add this in your &amp;lt;game&amp;gt;.css file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
.stockitem_selected {&lt;br /&gt;
	border: 2px solid orange ! important;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;isSelected( id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return a boolean indicating whether the specified item id has been selected.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;selectItem( id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Select the specified item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;unselectItem( id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Unselect the specified item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;unselectAll()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Unselect all items of the stock.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;onChangeSelection&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This callback method is called when the player selects/unselects an item of the stock.&lt;br /&gt;
&lt;br /&gt;
You can connect this to one of your methods like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    dojo.connect( this.myStockControl, &#039;onChangeSelection&#039;, this, &#039;onMyMethodToCall&#039; );&lt;br /&gt;
    &lt;br /&gt;
    (...)&lt;br /&gt;
    &lt;br /&gt;
    onMyMethodToCall: function( control_name, item_id )&lt;br /&gt;
    {&lt;br /&gt;
        // This method is called when myStockControl selected items changed&lt;br /&gt;
        var items = this.myStockControl.getSelectedItems();&lt;br /&gt;
        &lt;br /&gt;
        // (do something)&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nota bene: &lt;br /&gt;
- The &amp;quot;control_name&amp;quot; argument is the ID (the &amp;quot;DOM&amp;quot; id) of the &amp;quot;div&amp;quot; container of your stock control. Using &amp;quot;control_name&amp;quot;, you can use the same callback method for different Stock control and see which one trigger the method.&lt;br /&gt;
- The &amp;quot;item_id&amp;quot; argument is the stock ID (index) of the stock item that has just been selected/unselected.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getSelectedItems()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the list of selected items, as an array with the following format:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[&lt;br /&gt;
   { type:1,  id:  1001 },&lt;br /&gt;
   { type:1,  id:  1002 },&lt;br /&gt;
   { type:3,  id:  1003 }&lt;br /&gt;
   ...&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getUnselectedItems()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Same as the previous one, but return unselected item instead of seleted ones.&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;resetItemsPosition()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you moved an item from the stock control manually (ex: after a drag&#039;n&#039;drop) and want to reset their positions to their original ones, you can call this method.&lt;br /&gt;
Note: it is the same as updateDisplay() without arugment, not sure why there are two methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;updateDisplay(from)&#039;&#039;&#039;&lt;br /&gt;
Update the display completely (if &#039;from&#039; is defined: moves new items from this location).&lt;br /&gt;
&lt;br /&gt;
Example code if you change the underlying stock item, or otherwise want to make the stock item refresh:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    this.myStockControl.updateDisplay();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;item_margin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By default, there is a margin of 5px between the items of a stock. You can change the member variable &amp;quot;item_margin&amp;quot; to change this.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     this.myStockControl.item_margin=5;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;changeItemsWeight( newWeights )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this method you can change dynamically the weight of the item types in a stock control.&lt;br /&gt;
&lt;br /&gt;
Items are immediately re-sorted with the new weight.&lt;br /&gt;
&lt;br /&gt;
Example: with a stock control that contains classic cards, you can order them by value or by color. Using changeItemsWeight you can switch from one sort method to another when a player request this.&lt;br /&gt;
&lt;br /&gt;
newWeights is an associative array: item type id =&amp;gt; new weight.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Item type 1 gets a new weight of 10, 2 a new weight of 20, 3 a new weight of 30.&lt;br /&gt;
    this.myStockControl.changeItemsWeight( { 1: 10, 2: 20, 3: 30 } );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example2:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Be careful with object initialisers with variables, use the bracket notation.&lt;br /&gt;
    // Item type 1 gets a new weight of 10&lt;br /&gt;
    var card_type = 1;&lt;br /&gt;
    this.myStockControl.changeItemsWeight( { [card_type]: 10 } );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;centerItems&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Center the stock items in the middle of the stock container.&lt;br /&gt;
e.g. this.myStock.centerItems = true; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;setOverlap( horizontal_percent, vertical_percent )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make items of the stock control &amp;quot;overlap&amp;quot; each other, to save space.&lt;br /&gt;
&lt;br /&gt;
By default, horizontal_overlap and vertical_overlap are 0.&lt;br /&gt;
&lt;br /&gt;
When horizontal_overlap=20, it means that a stock item will overlap to only show 20% of the width of all the previous items. horizontal_overlap can&#039;t be greater than 100.&lt;br /&gt;
&lt;br /&gt;
vertical_overlap works differently: one items on two are shifted up.&lt;br /&gt;
&lt;br /&gt;
See the games &amp;quot;Jaipur&amp;quot; or &amp;quot;Koryŏ&amp;quot; to see examples of use of this function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;autowidth&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Stock does not play well if you attempt to inline-block it with other blocks, to fix that you have to set this flag which will calculate width properly&lt;br /&gt;
   mystock.autowidth = true;&lt;br /&gt;
&lt;br /&gt;
=== Customize apperance ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;extraClasses&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Can be set to a list of class names (separated by space) on stock object, so when div is created these are added, i.e.&lt;br /&gt;
&lt;br /&gt;
  this.playerHand.extraClasses=&#039;mycard&#039;;&lt;br /&gt;
&lt;br /&gt;
Note that it is the same list for all items.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;onItemCreate&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Using onItemCreate, you can trigger a method each time a new item is added to the Stock, in order to customize it.&lt;br /&gt;
&lt;br /&gt;
Complete example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // During &amp;quot;setup&amp;quot; phase, we associate our method &amp;quot;setupNewCard&amp;quot; with the creation of a new stock item:&lt;br /&gt;
    this.myStockItem.onItemCreate = dojo.hitch( this, &#039;setupNewCard&#039; ); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // And here is our &amp;quot;setupNewCard&amp;quot;:&lt;br /&gt;
    setupNewCard: function( card_div, card_type_id, card_id )&lt;br /&gt;
    {&lt;br /&gt;
       // Add a special tooltip on the card:&lt;br /&gt;
       this.addTooltip( card_div.id, _(&amp;quot;Some nice tooltip for this item&amp;quot;), &#039;&#039; );&lt;br /&gt;
&lt;br /&gt;
       // Note that &amp;quot;card_type_id&amp;quot; contains the type of the item, so you can do special actions depending on the item type&lt;br /&gt;
&lt;br /&gt;
       // Add some custom HTML content INSIDE the Stock item:&lt;br /&gt;
       dojo.place( this.format_block( &#039;jstpl_my_card_content&#039;, {&lt;br /&gt;
                                ....&lt;br /&gt;
                           } ), card_div.id );&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;onItemDelete&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Function handler called when div is removed&lt;br /&gt;
&lt;br /&gt;
   this.myStock.onItemDelete = (card_div, card_type_id, card_id) =&amp;gt; { console.log(&amp;quot;card deleted from myStock: &amp;quot;+card_id); };&lt;br /&gt;
&lt;br /&gt;
== Tips when adding/removing items to/from Stock components ==&lt;br /&gt;
&lt;br /&gt;
Most cases will be one of the following situations:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Situation A&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
When you add a card to a stock item, and this card is &#039;&#039;&#039;not&#039;&#039;&#039; coming from another stock:&lt;br /&gt;
&lt;br /&gt;
* Use &#039;&#039;&#039;addToStockWithId&#039;&#039;&#039; with a &amp;quot;from&amp;quot; argument set to the element of your interface where the card should come from (i.e. div id). For example if you want to &amp;quot;reveal&amp;quot; card from player hand and it is not an interface element you can set from to be &#039;player_board_&#039;+activePlayerId (where activePlayerId is player who played that card).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Situation B&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
When you add a card to a stock item, and this card is coming from another stock:&lt;br /&gt;
&lt;br /&gt;
* On the destination Stock, use &#039;&#039;&#039;addToStockWithId&#039;&#039;&#039; with a &amp;quot;from&amp;quot; argument which is the HTML id of the corresponding item in the source Stock. For example, if the source stock id is &amp;quot;myHand&amp;quot;, then the HTML id of card 48 is &amp;quot;myHand_item_48&amp;quot;.&lt;br /&gt;
* Then, remove the source item with &#039;&#039;&#039;removeFromStockById&#039;&#039;&#039;. Note: do NOT set the &#039;to&#039; argument in this call, otherwise you&#039;ll get two animations.&lt;br /&gt;
&lt;br /&gt;
(Note that it&#039;s important to do things in this order, because the source item must still exist when you use it as the origin of the slide.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Situation C&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
When you move a card from a stock item to something that is not a stock item:&lt;br /&gt;
&lt;br /&gt;
* Insert the card as a classic HTML template (dojo.place / this.format_block).&lt;br /&gt;
* Place it on the Stock item with &#039;&#039;&#039;this.placeOnObject&#039;&#039;&#039;, using the Stock item HTML id (see above).&lt;br /&gt;
* Slide it to its new position with &#039;&#039;&#039;this.slideToObject&#039;&#039;&#039;.&lt;br /&gt;
* Remove the card from the Stock item with &#039;&#039;&#039;removeFromStockById&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Using the methods above, your cards should slide to, from, and between your Stock controls smoothly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can customize this (showing the default value):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this.mystock.jstpl_stock_item= &amp;quot;&amp;lt;div id=\&amp;quot;${id}\&amp;quot; class=\&amp;quot;stockitem\&amp;quot; style=\&amp;quot;top:${top}px;left:${left}px;width:${width}px;height:${height}px;z-index:${position};background-image:url(&#039;${image}&#039;);\&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To produce a different type of stock item&lt;br /&gt;
&lt;br /&gt;
== Known issues ==&lt;br /&gt;
&lt;br /&gt;
==== Incorrectly displayed sprites on Safari ====&lt;br /&gt;
&lt;br /&gt;
As mentioned above, stock displays its images using &amp;quot;sprites&amp;quot; consisting of a portion of a larger image. To accomplish this, it uses the CSS background-position attribute in negative multiples of 100%. For example, the first element of the first row would be 0% 0%. The second element of the first row would be -100% 0%, etc.&lt;br /&gt;
&lt;br /&gt;
This works fine except in Safari, which sometimes slightly modifies the width of elements at smaller screen sizes. For example, you might get a ~49.99px x ~49.99px div instead of the 50px x 50px specified by CSS width/height. Combined with using percentages in background-position, this can cause sprites to be slightly off-center.&lt;br /&gt;
&lt;br /&gt;
Using pixels in background-position is probably the easiest way to fix this problem, but that would require modifying the stock code itself. As a developer, you can also work around the problem by specifying a background-size attribute based on the size in elements of your source image. For example, if you have a source image that contains 5 rows of 28 sprites, you should specify &amp;quot;background-size: 2800% 500%;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You can add background-size to your stock items by using the extraClasses attribute as explained above and then specifying the values in your game.css file.&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Translations&amp;diff=7810</id>
		<title>Translations</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Translations&amp;diff=7810"/>
		<updated>2021-03-31T16:43:02Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* WARNING: Make sure your strings will be translated! */ Small typo on clienttranslate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using BGA Studio, the game you create is ready to be translated to each language by the BGA community. To make this possible, you only need to specify which string must be translated and how to combine them.&lt;br /&gt;
&lt;br /&gt;
== How translation works? ==&lt;br /&gt;
&lt;br /&gt;
When developing your game, all strings must be in English. Strings must be coherent with the English version of the game.&lt;br /&gt;
&lt;br /&gt;
Before the release of the game, BGA team will do the French translation of the game.&lt;br /&gt;
&lt;br /&gt;
After the release of the game, the BGA players community will translate the game in every language.&lt;br /&gt;
&lt;br /&gt;
== What should be translated? ==&lt;br /&gt;
&lt;br /&gt;
Every text that can be visible by the player when the game is running normally. This includes tooltips, texts on cards, error messages, ...&lt;br /&gt;
&lt;br /&gt;
This does NOT include error messages that are not supposed to happen (unexpected errors).&lt;br /&gt;
&lt;br /&gt;
== What rules should I follow for the original English strings? ==&lt;br /&gt;
&lt;br /&gt;
For a coherent and homogeneous interface, here are some rules about ending a sentence with a final period &#039;.&#039;&lt;br /&gt;
&lt;br /&gt;
* As a general rule:&lt;br /&gt;
** If a sentence is displayed isolated in the interface =&amp;gt; no final period&lt;br /&gt;
** If a sentence is followed or could be followed by another sentence in the same interface space =&amp;gt; final period.&lt;br /&gt;
&lt;br /&gt;
* In detail:&lt;br /&gt;
** No final period:&lt;br /&gt;
*** button labels&lt;br /&gt;
*** section titles&lt;br /&gt;
*** menu elements&lt;br /&gt;
*** links triggering an isolated action&lt;br /&gt;
*** anything that is not a full sentence&lt;br /&gt;
*** current actions in the status bar&lt;br /&gt;
** Final period:&lt;br /&gt;
*** complete sentences (e.g., explanations and descriptions) that can be chained with other sentences&lt;br /&gt;
** Either a period or no period is acceptable (but this should be consistent throughout the game) for:&lt;br /&gt;
*** isolated tooltips / small sentences&lt;br /&gt;
*** game logs (no period is usually preferable)&lt;br /&gt;
*** error messages (unless there is more than one sentence in the error message; final period is mandatory in this case)&lt;br /&gt;
&lt;br /&gt;
Otherwise, you should try to follow as closely as possible the general style and format (including capitalization) used in the published English rulebook and game materials.&lt;br /&gt;
&lt;br /&gt;
== Focus on translating notifications ==&lt;br /&gt;
&lt;br /&gt;
Usually, translating a website is simple: you just call a function on every string you have to translate, and the string is translated in the player&#039;s language. On Board Game Arena, this is exactly the same with the &amp;quot;_( string )&amp;quot; function.&lt;br /&gt;
&lt;br /&gt;
However, there is one difference on BGA: notifications. The server is sending notifications to players, and most of the time the notifications are the same for every players, no matter what language each player is using. This is why notifications are translated on client side in the proper language, even if the strings are defined on server side.&lt;br /&gt;
&lt;br /&gt;
== WARNING: Make sure your strings will be translated! ==&lt;br /&gt;
&lt;br /&gt;
For each game, our translation tool does a full scan of the code, looking for translation markers like &amp;quot;_()&amp;quot; or &amp;quot;clienttranslate()&amp;quot;. (See below for the full list of translation markers.)&lt;br /&gt;
&lt;br /&gt;
If your original string is not completely contained inside one of these markers, it won&#039;t be translated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Examples: the following strings will be translated:&lt;br /&gt;
    var mystring_translated = _(&amp;quot;my string&amp;quot;);       // JS&lt;br /&gt;
    $mystring_translated = self::_(&amp;quot;my string&amp;quot;);    // PHP&lt;br /&gt;
    $mystring_translated = sprintf( self::_(&amp;quot;my string with an %s argument&amp;quot;), $argument );   // PHP&lt;br /&gt;
&lt;br /&gt;
    // Examples: the following strings WILL NOT be translated:&lt;br /&gt;
    $my_string = &amp;quot;my string&amp;quot;;&lt;br /&gt;
    $not_translated = self::_( $my_string );   // The original string is not contained within a translator marker =&amp;gt; no translation&lt;br /&gt;
    $not_translated = self::_( sprintf( &amp;quot;my string with a %s argument&amp;quot;, $argument ) ); // Ditto&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How to not make translators crazy ;) ==&lt;br /&gt;
&lt;br /&gt;
* Try to reuse the exact same strings (with the same case, etc.) to minimize the number of strings to translate.&lt;br /&gt;
** &#039;&#039;&#039;Example&#039;&#039;&#039;: Consider replacing &amp;lt;pre&amp;gt;self::_(&amp;quot;Winner&amp;quot;)&amp;lt;/pre&amp;gt; and &amp;lt;pre&amp;gt;self::_(&amp;quot;Winners&amp;quot;)&amp;lt;/pre&amp;gt; (two strings to translate) with &amp;lt;pre&amp;gt;self::_(&amp;quot;Winner(s)&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;Example 2&#039;&#039;&#039;: &amp;lt;pre&amp;gt;clienttranslate(&amp;quot;play a card&amp;quot;)&amp;lt;/pre&amp;gt; and &amp;lt;pre&amp;gt;clienttranslate(&amp;quot;Play a card&amp;quot;)&amp;lt;/pre&amp;gt; means there will be two strings to translate.&lt;br /&gt;
* Do not mark as translatable a game element that does not have to be translated (e.g., if the name of a monster on a card is &amp;quot;Zzzzz&amp;quot;, maybe there&#039;s no need to translate it).&lt;br /&gt;
* Words does not come in the same order in each language. Thus, when you have to translate a string with an argument, do not write something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;self::_(&amp;quot;First part of the string, &amp;quot;).$argument.&#039; &#039;.self::_(&amp;quot;second part of the string&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
Write instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;sprintf( self::_(&amp;quot;First part of the string, %s second part of the string&amp;quot;), $argument )&amp;lt;/pre&amp;gt;&lt;br /&gt;
(or the equivalent &amp;quot;dojo.string.substitute&amp;quot; in Javascript)&lt;br /&gt;
* When translators are going to translate your game, the most difficult task for them is to get the context of the string to be translated. The shorter the string is, the more difficult the task is for them. As a rule of thumb, try to avoid short, insignificant strings that require knowledge of their surrounding context. You can also leave a comment on the context of the string in the translation program (English to English) if you are the developer of the game.&lt;br /&gt;
* The BGA translation policy is to be flexible on grammar. We prefer to write &amp;quot;player gets 1 coin(s)&amp;quot; rather than write two versions of the same string for plural and singular - it reduces the number of strings to translate.&lt;br /&gt;
* Instead of writing elaborate strings like &amp;quot;With the effect of ZZZ, player XXX gains a new YYY&amp;quot;, which is very difficult to translate, write strings like &amp;quot;ZZZ: XXX gets YYY&amp;quot;.&lt;br /&gt;
* Use present tense instead of past. E.g., &amp;quot;player gets wood&amp;quot; instead of &amp;quot;player got wood&amp;quot;.&lt;br /&gt;
* Avoid using gender-specific pronouns. E.g., instead of &amp;quot;player returns card to *his* hand&amp;quot; use &amp;quot;player returns card to *their* hand,&amp;quot; or just avoid using pronouns. E.g., &amp;quot;player picks up the card&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== On client side (Javascript) ==&lt;br /&gt;
&lt;br /&gt;
On client side, things are quite simple: you just have to use the &amp;quot;_()&amp;quot; function for all strings you want to translate.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Get a string in player&#039;s language:&lt;br /&gt;
var translated = _(&amp;quot;original english string&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Get a string in player&#039;s language with parameter:&lt;br /&gt;
var translated = dojo.string.substitute( _(&amp;quot;You can pick ${p} cards and discard ${d}&amp;quot;), {&lt;br /&gt;
    p: 2,&lt;br /&gt;
    d: 4&lt;br /&gt;
} );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING:&#039;&#039;&#039; in Javascript strings to translate, you should never use &#039;\n&#039;, &#039;\t&#039; or such, as it will break the translation bundle and result in all the Javascript translation to fail. In any case, the strings will result in HTML code, and such character codes won&#039;t have any impact on the HTML rendering. You should use HTML markup instead.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ANOTHER WARNING:&#039;&#039;&#039; you cannot use this function _() in the javascript object constructor, but you can achieve the same if you use it the setup method&lt;br /&gt;
&lt;br /&gt;
== On server side (PHP) ==&lt;br /&gt;
&lt;br /&gt;
On PHP side, you can use 3 different functions to specify that a string must be translated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;clienttranslate( &amp;quot;string to translate&amp;quot; ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This function is &#039;&#039;transparent&#039;&#039;: it will return the original English string without any change. Its only purpose is to mark this string as &amp;quot;must be translated&amp;quot;, and to make sure the translated version of the string will be available on client side.&lt;br /&gt;
&lt;br /&gt;
In general, you use clienttranslate:&lt;br /&gt;
* In your &#039;&#039;&#039;states.inc.php&#039;&#039;&#039;, for the fields &amp;quot;description&amp;quot; and &amp;quot;descriptionmyturn&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      &amp;quot;description&amp;quot; =&amp;gt; clienttranslate(&#039;${card_name}: ${actplayer} must discard 4 identical energies&#039;),&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In &#039;&#039;&#039;material.inc.php&#039;&#039;&#039;, when defining text for game materials that must be displayed on the client side.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$this-&amp;gt;card_types = array(&lt;br /&gt;
&lt;br /&gt;
     1 =&amp;gt; array(&lt;br /&gt;
        &#039;name&#039; =&amp;gt; clienttranslate(&amp;quot;Amulet of Air&amp;quot;), // Thus, we can use &amp;quot;_( card_name )&amp;quot; on Javascript side.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* When sending a notification with &#039;&#039;notifyAllPlayers&#039;&#039; or &#039;&#039;notifyPlayer&#039;&#039;, in the game log string and all game log arguments that need a translation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // A game log string with no argument:&lt;br /&gt;
     self::notifyAllPlayers( &#039;pickLibraryCards&#039;, clienttranslate(&amp;quot;Everyone draw cards from his library&amp;quot;), array() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a consequence there is no point passing variables to this function. E.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    notif=&amp;quot;foo&amp;quot;;&lt;br /&gt;
    self::notifyAllPlayers( &#039;log&#039;, clienttranslate(notif)); // BAD&lt;br /&gt;
    &lt;br /&gt;
    notif=clienttranslate(&amp;quot;foo&amp;quot;);&lt;br /&gt;
    self::notifyAllPlayers( &#039;log&#039;, notif); // GOOD&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Translating arguments is a little bit more complex. This uses the &#039;&#039;&#039;i18n&#039;&#039;&#039; special argument as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 // In the following example, we translate the game log itself, but also the &amp;quot;card_name&amp;quot; argument:&lt;br /&gt;
&lt;br /&gt;
 self::notifyAllPlayers( &#039;winPoints&#039;, clienttranslate(&#039;${card_name}: ${player_name} gains ${points} point(s)&#039;), array(&lt;br /&gt;
                &#039;i18n&#039; =&amp;gt; array( &#039;card_name&#039; ),     // &amp;lt;===== We specify here that &amp;quot;card_name&amp;quot; argument must be translated&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;points&#039; =&amp;gt; $points,&lt;br /&gt;
                &#039;card_name&#039; =&amp;gt; $this-&amp;gt;card_types[8][&#039;name&#039;] // &amp;lt;==== Here, we provide original English string.&lt;br /&gt;
            ) ); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure the translation of the i18n argument will be made, clienttranslate must have been used somewhere, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$this-&amp;gt;card_types = array(&lt;br /&gt;
...&lt;br /&gt;
     8 =&amp;gt; array(&lt;br /&gt;
        &#039;name&#039; =&amp;gt; clienttranslate(&amp;quot;Amulet of Fire&amp;quot;),&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pay attention when using the &#039;&#039;&#039;i18n&#039;&#039;&#039; argument when translating arguments for the client: do NOT use same argument for both translations AND key codes for client-side actions (like using &#039;card_name&#039; to move it on the player board as described in the example). It&#039;s pretty obvious in the example, but it can be very tricky when translation is made at the end of the development (which is often the case). Use explicit argument names like &#039;card_name_translated&#039; by example.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING:&#039;&#039;&#039; you should NEVER use concatenation with &#039;&#039;clienttranslate&#039;&#039;, as it would result in a different string to translate at runtime than the one retrieved statically in the translation system, and so translation would not be applied. If you need to compose a string, use substitution and the i18n parameter (but you also have to pay attention not to compose sentences in a way that is dependent upon the English language specific syntax, or it may be impossible to translate correctly in another language: sometimes, you need multiple full sentences rather than relying on substitution).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::_( &amp;quot;my string to translate&amp;quot; ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This function returns a string translated in the language of CURRENT user (i.e. player who send the request to the server) (be careful, this is NOT the active player).&lt;br /&gt;
&lt;br /&gt;
Most of the time, you don&#039;t need to translate strings on server side, except on the following 3 situations:&lt;br /&gt;
* When throwing an exception because the player did a forbidden move.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// This will display a translatable red message to the player that just did some wrong action:&lt;br /&gt;
throw new BgaUserException( self::_(&#039;You must choose 3 cards&#039;) );&lt;br /&gt;
&lt;br /&gt;
// ... notice the use of BgaUserException that signals that this exception is &amp;quot;expected&amp;quot;. In theory, all exception that are expected should be translated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In &amp;quot;yourgame.view.php&amp;quot;, when creating the labels for the game interface used in your template (.tpl) file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$this-&amp;gt;tpl[&#039;CARDS_FOR_YEAR_2&#039;] = self::_(&amp;quot;Your cards for year II&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota bene:&#039;&#039;&#039; it is recommended to set translated text in your interface client side rather than use template variables and server translation, so that translation works natively in replays (that don&#039;t have server side translations). For simple strings, the framework will handle moving the translation client side, but for more complex strings it may not work. In particular, you should not use server side translation for templates with substitution variables (or use the specific function &amp;quot;gameview_str_replace( $search, $replace, $string )&amp;quot; if not possible otherwise or for old code compatibility). Also, you should never use a &amp;quot;to_translate&amp;quot; class in your .tpl as it is used internally by the framework.&lt;br /&gt;
&lt;br /&gt;
* Eventually, in your material.inc.php, if for example you need to use some string elements in your exceptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// In material.inc.php, $this-&amp;gt;energies[n][&#039;nametr&#039;] has been created with the self::_() method. Now we can do this:&lt;br /&gt;
throw new BgaUserException( self::_(&amp;quot;To execute this action you need more: &amp;quot;).&#039; &#039;.$this-&amp;gt;energies[$resource_id][&#039;nametr&#039;] );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Eventually, in your &amp;quot;getAllDatas&amp;quot; PHP method, as the data return by this method is used only by current user.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;totranslate( &amp;quot;my string to translate&amp;quot; ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This function works exactly like &#039;clienttranslate&#039;, except it tells BGA that the string is not needed on client side.&lt;br /&gt;
&lt;br /&gt;
You should not use this function, except on the following cases:&lt;br /&gt;
* Statistics name in stats.inc.php&lt;br /&gt;
* Option names and option values name in gameoptions.inc.php&lt;br /&gt;
&lt;br /&gt;
== On server side - advanced (PHP) ==&lt;br /&gt;
&lt;br /&gt;
If you want to use translation system in your custom static modules, you will first need to expose the _() function :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class mygame extends Table {&lt;br /&gt;
  // Exposing protected method translation&lt;br /&gt;
  public static function totranslate($text) {&lt;br /&gt;
    return self::_($text);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then you&#039;ll be able to use this directly in other modules by doing&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
throw new BgaUserException(mygame::totranslate(&amp;quot;Translated error from my awesome module file&amp;quot;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice how the &amp;quot;totranslate&amp;quot; is also used by the static analysis to detect your string. So the following will not work :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$msg = &amp;quot;Translated error from my awesome module file&amp;quot;;&lt;br /&gt;
throw new BgaUserException(mygame::totranslate($msg));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=5976</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=5976"/>
		<updated>2020-10-26T20:28:07Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Debugging Toolips CSS/Layout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
This page gives you practical tips to debug your game during development. Don&#039;t hesitate to share your difficulties with us so that we can improve this section.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
To work on BGA Studio, we recommend that you use [http://www.google.com/chrome Google Chrome] as it&#039;s currently the fastest browser for the BGA platform, and it&#039;s available for all OSes.&lt;br /&gt;
&lt;br /&gt;
Another reason to use Chrome is that it embeds all the tools you need to work on BGA Studio. You can see them by pressing &amp;quot;F12&amp;quot; or from the menu (&amp;quot;Tools &amp;gt; Development tools&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
A good practice is to use a second browser to develop the game, in order to verify that your game is working fine on this browser too.&lt;br /&gt;
&lt;br /&gt;
To debug with Firefox browser, we advise you to use these 2 extensions:&lt;br /&gt;
* [https://addons.mozilla.org/firefox/addon/firebug/ Firebug]&lt;br /&gt;
* [https://addons.mozilla.org/firefox/addon/web-developer/ Web developer]&lt;br /&gt;
&lt;br /&gt;
To debug with other browsers (IE, Edge, Opera), we advise you to use one of the most recent versions. Latest versions of the browser will likely have better development tools than the previous ones...&lt;br /&gt;
&lt;br /&gt;
== General tip for debugging ==&lt;br /&gt;
&lt;br /&gt;
In general for debugging, think of using the &#039;[[Tools_and_tips_of_BGA_Studio#Save_.26_restore_state|save &amp;amp; restore]] state&#039; functionality. It enables you to save the state of your game just before the issue you are investigating, then come back to that point with one click as many times as needed to understand what is going wrong.&lt;br /&gt;
&lt;br /&gt;
You can save up to 3 different states.&lt;br /&gt;
&lt;br /&gt;
== Debugging my game when it cannot start ==&lt;br /&gt;
&lt;br /&gt;
If your game won&#039;t start because of an error, you are probably in one of these situations:&lt;br /&gt;
* There is a SQL error in your dbmodel.sql file.&lt;br /&gt;
* You have a syntax error in your PHP file.&lt;br /&gt;
* Your PHP &amp;quot;setup&amp;quot; - or any method used during the game initial states - generates an exception.&lt;br /&gt;
&lt;br /&gt;
If the error is not explicitly displayed when you click on &amp;quot;Express start&amp;quot;, you should check the &amp;quot;Gameserver error log&amp;quot; as per [[Studio logs]].&lt;br /&gt;
More cases of why game can&#039;t start are described on the [[Troubleshooting]] page.&lt;br /&gt;
&lt;br /&gt;
== Debugging my PHP game logic (or my view) ==&lt;br /&gt;
&lt;br /&gt;
Most of the time, debugging PHP is quite easy. Here&#039;s what I do when I want to develop/debug some game logic that is triggered by some game action:&lt;br /&gt;
&lt;br /&gt;
* At first, I make sure that I can reproduce the needed game situation with one click. To do this, I use the &amp;quot;[[Tools_and_tips_of_BGA_Studio#Save_.26_restore_state|save &amp;amp; restore]]&amp;quot; function.&lt;br /&gt;
* Another possibility for this is to place a &#039;&#039;&#039;die(&#039;ok&#039;);&#039;&#039;&#039; PHP statement right after the PHP I am developing/debugging. This way, I make sure that every request will fail and then nothing will be committed to the database.&lt;br /&gt;
* Then, I use the &#039;&#039;&#039;var_dump&#039;&#039;&#039; function to dump PHP variables and check what&#039;s wrong, until it works.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// (...my code to debug)&lt;br /&gt;
&lt;br /&gt;
var_dump( $my_variable );&lt;br /&gt;
die(&#039;ok&#039;);&lt;br /&gt;
&lt;br /&gt;
// (...my code to debug)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add traces to your code ===&lt;br /&gt;
&lt;br /&gt;
You can use the following functions in your game to add server side logging:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::dump( &#039;name_of_variable&#039;, $variable );&#039;&#039;&#039;  // dump variable, like var_dump but in the log debug level logging, goes to [[Studio_logs|BGA request&amp;amp;SQL logs]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::debug( $message );&#039;&#039;&#039;  // debug level logging, goes to [[Studio_logs|BGA request&amp;amp;SQL logs]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::trace( $message );&#039;&#039;&#039;  // info level logging, goes to [[Studio_logs|BGA request&amp;amp;SQL logs]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::warn( $message );&#039;&#039;&#039;   // warning level logging, goes to [[Studio_logs#BGA_unexpected_exceptions_logs|BGA unexpected exceptions log]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::error( $message );&#039;&#039;&#039;  // error level logging, goes to [[Studio_logs#BGA_unexpected_exceptions_logs|BGA unexpected exceptions log]]&lt;br /&gt;
&lt;br /&gt;
Check [[Studio logs]] for more details on how to access your logs.&lt;br /&gt;
&lt;br /&gt;
This can be useful when you need to follow the flow of your code and not just stop it to see how it goes at some point.&lt;br /&gt;
&lt;br /&gt;
Only the error log level will appear in production. This level should be used only for critical problems. &lt;br /&gt;
Other levels will show only in the development environment and can be used as you see fit.&lt;br /&gt;
&lt;br /&gt;
Note: tracing likely won&#039;t work in constructor and game setup, use other methods (such as dumping on stdout)&lt;br /&gt;
&lt;br /&gt;
== Debugging my HTML/CSS layout ==&lt;br /&gt;
&lt;br /&gt;
Example situations&lt;br /&gt;
&lt;br /&gt;
* Why doesn&#039;t my game element show up in the interface?&lt;br /&gt;
* Why hasn&#039;t my CSS property been applied to this element?&lt;br /&gt;
* Why is this game element displayed at this position?&lt;br /&gt;
&lt;br /&gt;
A useful tip when an element does not show up in the interface is to give it a red background:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#my_element {&lt;br /&gt;
  ... some CSS definitions ...&lt;br /&gt;
  background-color: red;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, you know if the element is not visible because of some CSS property or because of something else.&lt;br /&gt;
&lt;br /&gt;
Another tip: sometimes, changing a CSS property has no visible effect on your interface. In that case, add a &amp;quot;display:none&amp;quot; property. If your element does not disappear, the bug probably comes from your CSS selector and not from your CSS property.&lt;br /&gt;
&lt;br /&gt;
Using Chrome &amp;quot;Elements&amp;quot; tab (the first one), you can:&lt;br /&gt;
* See the CURRENT HTML of your page. Remember that the classical &amp;quot;show page source&amp;quot; is inefficient with BGA as you are modifying the page source with your Javascript code.&lt;br /&gt;
* Using the &amp;quot;magnifying glass&amp;quot;, you can click on any part of your game interface and check its HTML code and associated CSS styles.&lt;br /&gt;
* You can even modify directly some CSS properties and see how it looks immediately in the game interface.&lt;br /&gt;
&lt;br /&gt;
When changing css you have to force reload (Ctrl+R). But it also reloads all images which is long, if you want it faster you can define this function in js file, and call it from Browser js console&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 function reloadCss() {&lt;br /&gt;
	var links = document.getElementsByTagName(&amp;quot;link&amp;quot;);&lt;br /&gt;
	for (var cl in links) {&lt;br /&gt;
		var link = links[cl];&lt;br /&gt;
		if (link.rel === &amp;quot;stylesheet&amp;quot;)&lt;br /&gt;
			link.href += &amp;quot;?&amp;quot;;&lt;br /&gt;
	}&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Debugging Toolips CSS/Layout ===&lt;br /&gt;
&lt;br /&gt;
To inspect tooltip you need to pin it so it does not disappear.&lt;br /&gt;
Best way to do that is to inspect element which you have tooltip for, and in dev tools (or similar) force state to hover, i.e. select &amp;quot;:hov&amp;quot; icon and select :hover checkbox.&lt;br /&gt;
&lt;br /&gt;
If this does not work: open the console (dev tools) large enough window, hover to make the tooltip appear and alt + tab to focus the console that will cover the tooltip. That way the onmouseout will never be triggered.&lt;br /&gt;
&lt;br /&gt;
=== Debugging my Javascript game interface logic ===&lt;br /&gt;
&lt;br /&gt;
Compared to PHP debugging, Javascript debugging can sometimes be painful.&lt;br /&gt;
&lt;br /&gt;
Here are some tips to make your life easier while developing and debugging Javascript:&lt;br /&gt;
&lt;br /&gt;
=== Do complex things on the PHP side ===&lt;br /&gt;
&lt;br /&gt;
The most frequent case is the following: you want to compute possible moves in a game situation. Doing it in Javascript is a nightmare. Do it in PHP, and transfer the results to your client interface using the &amp;quot;args&amp;quot; game state property.&lt;br /&gt;
&lt;br /&gt;
Note: See the Reversi tutorial for an example.&lt;br /&gt;
&lt;br /&gt;
=== Add traces in your code ===&lt;br /&gt;
&lt;br /&gt;
You can use the following:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;console.log( variable_to_inspect )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It will give you the object structure of the variable in the Javascript console, without blocking the execution.&lt;br /&gt;
&lt;br /&gt;
It&#039;s often a good idea to precede this call with a console.log( &#039;### HERE ###&#039; ); to find more easily the appropriate line in the console log.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;alert( variable_to_inspect )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It will popup what you wish and pause the execution until you click ok.&lt;br /&gt;
&lt;br /&gt;
This won&#039;t be useful for complex structures; only native types will be plainly displayed. But this is sometimes useful just with messages to make sure which way the execution goes.&lt;br /&gt;
&lt;br /&gt;
=== Use Browser Debugger (e.g. Chrome) ===&lt;br /&gt;
&lt;br /&gt;
Modern browsers also allow you to put breakpoints in your js code. &lt;br /&gt;
&lt;br /&gt;
This will stop code execution on that line and will launch the JavaScript debugger.&lt;br /&gt;
&lt;br /&gt;
In Chrome, to add a breakpoint: add a line to your .js file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;debugger; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Refresh the page F5, and make sure you have the Developer tools window open, press F12. &lt;br /&gt;
When the break-point is hit you can then step through your code and visualise variables, etc.&lt;br /&gt;
&lt;br /&gt;
== Online format checkers ==&lt;br /&gt;
Copy and paste code for a quick code sanity check like the right number of brackets.&lt;br /&gt;
&lt;br /&gt;
PHP: [https://phpcodechecker.com/ https://phpcodechecker.com/]&lt;br /&gt;
&lt;br /&gt;
JS:  [http://esprima.org/demo/validate.html http://esprima.org/demo/validate.html]&lt;br /&gt;
&lt;br /&gt;
== Some frequent errors ==&lt;br /&gt;
&lt;br /&gt;
See [[Troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Get the database matching a bug report ==&lt;br /&gt;
&lt;br /&gt;
For a way to automate the below steps, see this post: https://boardgamearena.com/forum/viewtopic.php?f=12&amp;amp;t=16454#p63167&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
When a player creates a bug report in production, a snapshot of the game database is taken. You can get access to this snapshot from the studio by following the steps below:&lt;br /&gt;
* Create a table in the studio with the same game and number of players as the table for which the report has been written. Launch this table.&lt;br /&gt;
* Open another tab on the studio and go to &amp;quot;Manage game&amp;quot; page for your project (you have to be admin for this project)&lt;br /&gt;
* In the &amp;quot;Errors in production&amp;quot; section, fill up the fields &amp;quot;Bug report ID&amp;quot; (this is the ID of the bug report in production) and &amp;quot;Studio table ID&amp;quot; (this is the ID of the table you created above) then click the &amp;quot;⇨ Load bug report state into this table save slot #1&amp;quot; button.&lt;br /&gt;
* If the snapshot is correctly retrieved, you see a &amp;quot;Done!&amp;quot; message.&lt;br /&gt;
* Go back to the tab with your studio table and click &amp;quot;Load 1&amp;quot;.&lt;br /&gt;
* The page refreshes automatically and is broken. This is normal, as the player ids from the snapshot are the player ids of the production, not those of the studio. We&#039;ll need to update them.&lt;br /&gt;
** &#039;&#039;&#039;Important note:&#039;&#039;&#039; if you see a &amp;quot;Done!&amp;quot; message but clicking &amp;quot;Load 1&amp;quot; doesn&#039;t bring any change, it&#039;s that the snapshot is unfortunately not available (most likely because the bug report was declared too long after the game ended and the database had already been garbage collected to reclaim space).&lt;br /&gt;
* Click on the &amp;quot;Go to game database&amp;quot; button&lt;br /&gt;
* For each table using player_ids, you&#039;ll need to update the player_ids from the production to use the player_ids from the studio. You can see the player_ids from the table page before entering the game by hovering over the player names.&lt;br /&gt;
* Tables to update:&lt;br /&gt;
** player&lt;br /&gt;
** global (value with ID 2 is the active player)&lt;br /&gt;
** stats&lt;br /&gt;
** tables specific to your schema that use player_ids&lt;br /&gt;
* If your changes to player_ids are not taken into account, it may be a cache problem: use the &amp;quot;Clear PHP cache&amp;quot; button on your &amp;quot;Manage game&amp;quot; page.&lt;br /&gt;
* Then you should be able to play with the same state of the game as when the report was created in production.&lt;br /&gt;
* If the game has ended, you can place it again in the game state you want to debug by setting the value with ID 1 in the global table to the appropriate state value, and the value with ID 2 to the player you want active).&lt;br /&gt;
*&lt;br /&gt;
* Below is an example php function you may want to make. You can call this function from the chat window: LoadDebug()  &lt;br /&gt;
* change instances of 2308257, and 2308258 to you own BGA Studio logins YourLogin0 and YourLogin1&lt;br /&gt;
* change $id0 and $id1 to the player_ids from the table you want to debug, and have recently imported.&lt;br /&gt;
* Before you load Slot1, open a second tab with the table, because after loading the slot, that tab will be unusable. In the second tab you can call LoadDebug() in the chat window&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	public function LoadDebug()&lt;br /&gt;
	{&lt;br /&gt;
		&lt;br /&gt;
		// These are the id&#039;s from the BGAtable I need to debug.&lt;br /&gt;
		$id0 = &#039;85268563&#039;;&lt;br /&gt;
		$id1 = &#039;85278138&#039;;	&lt;br /&gt;
		&lt;br /&gt;
		//player&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE player SET player_id=2308257 WHERE player_id = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE player SET player_id=2308258 WHERE player_id = &#039;&amp;quot; . $id1 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		&lt;br /&gt;
		//global &lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE global SET global_value=2308257 WHERE global_value = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE global SET global_value=2308258 WHERE global_value = &#039;&amp;quot; . $id1 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		&lt;br /&gt;
		//stats&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE stats SET stats_player_id=2308257 WHERE stats_player_id = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE stats SET stats_player_id=2308258 WHERE stats_player_id = &#039;&amp;quot; . $id1 . &amp;quot;&#039;&amp;quot; );			&lt;br /&gt;
		&lt;br /&gt;
		// &#039;other&#039; game specific tables. example:&lt;br /&gt;
		// tables specific to your schema that use player_ids&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE card SET card_location_arg=2308257 WHERE card_location_arg = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE card SET card_location_arg=2308258 WHERE card_location_arg = &#039;&amp;quot; . $id1 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
          }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Deck&amp;diff=5222</id>
		<title>Deck</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Deck&amp;diff=5222"/>
		<updated>2020-08-07T11:18:38Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Auto-reshuffle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Deck&amp;quot; is one of the most useful component on the PHP side. With &amp;quot;Deck&amp;quot;, you can manage the cards in your game on the server side.&lt;br /&gt;
&lt;br /&gt;
Using &amp;quot;deck&amp;quot;, you will be able to use the following features without writing a single SQL database request:&lt;br /&gt;
* Place cards in a pile, shuffle cards, draw cards one by one or many at a time.&lt;br /&gt;
* &amp;quot;Auto-reshuffle&amp;quot; the discard pile into the deck when the deck is empty.&lt;br /&gt;
* Move cards between different locations: hands of players, the table, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using Deck: Hearts example ==&lt;br /&gt;
&lt;br /&gt;
The Deck component is extensively used in the sample &#039;&#039;Hearts&#039;&#039; card game. You will find in &amp;quot;hearts.game.php&amp;quot; that the object &amp;quot;$this-&amp;gt;cards&amp;quot; is used many times.&lt;br /&gt;
&lt;br /&gt;
== Deck overview ==&lt;br /&gt;
&lt;br /&gt;
With Deck component, you manage all cards of your game.&lt;br /&gt;
&lt;br /&gt;
=== The 5 properties of each card ===&lt;br /&gt;
&lt;br /&gt;
Using the Deck component, each card will have 5 properties:&lt;br /&gt;
* &#039;&#039;&#039;id&#039;&#039;&#039;: This is the unique ID of each card.&lt;br /&gt;
* &#039;&#039;&#039;type&#039;&#039;&#039; and &#039;&#039;&#039;type_arg&#039;&#039;&#039;: These two values define the type of your card (i.e., what sort of card is this?).&lt;br /&gt;
* &#039;&#039;&#039;location&#039;&#039;&#039; and &#039;&#039;&#039;location_arg&#039;&#039;&#039;: These two values define where the card is at now.&lt;br /&gt;
&lt;br /&gt;
The id, type, and type_arg properties are constants throughout the game. location and location_arg change when your cards move from one place to another in the game area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;id&#039;&#039;&#039; is the unique ID of each card. Two cards cannot have the same ID. IDs are generated automatically by the Deck component when you create cards during the Setup phase of your game.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type&#039;&#039;&#039; and &#039;&#039;&#039;type_arg&#039;&#039;&#039; defines the type of your card.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type&#039;&#039;&#039; is a short string, and &#039;&#039;&#039;type_arg&#039;&#039;&#039; is an integer.&lt;br /&gt;
&lt;br /&gt;
You can use these two values as you like to make sure you will be able to identify the different cards in the game. See usage of &amp;quot;type&amp;quot; and &amp;quot;type_arg&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
Examples of usage of &amp;quot;type&amp;quot; and &amp;quot;type_arg&amp;quot;:&lt;br /&gt;
* In &#039;&#039;Hearts&#039;&#039;, &amp;quot;type&amp;quot; represents the color (suite) of the card (1 to 4) and &amp;quot;type_arg&amp;quot; is the value of the card (1, 2, ... 10, J, Q, K).&lt;br /&gt;
* In &#039;&#039;Seasons&#039;&#039;, &amp;quot;type&amp;quot; represents the type of the card (e.g., 1 is Amulet of Air, 2 is Amulet of Fire, etc...). type_arg is not used.&lt;br /&gt;
* In &#039;&#039;Takenoko&#039;&#039;, a Deck component is used for objective cards. &amp;quot;type&amp;quot; is the kind of objective (irrigation/panda/plot) and &amp;quot;type_arg&amp;quot; is the ID of the specific objective to realize (e.g., &amp;quot;green bamboo x4&amp;quot;). Note that a second Deck component is used in &#039;&#039;Takenoko&#039;&#039; to manage the &amp;quot;garden plot&amp;quot; pile.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;location&#039;&#039;&#039; and &#039;&#039;&#039;location_arg&#039;&#039;&#039; define where a card is at now. &#039;&#039;&#039;location&#039;&#039;&#039; is a short string, and &#039;&#039;&#039;location_arg&#039;&#039;&#039; is an integer.&lt;br /&gt;
&lt;br /&gt;
You can use &#039;location&#039; and &#039;location_arg&#039; as you like, to move your card within the game area.&lt;br /&gt;
&lt;br /&gt;
There are 3 special &#039;location&#039; values that Deck manages automatically. You can choose to use these locations or not, depending on your needs:&lt;br /&gt;
* &#039;deck&#039;: the &#039;deck&#039; location is a standard draw deck. Cards are placed face down in a stack and are drawn in sequential order during the game. &#039;location_arg&#039; is used to specify where the card is located within the stack (the card with the highest location_arg value is the next to be drawn).&lt;br /&gt;
* &#039;hand&#039;: the &#039;hand&#039; location represents cards in a player&#039;s hand. &#039;location_arg&#039; is set to the ID of each player.&lt;br /&gt;
* &#039;discard&#039;: the &#039;discard&#039; location is used for discard piles. Card in &#039;discard&#039; may be reshuffled into the deck if needed (see &amp;quot;autoreshuffle&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tips: using the Deck component, you will use generic properties (&amp;quot;location&amp;quot;, &amp;quot;type_arg&amp;quot;,...) for specific purposes in your game. Thus, during the design step before realizing your game, take a few minutes to write down the exact meaning of each of these generic properties in the context of your game.&lt;br /&gt;
&lt;br /&gt;
=== Create a new Deck component ===&lt;br /&gt;
&lt;br /&gt;
For each Deck component in your game, you need to create a dedicated table in the SQL database. This table has a standard format. In practice, if you just want to have a Deck component named &amp;quot;card&amp;quot;, you can copy/paste the following into your &amp;quot;dbmodel.sql&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TABLE IF NOT EXISTS `card` (&lt;br /&gt;
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&lt;br /&gt;
  `card_type` varchar(16) NOT NULL,&lt;br /&gt;
  `card_type_arg` int(11) NOT NULL,&lt;br /&gt;
  `card_location` varchar(16) NOT NULL,&lt;br /&gt;
  `card_location_arg` int(11) NOT NULL,&lt;br /&gt;
  PRIMARY KEY (`card_id`)&lt;br /&gt;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: the database schema of this table does not have to be exactly what is listed above. You can increase the size of the fields or add more fields. For additional fields&lt;br /&gt;
you just have to do manual queries.&lt;br /&gt;
&lt;br /&gt;
Once you have done this (and restarted your game), you can declare the Deck component in your PHP code in your class constructor. For &#039;&#039;Hearts&#039;&#039; for example, I added to the &amp;quot;Hearts()&amp;quot; method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $this-&amp;gt;cards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;init( &amp;quot;card&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we specify &amp;quot;card&amp;quot; here: the name of our previously created table. This means you can create several &amp;quot;Deck&amp;quot; components with multiple tables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $this-&amp;gt;firstKindCards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;firstKindCards -&amp;gt;init( &amp;quot;first_kind_card&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;secondKindCards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;secondKindCards -&amp;gt;init( &amp;quot;second_kind_card&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the time this is not useful; a Deck component should manage all objects of the same kind (i.e., all cards in the game).&lt;br /&gt;
Note that you need to create a table for each &amp;quot;Deck&amp;quot;, table name should be &amp;quot;first_kind_card&amp;quot; but the fields must remain &amp;quot;card_id&amp;quot;, &amp;quot;card_type&amp;quot; and so on.&lt;br /&gt;
&lt;br /&gt;
Afterwards, we can initialize your &amp;quot;Deck&amp;quot; by creating all the cards of the game. Generally, this is done only once during the game, in the &amp;quot;setupNewGame&amp;quot; method.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Deck&amp;quot; component provides a fast way to initialize all your cards at once: createCards. Here is how it is used for &amp;quot;Hearts&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        // Create cards&lt;br /&gt;
        $cards = array();&lt;br /&gt;
        foreach( $this-&amp;gt;colors as  $color_id =&amp;gt; $color ) // spade, heart, diamond, club&lt;br /&gt;
        {&lt;br /&gt;
            for( $value=2; $value&amp;lt;=14; $value++ )   //  2, 3, 4, ... K, A&lt;br /&gt;
            {&lt;br /&gt;
                $cards[] = array( &#039;type&#039; =&amp;gt; $color_id, &#039;type_arg&#039; =&amp;gt; $value, &#039;nbr&#039; =&amp;gt; 1);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;createCards( $cards, &#039;deck&#039; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, &amp;quot;createCards&amp;quot; takes a description of all cards of the game. For each type of card, you have to specify its &amp;quot;type&amp;quot;, &amp;quot;type_arg&amp;quot; and the number of cards to create (&amp;quot;nbr&amp;quot;). &amp;quot;createCards&amp;quot; create all cards and place them into the &amp;quot;deck&amp;quot; location (as specified in the second argument).&lt;br /&gt;
&lt;br /&gt;
Now, you are ready to use &amp;quot;Deck&amp;quot;!&lt;br /&gt;
&lt;br /&gt;
=== Simple examples using Deck ===&lt;br /&gt;
&lt;br /&gt;
(Most examples are from &amp;quot;Hearts&amp;quot; game)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // In &amp;quot;getAllDatas&#039;, we need to send to the current player all the cards he has in hand:&lt;br /&gt;
     $result[&#039;hand&#039;] = $this-&amp;gt;cards-&amp;gt;getCardsInLocation( &#039;hand&#039;, $player_id );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // At some time we want to check if all the cards (52) are in player&#039;s hands:&lt;br /&gt;
     if( $this-&amp;gt;cards-&amp;gt;countCardInLocation( &#039;hand&#039; ) == 52 )&lt;br /&gt;
           // do something&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // When a player plays a card in front of him on the table:&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;moveCard( $card_id, &#039;cardsontable&#039;, $player_id );&lt;br /&gt;
&lt;br /&gt;
     // Note the use of the custom location &#039;cardsontable&#039; here to keep track of cards on the table.&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;
     // This is a new hand: let&#039;s gather all cards from everywhere in the deck:&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;moveAllCardsInLocation( null, &amp;quot;deck&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
     // And then shuffle the deck&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;shuffle( &#039;deck&#039; );&lt;br /&gt;
&lt;br /&gt;
     // And then deal 13 cards to each player&lt;br /&gt;
     // Deal 13 cards to each players&lt;br /&gt;
     // Create deck, shuffle it and give 13 initial cards&lt;br /&gt;
     $players = self::loadPlayersBasicInfos();&lt;br /&gt;
     foreach( $players as $player_id =&amp;gt; $player )&lt;br /&gt;
     {&lt;br /&gt;
        $cards = $this-&amp;gt;cards-&amp;gt;pickCards( 13, &#039;deck&#039;, $player_id );&lt;br /&gt;
           &lt;br /&gt;
        // Notify player about his cards&lt;br /&gt;
        self::notifyPlayer( $player_id, &#039;newHand&#039;, &#039;&#039;, array( &lt;br /&gt;
            &#039;cards&#039; =&amp;gt; $cards&lt;br /&gt;
         ) );&lt;br /&gt;
     }  &lt;br /&gt;
&lt;br /&gt;
     // Note the use of &amp;quot;notifyPlayer&amp;quot; instead of &amp;quot;notifyAllPlayers&amp;quot;: new cards is a private information ;)  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deck component reference ==&lt;br /&gt;
&lt;br /&gt;
=== Initializing Deck component ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;init( $table_name )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Initialize the Deck component.&lt;br /&gt;
&lt;br /&gt;
Argument:&lt;br /&gt;
* table_name: name of the DB table used by this Deck component.&lt;br /&gt;
&lt;br /&gt;
Must be called before any other Deck method.&lt;br /&gt;
&lt;br /&gt;
Usually, init is called in your game constructor.&lt;br /&gt;
&lt;br /&gt;
Example with Hearts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	function Hearts( )&lt;br /&gt;
	{&lt;br /&gt;
        (...)&lt;br /&gt;
        &lt;br /&gt;
        $this-&amp;gt;cards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;init( &amp;quot;card&amp;quot; );&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;createCards( $cards, $location=&#039;deck&#039;, $location_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create card items in your deck component. Usually, all card items are created once, during the setup phase of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;cards&amp;quot; describe all cards that need to be created. &amp;quot;cards&amp;quot; is an array with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   // Create 1 card of type &amp;quot;1&amp;quot; with type_arg=99,&lt;br /&gt;
   //  and 4 cards of type &amp;quot;2&amp;quot; with type_arg=12,&lt;br /&gt;
   //  and 2 cards of type &amp;quot;3&amp;quot; with type_arg=33&lt;br /&gt;
&lt;br /&gt;
   $cards = array(&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 1, &#039;type_arg&#039; =&amp;gt; 99, &#039;nbr&#039; =&amp;gt; 1 ),&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 2, &#039;type_arg&#039; =&amp;gt; 12, &#039;nbr&#039; =&amp;gt; 4 ),&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 3, &#039;type_arg&#039; =&amp;gt; 33, &#039;nbr&#039; =&amp;gt; 2 )&lt;br /&gt;
        ...&lt;br /&gt;
   );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: During the &amp;quot;createCards&amp;quot; process, Deck generates unique IDs for all card items.&lt;br /&gt;
&lt;br /&gt;
Note: createCards is optimized to create a lot of cards at once. Do not use it to create cards one by one.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;location&amp;quot; and &amp;quot;location_arg&amp;quot; arguments are not set, newly created cards are placed in the &amp;quot;deck&amp;quot; location. If &amp;quot;location&amp;quot; (and optionally location_arg) is specified, cards are created for this specific location.&lt;br /&gt;
&lt;br /&gt;
=== Card standard format ===&lt;br /&gt;
&lt;br /&gt;
When Deck component methods are returning one or several cards, the following format is used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&lt;br /&gt;
   &#039;id&#039; =&amp;gt; ..,          // the card ID&lt;br /&gt;
   &#039;type&#039; =&amp;gt; ..,        // the card type&lt;br /&gt;
   &#039;type_arg&#039; =&amp;gt; ..,    // the card type argument&lt;br /&gt;
   &#039;location&#039; =&amp;gt; ..,    // the card location&lt;br /&gt;
   &#039;location_arg&#039; =&amp;gt; .. // the card location argument&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Picking cards ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCard( $location, $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pick a card from a &amp;quot;pile&amp;quot; location (ex: &amp;quot;deck&amp;quot;) and place it in the &amp;quot;hand&amp;quot; of specified player.&lt;br /&gt;
&lt;br /&gt;
Return the card picked or &amp;quot;null&amp;quot; if there are no more card in given location.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCards( $nbr, $location, $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pick &amp;quot;$nbr&amp;quot; cards from a &amp;quot;pile&amp;quot; location (ex: &amp;quot;deck&amp;quot;) and place them in the &amp;quot;hand&amp;quot; of specified player.&lt;br /&gt;
&lt;br /&gt;
Return an array with the cards picked (indexed by the card ID), or &amp;quot;null&amp;quot; if there are no more card in given location.&lt;br /&gt;
&lt;br /&gt;
Note that the number of cards picked can be less than &amp;quot;$nbr&amp;quot; in case there are not enough cards in the pile location.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below). In case there are not enough cards in the pile, all remaining cards are picked first, then the auto-reshuffle is triggered, then the other cards are picked.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCardForLocation( $from_location, $to_location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method is similar to &#039;pickCard&#039;, except that you can pick a card for any sort of location and not only the &amp;quot;hand&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
* from_location is the &amp;quot;pile&amp;quot; style location from where you are picking a card.&lt;br /&gt;
* to_location is the location where you will place the card picked.&lt;br /&gt;
* if &amp;quot;location_arg&amp;quot; is specified, the card picked will be set with this &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCardsForLocation( $nbr, $from_location, $to_location, $location_arg=0, $no_deck_reform=false )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method is similar to &#039;pickCards&#039;, except that you can pick cards for any sort of location and not only the &amp;quot;hand&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
* from_location is the &amp;quot;pile&amp;quot; style location from where you are picking some cards.&lt;br /&gt;
* to_location is the location where you will place the cards picked.&lt;br /&gt;
* if &amp;quot;location_arg&amp;quot; is specified, the cards picked will be set with this &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
* if &amp;quot;no_deck_reform&amp;quot; is set to &amp;quot;true&amp;quot;, the auto-reshuffle feature is disabled during this method call.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
=== Moving cards ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveCard( $card_id, $location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the specific card to given location.&lt;br /&gt;
&lt;br /&gt;
* card_id: ID of the card to move.&lt;br /&gt;
* location: location where to move the card.&lt;br /&gt;
* location_arg: if specified, location_arg where to move the card. If not specified &amp;quot;location_arg&amp;quot; will be set to 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveCards( $cards, $location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the specific cards to given location.&lt;br /&gt;
&lt;br /&gt;
* cards: an array of IDs of cards to move.&lt;br /&gt;
* location: location where to move the cards.&lt;br /&gt;
* location_arg: if specified, location_arg where to move the cards. If not specified &amp;quot;location_arg&amp;quot; will be set to 0.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;insertCard( $card_id, $location, $location_arg )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move a card to a specific &amp;quot;pile&amp;quot; location where card are ordered.&lt;br /&gt;
&lt;br /&gt;
If location_arg place is already taken, increment all cards after location_arg in order to insert new card at this precise location.&lt;br /&gt;
&lt;br /&gt;
(note: insertCardOnExtremePosition method below is more useful in most of the case)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;insertCardOnExtremePosition( $card_id, $location, $bOnTop )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move a card on top or at bottom of given &amp;quot;pile&amp;quot; type location.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveAllCardsInLocation(  $from_location, $to_location, $from_location_arg=null, $to_location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move all cards in specified &amp;quot;from&amp;quot; location to given location.&lt;br /&gt;
&lt;br /&gt;
* from_location: where to take the cards&lt;br /&gt;
* to_location: where to put the cards&lt;br /&gt;
* from_location_arg (optional): if specified, only cards with given &amp;quot;location_arg&amp;quot; are moved.&lt;br /&gt;
* to_location_arg (optional): if specified, cards moved &amp;quot;location_arg&amp;quot; is set to given value. Otherwise &amp;quot;location_arg&amp;quot; is set to 0.&lt;br /&gt;
&lt;br /&gt;
Note: if you want to keep &amp;quot;location_arg&amp;quot; untouched, you should use &amp;quot;moveAllCardsInLocationKeepOrder&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveAllCardsInLocationKeepOrder( $from_location, $to_location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move all cards in specified &amp;quot;from&amp;quot; location to given &amp;quot;to&amp;quot; location. This method does not modify the &amp;quot;location_arg&amp;quot; of cards.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;playCard( $card_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move specified card at the top of the &amp;quot;discard&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
Note: this is an alias for: insertCardOnExtremePosition( $card_id, &amp;quot;discard&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
=== Get cards informations ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCard( $card_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get specific card information.&lt;br /&gt;
&lt;br /&gt;
Return null if this card is not found.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCards( $cards_array )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get specific cards information.&lt;br /&gt;
&lt;br /&gt;
$cards_array is an array of card IDs.&lt;br /&gt;
&lt;br /&gt;
If some cards are not found or if some card IDs are specified multiple times, the method throws an (unexpected) Exception.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsInLocation( $location, $location_arg = null, $order_by = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards in specific location, as an array. Return an empty array if the location is empty.&lt;br /&gt;
&lt;br /&gt;
* location (string): the location where to get the cards.&lt;br /&gt;
* location_arg (optional): if specified, return only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
* order_by (optional): if specified, returned cards are ordered by the given database field. Example: &amp;quot;card_id&amp;quot; or &amp;quot;card_type&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardInLocation( $location, $location_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in specified location.&lt;br /&gt;
&lt;br /&gt;
* location (string): the location where to count the cards.&lt;br /&gt;
* location_arg (optional): if specified, count only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardsInLocations()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in each location of the game.&lt;br /&gt;
&lt;br /&gt;
The method returns an associative array with the format &amp;quot;location&amp;quot; =&amp;gt; &amp;quot;number of cards&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  array(&lt;br /&gt;
    &#039;deck&#039; =&amp;gt; 12,&lt;br /&gt;
    &#039;hand&#039; =&amp;gt; 21,&lt;br /&gt;
    &#039;discard&#039; =&amp;gt; 54,&lt;br /&gt;
    &#039;ontable&#039; =&amp;gt; 3&lt;br /&gt;
  );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardsByLocationArgs( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in each &amp;quot;location_arg&amp;quot; for the given location.&lt;br /&gt;
&lt;br /&gt;
The method returns an associative array with the format &amp;quot;location_arg&amp;quot; =&amp;gt; &amp;quot;number of cards&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Example: count the number of cards in each player&#039;s hand:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    countCardsByLocationArgs( &#039;hand&#039; );&lt;br /&gt;
    &lt;br /&gt;
    // Result:&lt;br /&gt;
    array(&lt;br /&gt;
        122345 =&amp;gt; 5,    // player 122345 has 5 cards in hand&lt;br /&gt;
        123456 =&amp;gt; 4     // and player 123456 has 4 cards in hand&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPlayerHand( $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards in given player hand.&lt;br /&gt;
&lt;br /&gt;
Note: This is an alias for:&lt;br /&gt;
getCardsInLocation( &amp;quot;hand&amp;quot;, $player_id )&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardOnTop( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the card on top of the given (&amp;quot;pile&amp;quot; style) location, or null if the location is empty.&lt;br /&gt;
&lt;br /&gt;
Note that the card pile won&#039;t be &amp;quot;auto-reshuffled&amp;quot; if there is no more card available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOnTop( $nbr, $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the &amp;quot;$nbr&amp;quot; cards on top of the given (&amp;quot;pile&amp;quot; style) location.&lt;br /&gt;
&lt;br /&gt;
The method return an array with at most &amp;quot;$nbr&amp;quot; elements (or a void array if there is no card in this location).&lt;br /&gt;
&lt;br /&gt;
Note that the card pile won&#039;t be &amp;quot;auto-reshuffled&amp;quot; if there is not enough cards available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getExtremePosition( $bGetMax ,$location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(rarely used)&lt;br /&gt;
&lt;br /&gt;
Get the position of cards at the top of the given location / at the bottom of the given location.&lt;br /&gt;
&lt;br /&gt;
Of course this method works only on location in &amp;quot;pile&amp;quot; where you are using &amp;quot;location_arg&amp;quot; to specify the position of each card (example: &amp;quot;deck&amp;quot; location).&lt;br /&gt;
&lt;br /&gt;
If bGetMax=true, return the location of the top card of the pile.&lt;br /&gt;
&lt;br /&gt;
If bGetMax=false, return the location of the bottom card of the pile.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOfType( $type, $type_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards of a specific type (rarely used).&lt;br /&gt;
&lt;br /&gt;
Return an array of cards, or an empty array if there is no cards of the specified type.&lt;br /&gt;
&lt;br /&gt;
* type: the type of cards&lt;br /&gt;
* type_arg: if specified, return only cards with the specified &amp;quot;type_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOfTypeInLocation( $type, $type_arg=null, $location, $location_arg = null )&lt;br /&gt;
&lt;br /&gt;
Get all cards of a specific type in a specific location (rarely used).&lt;br /&gt;
&lt;br /&gt;
Return an array of cards, or an empty array if there is no cards of the specified type.&lt;br /&gt;
&lt;br /&gt;
* type: the type of cards&lt;br /&gt;
* type_arg: if specified, return only cards with the specified &amp;quot;type_arg&amp;quot;.&lt;br /&gt;
* location (string): the location where to get the cards.&lt;br /&gt;
* location_arg (optional): if specified, return only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Shuffling ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;shuffle( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Shuffle all cards in specific location.&lt;br /&gt;
&lt;br /&gt;
Shuffle only works on locations where cards are on a &amp;quot;pile&amp;quot; (ex: &amp;quot;deck&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Please note that all &amp;quot;location_arg&amp;quot; will be reset to reflect the new order of the cards in the pile.&lt;br /&gt;
&lt;br /&gt;
=== Auto-reshuffle ===&lt;br /&gt;
&lt;br /&gt;
To enable auto-reshuffle you must do &amp;quot;$this-&amp;gt;cards-&amp;gt;autoreshuffle = true&amp;quot; during the setup of the component (often in the &#039;&#039;_construct&#039;&#039; function when you &#039;&#039;init()&#039;&#039; the Deck object).&lt;br /&gt;
&lt;br /&gt;
Every time a card must be retrieved from the &amp;quot;deck&amp;quot; location, if it is empty the &amp;quot;discard&amp;quot; location will be automatically reshuffled into the &amp;quot;deck&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
If you need to notify players when the deck is shuffled, you can setup a callback method using this feature: $this-&amp;gt;cards-&amp;gt;autoreshuffle_trigger = array(&#039;obj&#039; =&amp;gt; $this, &#039;method&#039; =&amp;gt; &#039;deckAutoReshuffle&#039;);&lt;br /&gt;
&lt;br /&gt;
If you need to use other locations than &amp;quot;deck&amp;quot; and &amp;quot;discard&amp;quot; for auto-reshuffle feature, you can configure it this way: $this-&amp;gt;cards-&amp;gt;autoreshuffle_custom = array(&#039;deck&#039; =&amp;gt; &#039;discard&#039;); (replace &#039;deck&#039; and &#039;discard&#039; with your custom locations).&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=5021</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=5021"/>
		<updated>2020-07-19T20:20:04Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Scoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoid taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
== Options availables ==&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;geronimo&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
When playing with this option, each player at his/her turn will choose the hand he/she wants to play. Yet, during the game, all the players will have to play all the hands.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Double&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
After declarer picks a game but before the first trick is led, each of the other players may wager double against one or more of the other players. This operates like a side bet on the relative game score between the two players, who are said to have &amp;quot;business&amp;quot; with each other. The rules for doubling are:&lt;br /&gt;
&lt;br /&gt;
* Each player gets one opportunity to double&lt;br /&gt;
* A player can choose to double only some players (declarer or non-declarer) or pass&lt;br /&gt;
* At a positive game, non-dealers may only double the dealer (who may redouble)&lt;br /&gt;
* Each non-declarer must double against declarer &#039;&#039;&#039;at least twice&#039;&#039;&#039; during the game for each declarer.&lt;br /&gt;
* Any player receiving a wager of double may redouble; &amp;quot;maximum&amp;quot; implies redoubling all received wagers as well as doubling the remaining players&lt;br /&gt;
* Declarer can not double, but may redouble as above. A &amp;quot;maximum&amp;quot; from the dealer therefore redoubles received wagers only&lt;br /&gt;
&lt;br /&gt;
After the hand is played out and scores are tallied, modifications are made for doubles as follows:&lt;br /&gt;
&lt;br /&gt;
* Between each pair of players who doubled, the difference in their scores is calculated. Player with the higher score for that round is awarded the amount of the difference and player with the lower score had the same amount subtracted from his or her score.&lt;br /&gt;
* Redoubled wagers are figured the same way, with the difference in scores doubled before awards and penalties are tallied.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Play an extra hand, the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Anti-Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Similar to the &amp;quot;Salade&amp;quot;, the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Last two&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
In this hand, try to avoid taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Trumps&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The declareer choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
Some rules apply when you play with trumps:&lt;br /&gt;
&lt;br /&gt;
* If a trump is led, each player must, if able, play a higher trump than those played before. Otherwise players follow suit, or discard if they are void in trumps.&lt;br /&gt;
* If a plain suit is led, players follow suit if possible.&lt;br /&gt;
* If they cannot and no trump has been played, they must play a trump card if possible or otherwise play a card of one of the other suits.&lt;br /&gt;
* If a non-trump has been led and trumped, a player must, if possible, play a higher trump than those previously played. Otherwise the player may slough off any card.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Domino&amp;quot; (Klondike) ===&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== Scoring ==&lt;br /&gt;
&lt;br /&gt;
Scoring depends on the variant and the type of deck you play with:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Scores&#039;&#039;&#039;&lt;br /&gt;
! Deck type&lt;br /&gt;
! No trick (per trick)&lt;br /&gt;
! No hearts (per heart)&lt;br /&gt;
! No queens (per queen)&lt;br /&gt;
! No Barbu&lt;br /&gt;
! Last two&lt;br /&gt;
! Trumps&lt;br /&gt;
! Domino&lt;br /&gt;
|-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|&#039;&#039;&#039;Basic scoring&#039;&#039;&#039;&lt;br /&gt;
| 32-cards&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
| -8&lt;br /&gt;
| -5 for the ultimate&amp;lt;br&amp;gt;-3 for penultimate&lt;br /&gt;
| +2 per trick&lt;br /&gt;
| +20 for the first&amp;lt;br&amp;gt;+10 for the second&amp;lt;br&amp;gt;0 for the others&lt;br /&gt;
|-&lt;br /&gt;
| 52-cards&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -3&lt;br /&gt;
| -12&lt;br /&gt;
| -8 for the ultimate&amp;lt;br&amp;gt;-4 for penultimate&lt;br /&gt;
| +3 per trick&lt;br /&gt;
| +25 for the first&amp;lt;br&amp;gt;+15 for the second&amp;lt;br&amp;gt;+5 for the third&amp;lt;br&amp;gt;0 for the others&lt;br /&gt;
|-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|&#039;&#039;&#039;Wikipedia scoring&#039;&#039;&#039;&lt;br /&gt;
| 32-cards&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -2&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -2&lt;br /&gt;
-6 for Ace of Hearts&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -6&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -20&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -20 for the ultimate&amp;lt;br&amp;gt;-10 for penultimate&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| +5 per trick&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| +45 for the first&amp;lt;br&amp;gt;+20 for the second&amp;lt;br&amp;gt;+5 for the third&amp;lt;br&amp;gt;-5 for the other players&lt;br /&gt;
|-&lt;br /&gt;
| 52-cards&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=5020</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=5020"/>
		<updated>2020-07-19T20:19:47Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Scoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoid taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
== Options availables ==&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;geronimo&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
When playing with this option, each player at his/her turn will choose the hand he/she wants to play. Yet, during the game, all the players will have to play all the hands.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Double&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
After declarer picks a game but before the first trick is led, each of the other players may wager double against one or more of the other players. This operates like a side bet on the relative game score between the two players, who are said to have &amp;quot;business&amp;quot; with each other. The rules for doubling are:&lt;br /&gt;
&lt;br /&gt;
* Each player gets one opportunity to double&lt;br /&gt;
* A player can choose to double only some players (declarer or non-declarer) or pass&lt;br /&gt;
* At a positive game, non-dealers may only double the dealer (who may redouble)&lt;br /&gt;
* Each non-declarer must double against declarer &#039;&#039;&#039;at least twice&#039;&#039;&#039; during the game for each declarer.&lt;br /&gt;
* Any player receiving a wager of double may redouble; &amp;quot;maximum&amp;quot; implies redoubling all received wagers as well as doubling the remaining players&lt;br /&gt;
* Declarer can not double, but may redouble as above. A &amp;quot;maximum&amp;quot; from the dealer therefore redoubles received wagers only&lt;br /&gt;
&lt;br /&gt;
After the hand is played out and scores are tallied, modifications are made for doubles as follows:&lt;br /&gt;
&lt;br /&gt;
* Between each pair of players who doubled, the difference in their scores is calculated. Player with the higher score for that round is awarded the amount of the difference and player with the lower score had the same amount subtracted from his or her score.&lt;br /&gt;
* Redoubled wagers are figured the same way, with the difference in scores doubled before awards and penalties are tallied.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Play an extra hand, the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Anti-Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Similar to the &amp;quot;Salade&amp;quot;, the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Last two&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
In this hand, try to avoid taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Trumps&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The declareer choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
Some rules apply when you play with trumps:&lt;br /&gt;
&lt;br /&gt;
* If a trump is led, each player must, if able, play a higher trump than those played before. Otherwise players follow suit, or discard if they are void in trumps.&lt;br /&gt;
* If a plain suit is led, players follow suit if possible.&lt;br /&gt;
* If they cannot and no trump has been played, they must play a trump card if possible or otherwise play a card of one of the other suits.&lt;br /&gt;
* If a non-trump has been led and trumped, a player must, if possible, play a higher trump than those previously played. Otherwise the player may slough off any card.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Domino&amp;quot; (Klondike) ===&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== Scoring ==&lt;br /&gt;
&lt;br /&gt;
Scoring depends on the variant and the type of deck you play with:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Scores&#039;&#039;&#039;&lt;br /&gt;
! Deck type&lt;br /&gt;
! No trick (per trick)&lt;br /&gt;
! No hearts (per heart)&lt;br /&gt;
! No queens (per queen)&lt;br /&gt;
! No Barbu&lt;br /&gt;
! Last two&lt;br /&gt;
! Trumps&lt;br /&gt;
! Domino&lt;br /&gt;
|-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|&#039;&#039;&#039;Basic scoring&#039;&#039;&#039;&lt;br /&gt;
| 32-cards&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
| -8&lt;br /&gt;
| -5 for the ultimate&amp;lt;br&amp;gt;-3 for penultimate&lt;br /&gt;
| +2 per trick&lt;br /&gt;
| +20 for the first&amp;lt;br&amp;gt;+10 for the second&amp;lt;br&amp;gt;0 for the others&lt;br /&gt;
|-&lt;br /&gt;
| 52-cards&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -3&lt;br /&gt;
| -12&lt;br /&gt;
| -8 for the ultimate&amp;lt;br&amp;gt;-4 for penultimate&lt;br /&gt;
| +3 per trick&lt;br /&gt;
| +25 for the first&amp;lt;br&amp;gt;+15 for the second&amp;lt;br&amp;gt;5 for the third&amp;lt;br&amp;gt;0 for the others&lt;br /&gt;
|-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|&#039;&#039;&#039;Wikipedia scoring&#039;&#039;&#039;&lt;br /&gt;
| 32-cards&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -2&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -2&lt;br /&gt;
-6 for Ace of Hearts&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -6&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -20&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -20 for the ultimate&amp;lt;br&amp;gt;-10 for penultimate&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| +5 per trick&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| +45 for the first&amp;lt;br&amp;gt;+20 for the second&amp;lt;br&amp;gt;5 for the third&amp;lt;br&amp;gt;-5 for the other players&lt;br /&gt;
|-&lt;br /&gt;
| 52-cards&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=5019</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=5019"/>
		<updated>2020-07-19T20:19:22Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoid taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
== Options availables ==&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;geronimo&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
When playing with this option, each player at his/her turn will choose the hand he/she wants to play. Yet, during the game, all the players will have to play all the hands.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Double&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
After declarer picks a game but before the first trick is led, each of the other players may wager double against one or more of the other players. This operates like a side bet on the relative game score between the two players, who are said to have &amp;quot;business&amp;quot; with each other. The rules for doubling are:&lt;br /&gt;
&lt;br /&gt;
* Each player gets one opportunity to double&lt;br /&gt;
* A player can choose to double only some players (declarer or non-declarer) or pass&lt;br /&gt;
* At a positive game, non-dealers may only double the dealer (who may redouble)&lt;br /&gt;
* Each non-declarer must double against declarer &#039;&#039;&#039;at least twice&#039;&#039;&#039; during the game for each declarer.&lt;br /&gt;
* Any player receiving a wager of double may redouble; &amp;quot;maximum&amp;quot; implies redoubling all received wagers as well as doubling the remaining players&lt;br /&gt;
* Declarer can not double, but may redouble as above. A &amp;quot;maximum&amp;quot; from the dealer therefore redoubles received wagers only&lt;br /&gt;
&lt;br /&gt;
After the hand is played out and scores are tallied, modifications are made for doubles as follows:&lt;br /&gt;
&lt;br /&gt;
* Between each pair of players who doubled, the difference in their scores is calculated. Player with the higher score for that round is awarded the amount of the difference and player with the lower score had the same amount subtracted from his or her score.&lt;br /&gt;
* Redoubled wagers are figured the same way, with the difference in scores doubled before awards and penalties are tallied.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Play an extra hand, the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Anti-Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Similar to the &amp;quot;Salade&amp;quot;, the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Last two&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
In this hand, try to avoid taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Trumps&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The declareer choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
Some rules apply when you play with trumps:&lt;br /&gt;
&lt;br /&gt;
* If a trump is led, each player must, if able, play a higher trump than those played before. Otherwise players follow suit, or discard if they are void in trumps.&lt;br /&gt;
* If a plain suit is led, players follow suit if possible.&lt;br /&gt;
* If they cannot and no trump has been played, they must play a trump card if possible or otherwise play a card of one of the other suits.&lt;br /&gt;
* If a non-trump has been led and trumped, a player must, if possible, play a higher trump than those previously played. Otherwise the player may slough off any card.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Domino&amp;quot; (Klondike) ===&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== Scoring ==&lt;br /&gt;
&lt;br /&gt;
Scoring depends on the variant and the type of deck you play with:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Scores&#039;&#039;&#039;&lt;br /&gt;
! Deck type&lt;br /&gt;
! No trick (per trick)&lt;br /&gt;
! No hearts (per heart)&lt;br /&gt;
! No queens (per queen)&lt;br /&gt;
! No Barbu&lt;br /&gt;
! Last two&lt;br /&gt;
! Trumps&lt;br /&gt;
! Domino&lt;br /&gt;
|-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|&#039;&#039;&#039;Basic scoring&#039;&#039;&#039;&lt;br /&gt;
| 32-cards&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -2&lt;br /&gt;
| -8&lt;br /&gt;
| -5 for the ultimate&amp;lt;br&amp;gt;-3 for penuultimate&lt;br /&gt;
| +2 per trick&lt;br /&gt;
| +20 for the first&amp;lt;br&amp;gt;+10 for the second&amp;lt;br&amp;gt;0 for the others&lt;br /&gt;
|-&lt;br /&gt;
| 52-cards&lt;br /&gt;
| -1&lt;br /&gt;
| -1&lt;br /&gt;
| -3&lt;br /&gt;
| -12&lt;br /&gt;
| -8 for the ultimate&amp;lt;br&amp;gt;-4 for penuultimate&lt;br /&gt;
| +3 per trick&lt;br /&gt;
| +25 for the first&amp;lt;br&amp;gt;+15 for the second&amp;lt;br&amp;gt;5 for the third&amp;lt;br&amp;gt;0 for the others&lt;br /&gt;
|-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|&#039;&#039;&#039;Wikipedia scoring&#039;&#039;&#039;&lt;br /&gt;
| 32-cards&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -2&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -2&lt;br /&gt;
-6 for Ace of Hearts&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -6&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -20&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| -20 for the ultimate&amp;lt;br&amp;gt;-10 for penultimate&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| +5 per trick&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;| +45 for the first&amp;lt;br&amp;gt;+20 for the second&amp;lt;br&amp;gt;5 for the third&amp;lt;br&amp;gt;-5 for the other players&lt;br /&gt;
|-&lt;br /&gt;
| 52-cards&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Players_actions:_yourgamename.action.php&amp;diff=4849</id>
		<title>Players actions: yourgamename.action.php</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Players_actions:_yourgamename.action.php&amp;diff=4849"/>
		<updated>2020-07-02T19:51:08Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: Add the fact you cannot retrieve data from an ajax call (even if callback exists which is wierd somehow)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
== Purpose of this file ==&lt;br /&gt;
&lt;br /&gt;
With this file, you define all the player entry points (i.e., possible game actions) for your game.&lt;br /&gt;
&lt;br /&gt;
This file is a sort of &amp;quot;bridge&amp;quot; between the AJAX calls you perform from the Javascript client side, and your main PHP code in &amp;quot;yourgame.game.php&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The role of the methods defined in this file is to filter the arguments, format them a bit, and then call a corresponding PHP method from your main game logic (&amp;quot;yourgame.game.php&amp;quot; file).&lt;br /&gt;
&lt;br /&gt;
Methods in this file should be short: no game logic must be introduced here.&lt;br /&gt;
&lt;br /&gt;
== Example of typical action method ==&lt;br /&gt;
&lt;br /&gt;
(from Reversi example)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public function playDisc()&lt;br /&gt;
    {&lt;br /&gt;
        self::setAjaxMode();     &lt;br /&gt;
        $x = self::getArg( &amp;quot;x&amp;quot;, AT_posint, true );&lt;br /&gt;
        $y = self::getArg( &amp;quot;y&amp;quot;, AT_posint, true );&lt;br /&gt;
        $result = $this-&amp;gt;game-&amp;gt;playDisc( $x, $y );&lt;br /&gt;
        self::ajaxResponse( );&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Methods to use in action methods ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;function setAjaxMode()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Must be used at the beginning of each action method.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;function ajaxResponse()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Must be used at the end of each action method.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;function getArg( $argName, $argType, $mandatory=false, $default=NULL, $argTypeDetails=array(), $bCanFail=false  )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method must be used to retrieve the arguments sent with your AJAX query.&lt;br /&gt;
&lt;br /&gt;
You must &#039;&#039;not&#039;&#039; use &amp;quot;_GET&amp;quot;, &amp;quot;_POST&amp;quot; or equivalent PHP variables to do this, as it is unsafe.&lt;br /&gt;
&lt;br /&gt;
This method uses the following arguments:&lt;br /&gt;
&lt;br /&gt;
* argName: the name of the argument to retrieve.&lt;br /&gt;
* argType: the type of the argument. You should use one of the following:&lt;br /&gt;
  &#039;AT_int&#039; for an integer&lt;br /&gt;
  &#039;AT_posint&#039; for a positive integer &lt;br /&gt;
  &#039;AT_float&#039; for a float&lt;br /&gt;
  &#039;AT_bool&#039; for 1/0/true/false&lt;br /&gt;
  &#039;AT_enum&#039; for an enumeration (argTypeDetails lists the possible values as an array)&lt;br /&gt;
  &#039;AT_alphanum&#039; for a string with 0-9a-zA-Z_ and space&lt;br /&gt;
  &#039;AT_numberlist&#039; for a list of numbers separated with &amp;quot;,&amp;quot; or &amp;quot;;&amp;quot; (example: 1,4;2,3;-1,2).&lt;br /&gt;
  &#039;AT_base64&#039; for a base64-encoded string.&lt;br /&gt;
* mandatory: specify &amp;quot;true&amp;quot; if the argument is mandatory.&lt;br /&gt;
* default: if mandatory=false, you can specify here a default value in case the argument is not present.&lt;br /&gt;
* argTypeDetails: see AT_enum above.&lt;br /&gt;
* bCanFail: if true, specify that it may be possible that the argument won&#039;t be of the type specified by argType (and then do not log this as a fatal error in the system, and return a standard exception to the player).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;function isArg( $argName )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is a useful method when you only want to check if an argument is present or not present in your AJAX request (and don&#039;t care about the value).&lt;br /&gt;
&lt;br /&gt;
It returns &amp;quot;true&amp;quot; or &amp;quot;false&amp;quot; according to whether &amp;quot;argName&amp;quot; has been specified as an argument of the AJAX request or not.&lt;br /&gt;
&lt;br /&gt;
== Useful tip: retrieve a list of numbers ==&lt;br /&gt;
&lt;br /&gt;
If your Javascript sends a list of integers separated by &amp;quot;;&amp;quot; (example: &amp;quot;1;2;3;4&amp;quot;) as an argument, you can transform them into a PHP array with the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    public function playCards()&lt;br /&gt;
    {&lt;br /&gt;
        self::setAjaxMode();     &lt;br /&gt;
&lt;br /&gt;
        $card_ids_raw = self::getArg( &amp;quot;card_ids&amp;quot;, AT_numberlist, true );&lt;br /&gt;
        &lt;br /&gt;
        // Removing last &#039;;&#039; if exists&lt;br /&gt;
        if( substr( $card_ids_raw, -1 ) == &#039;;&#039; )&lt;br /&gt;
            $card_ids_raw = substr( $card_ids_raw, 0, -1 );&lt;br /&gt;
        if( $card_ids_raw == &#039;&#039; )&lt;br /&gt;
            $card_ids = array();&lt;br /&gt;
        else&lt;br /&gt;
            $card_ids = explode( &#039;;&#039;, $card_ids_raw );&lt;br /&gt;
&lt;br /&gt;
        $this-&amp;gt;game-&amp;gt;playCards( $card_ids );&lt;br /&gt;
        self::ajaxResponse( );&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Retrieving data from ajax call ==&lt;br /&gt;
&lt;br /&gt;
Note that this is not possible to return any result from a player action: it should return nothing (action went fine) or an exception (action unsuccessful).&lt;br /&gt;
&lt;br /&gt;
The typical way to implement this is using games states with game state arguments. Eventually, use player notifications.&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Deck&amp;diff=4830</id>
		<title>Deck</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Deck&amp;diff=4830"/>
		<updated>2020-07-01T08:33:02Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Create a new Deck component */ Add precision if multiple decks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Deck&amp;quot; is one of the most useful component on the PHP side. With &amp;quot;Deck&amp;quot;, you can manage the cards in your game on the server side.&lt;br /&gt;
&lt;br /&gt;
Using &amp;quot;deck&amp;quot;, you will be able to use the following features without writing a single SQL database request:&lt;br /&gt;
* Place cards in a pile, shuffle cards, draw cards one by one or many at a time.&lt;br /&gt;
* &amp;quot;Auto-reshuffle&amp;quot; the discard pile into the deck when the deck is empty.&lt;br /&gt;
* Move cards between different locations: hands of players, the table, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using Deck: Hearts example ==&lt;br /&gt;
&lt;br /&gt;
The Deck component is extensively used in the sample &#039;&#039;Hearts&#039;&#039; card game. You will find in &amp;quot;hearts.game.php&amp;quot; that the object &amp;quot;$this-&amp;gt;cards&amp;quot; is used many times.&lt;br /&gt;
&lt;br /&gt;
== Deck overview ==&lt;br /&gt;
&lt;br /&gt;
With Deck component, you manage all cards of your game.&lt;br /&gt;
&lt;br /&gt;
=== The 5 properties of each card ===&lt;br /&gt;
&lt;br /&gt;
Using the Deck component, each card will have 5 properties:&lt;br /&gt;
* &#039;&#039;&#039;id&#039;&#039;&#039;: This is the unique ID of each card.&lt;br /&gt;
* &#039;&#039;&#039;type&#039;&#039;&#039; and &#039;&#039;&#039;type_arg&#039;&#039;&#039;: These two values define the type of your card (i.e., what sort of card is this?).&lt;br /&gt;
* &#039;&#039;&#039;location&#039;&#039;&#039; and &#039;&#039;&#039;location_arg&#039;&#039;&#039;: These two values define where the card is at now.&lt;br /&gt;
&lt;br /&gt;
The id, type, and type_arg properties are constants throughout the game. location and location_arg change when your cards move from one place to another in the game area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;id&#039;&#039;&#039; is the unique ID of each card. Two cards cannot have the same ID. IDs are generated automatically by the Deck component when you create cards during the Setup phase of your game.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type&#039;&#039;&#039; and &#039;&#039;&#039;type_arg&#039;&#039;&#039; defines the type of your card.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type&#039;&#039;&#039; is a short string, and &#039;&#039;&#039;type_arg&#039;&#039;&#039; is an integer.&lt;br /&gt;
&lt;br /&gt;
You can use these two values as you like to make sure you will be able to identify the different cards in the game. See usage of &amp;quot;type&amp;quot; and &amp;quot;type_arg&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
Examples of usage of &amp;quot;type&amp;quot; and &amp;quot;type_arg&amp;quot;:&lt;br /&gt;
* In &#039;&#039;Hearts&#039;&#039;, &amp;quot;type&amp;quot; represents the color (suite) of the card (1 to 4) and &amp;quot;type_arg&amp;quot; is the value of the card (1, 2, ... 10, J, Q, K).&lt;br /&gt;
* In &#039;&#039;Seasons&#039;&#039;, &amp;quot;type&amp;quot; represents the type of the card (e.g., 1 is Amulet of Air, 2 is Amulet of Fire, etc...). type_arg is not used.&lt;br /&gt;
* In &#039;&#039;Takenoko&#039;&#039;, a Deck component is used for objective cards. &amp;quot;type&amp;quot; is the kind of objective (irrigation/panda/plot) and &amp;quot;type_arg&amp;quot; is the ID of the specific objective to realize (e.g., &amp;quot;green bamboo x4&amp;quot;). Note that a second Deck component is used in &#039;&#039;Takenoko&#039;&#039; to manage the &amp;quot;garden plot&amp;quot; pile.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;location&#039;&#039;&#039; and &#039;&#039;&#039;location_arg&#039;&#039;&#039; define where a card is at now. &#039;&#039;&#039;location&#039;&#039;&#039; is a short string, and &#039;&#039;&#039;location_arg&#039;&#039;&#039; is an integer.&lt;br /&gt;
&lt;br /&gt;
You can use &#039;location&#039; and &#039;location_arg&#039; as you like, to move your card within the game area.&lt;br /&gt;
&lt;br /&gt;
There are 3 special &#039;location&#039; values that Deck manages automatically. You can choose to use these locations or not, depending on your needs:&lt;br /&gt;
* &#039;deck&#039;: the &#039;deck&#039; location is a standard draw deck. Cards are placed face down in a stack and are drawn in sequential order during the game. &#039;location_arg&#039; is used to specify where the card is located within the stack (the card with the highest location_arg value is the next to be drawn).&lt;br /&gt;
* &#039;hand&#039;: the &#039;hand&#039; location represents cards in a player&#039;s hand. &#039;location_arg&#039; is set to the ID of each player.&lt;br /&gt;
* &#039;discard&#039;: the &#039;discard&#039; location is used for discard piles. Card in &#039;discard&#039; may be reshuffled into the deck if needed (see &amp;quot;autoreshuffle&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tips: using the Deck component, you will use generic properties (&amp;quot;location&amp;quot;, &amp;quot;type_arg&amp;quot;,...) for specific purposes in your game. Thus, during the design step before realizing your game, take a few minutes to write down the exact meaning of each of these generic properties in the context of your game.&lt;br /&gt;
&lt;br /&gt;
=== Create a new Deck component ===&lt;br /&gt;
&lt;br /&gt;
For each Deck component in your game, you need to create a dedicated table in the SQL database. This table has a standard format. In practice, if you just want to have a Deck component named &amp;quot;card&amp;quot;, you can copy/paste the following into your &amp;quot;dbmodel.sql&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TABLE IF NOT EXISTS `card` (&lt;br /&gt;
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&lt;br /&gt;
  `card_type` varchar(16) NOT NULL,&lt;br /&gt;
  `card_type_arg` int(11) NOT NULL,&lt;br /&gt;
  `card_location` varchar(16) NOT NULL,&lt;br /&gt;
  `card_location_arg` int(11) NOT NULL,&lt;br /&gt;
  PRIMARY KEY (`card_id`)&lt;br /&gt;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: the database schema of this table does not have to be exactly what is listed above. You can increase the size of the fields or add more fields. For additional fields&lt;br /&gt;
you just have to do manual queries.&lt;br /&gt;
&lt;br /&gt;
Once you have done this (and restarted your game), you can declare the Deck component in your PHP code in your class constructor. For &#039;&#039;Hearts&#039;&#039; for example, I added to the &amp;quot;Hearts()&amp;quot; method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $this-&amp;gt;cards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;init( &amp;quot;card&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we specify &amp;quot;card&amp;quot; here: the name of our previously created table. This means you can create several &amp;quot;Deck&amp;quot; components with multiple tables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $this-&amp;gt;firstKindCards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;firstKindCards -&amp;gt;init( &amp;quot;first_kind_card&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;secondKindCards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;secondKindCards -&amp;gt;init( &amp;quot;second_kind_card&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the time this is not useful; a Deck component should manage all objects of the same kind (i.e., all cards in the game).&lt;br /&gt;
Note that you need to create a table for each &amp;quot;Deck&amp;quot;, table name should be &amp;quot;first_kind_card&amp;quot; but the fields must remain &amp;quot;card_id&amp;quot;, &amp;quot;card_type&amp;quot; and so on.&lt;br /&gt;
&lt;br /&gt;
Afterwards, we can initialize your &amp;quot;Deck&amp;quot; by creating all the cards of the game. Generally, this is done only once during the game, in the &amp;quot;setupNewGame&amp;quot; method.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Deck&amp;quot; component provides a fast way to initialize all your cards at once: createCards. Here is how it is used for &amp;quot;Hearts&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        // Create cards&lt;br /&gt;
        $cards = array();&lt;br /&gt;
        foreach( $this-&amp;gt;colors as  $color_id =&amp;gt; $color ) // spade, heart, diamond, club&lt;br /&gt;
        {&lt;br /&gt;
            for( $value=2; $value&amp;lt;=14; $value++ )   //  2, 3, 4, ... K, A&lt;br /&gt;
            {&lt;br /&gt;
                $cards[] = array( &#039;type&#039; =&amp;gt; $color_id, &#039;type_arg&#039; =&amp;gt; $value, &#039;nbr&#039; =&amp;gt; 1);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;createCards( $cards, &#039;deck&#039; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, &amp;quot;createCards&amp;quot; takes a description of all cards of the game. For each type of card, you have to specify its &amp;quot;type&amp;quot;, &amp;quot;type_arg&amp;quot; and the number of card to create. &amp;quot;createCards&amp;quot; create all cards and place them into the &amp;quot;deck&amp;quot; location (as specified in the second argument).&lt;br /&gt;
&lt;br /&gt;
Now, you are ready to use &amp;quot;Deck&amp;quot;!&lt;br /&gt;
&lt;br /&gt;
=== Simple examples using Deck ===&lt;br /&gt;
&lt;br /&gt;
(Most examples are from &amp;quot;Hearts&amp;quot; game)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // In &amp;quot;getAllDatas&#039;, we need to send to the current player all the cards he has in hand:&lt;br /&gt;
     $result[&#039;hand&#039;] = $this-&amp;gt;cards-&amp;gt;getCardsInLocation( &#039;hand&#039;, $player_id );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // At some time we want to check if all the cards (52) are in player&#039;s hands:&lt;br /&gt;
     if( $this-&amp;gt;cards-&amp;gt;countCardInLocation( &#039;hand&#039; ) == 52 )&lt;br /&gt;
           // do something&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // When a player plays a card in front of him on the table:&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;moveCard( $card_id, &#039;cardsontable&#039;, $player_id );&lt;br /&gt;
&lt;br /&gt;
     // Note the use of the custom location &#039;cardsontable&#039; here to keep track of cards on the table.&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;
     // This is a new hand: let&#039;s gather all cards from everywhere in the deck:&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;moveAllCardsInLocation( null, &amp;quot;deck&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
     // And then shuffle the deck&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;shuffle( &#039;deck&#039; );&lt;br /&gt;
&lt;br /&gt;
     // And then deal 13 cards to each player&lt;br /&gt;
     // Deal 13 cards to each players&lt;br /&gt;
     // Create deck, shuffle it and give 13 initial cards&lt;br /&gt;
     $players = self::loadPlayersBasicInfos();&lt;br /&gt;
     foreach( $players as $player_id =&amp;gt; $player )&lt;br /&gt;
     {&lt;br /&gt;
        $cards = $this-&amp;gt;cards-&amp;gt;pickCards( 13, &#039;deck&#039;, $player_id );&lt;br /&gt;
           &lt;br /&gt;
        // Notify player about his cards&lt;br /&gt;
        self::notifyPlayer( $player_id, &#039;newHand&#039;, &#039;&#039;, array( &lt;br /&gt;
            &#039;cards&#039; =&amp;gt; $cards&lt;br /&gt;
         ) );&lt;br /&gt;
     }  &lt;br /&gt;
&lt;br /&gt;
     // Note the use of &amp;quot;notifyPlayer&amp;quot; instead of &amp;quot;notifyAllPlayers&amp;quot;: new cards is a private information ;)  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deck component reference ==&lt;br /&gt;
&lt;br /&gt;
=== Initializing Deck component ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;init( $table_name )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Initialize the Deck component.&lt;br /&gt;
&lt;br /&gt;
Argument:&lt;br /&gt;
* table_name: name of the DB table used by this Deck component.&lt;br /&gt;
&lt;br /&gt;
Must be called before any other Deck method.&lt;br /&gt;
&lt;br /&gt;
Usually, init is called in your game constructor.&lt;br /&gt;
&lt;br /&gt;
Example with Hearts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	function Hearts( )&lt;br /&gt;
	{&lt;br /&gt;
        (...)&lt;br /&gt;
        &lt;br /&gt;
        $this-&amp;gt;cards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;init( &amp;quot;card&amp;quot; );&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;createCards( $cards, $location=&#039;deck&#039;, $location_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create card items in your deck component. Usually, all card items are created once, during the setup phase of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;cards&amp;quot; describe all cards that need to be created. &amp;quot;cards&amp;quot; is an array with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   // Create 1 card of type &amp;quot;1&amp;quot; with type_arg=99,&lt;br /&gt;
   //  and 4 cards of type &amp;quot;2&amp;quot; with type_arg=12,&lt;br /&gt;
   //  and 2 cards of type &amp;quot;3&amp;quot; with type_arg=33&lt;br /&gt;
&lt;br /&gt;
   $cards = array(&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 1, &#039;type_arg&#039; =&amp;gt; 99, &#039;nbr&#039; =&amp;gt; 1 ),&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 2, &#039;type_arg&#039; =&amp;gt; 12, &#039;nbr&#039; =&amp;gt; 4 ),&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 3, &#039;type_arg&#039; =&amp;gt; 33, &#039;nbr&#039; =&amp;gt; 2 )&lt;br /&gt;
        ...&lt;br /&gt;
   );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: During the &amp;quot;createCards&amp;quot; process, Deck generates unique IDs for all card items.&lt;br /&gt;
&lt;br /&gt;
Note: createCards is optimized to create a lot of cards at once. Do not use it to create cards one by one.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;location&amp;quot; and &amp;quot;location_arg&amp;quot; arguments are not set, newly created cards are placed in the &amp;quot;deck&amp;quot; location. If &amp;quot;location&amp;quot; (and optionally location_arg) is specified, cards are created for this specific location.&lt;br /&gt;
&lt;br /&gt;
=== Card standard format ===&lt;br /&gt;
&lt;br /&gt;
When Deck component methods are returning one or several cards, the following format is used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&lt;br /&gt;
   &#039;id&#039; =&amp;gt; ..,          // the card ID&lt;br /&gt;
   &#039;type&#039; =&amp;gt; ..,        // the card type&lt;br /&gt;
   &#039;type_arg&#039; =&amp;gt; ..,    // the card type argument&lt;br /&gt;
   &#039;location&#039; =&amp;gt; ..,    // the card location&lt;br /&gt;
   &#039;location_arg&#039; =&amp;gt; .. // the card location argument&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Picking cards ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCard( $location, $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pick a card from a &amp;quot;pile&amp;quot; location (ex: &amp;quot;deck&amp;quot;) and place it in the &amp;quot;hand&amp;quot; of specified player.&lt;br /&gt;
&lt;br /&gt;
Return the card picked or &amp;quot;null&amp;quot; if there are no more card in given location.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCards( $nbr, $location, $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pick &amp;quot;$nbr&amp;quot; cards from a &amp;quot;pile&amp;quot; location (ex: &amp;quot;deck&amp;quot;) and place them in the &amp;quot;hand&amp;quot; of specified player.&lt;br /&gt;
&lt;br /&gt;
Return an array with the cards picked (indexed by the card ID), or &amp;quot;null&amp;quot; if there are no more card in given location.&lt;br /&gt;
&lt;br /&gt;
Note that the number of cards picked can be less than &amp;quot;$nbr&amp;quot; in case there are not enough cards in the pile location.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below). In case there are not enough cards in the pile, all remaining cards are picked first, then the auto-reshuffle is triggered, then the other cards are picked.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCardForLocation( $from_location, $to_location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method is similar to &#039;pickCard&#039;, except that you can pick a card for any sort of location and not only the &amp;quot;hand&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
* from_location is the &amp;quot;pile&amp;quot; style location from where you are picking a card.&lt;br /&gt;
* to_location is the location where you will place the card picked.&lt;br /&gt;
* if &amp;quot;location_arg&amp;quot; is specified, the card picked will be set with this &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCardsForLocation( $nbr, $from_location, $to_location, $location_arg=0, $no_deck_reform=false )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method is similar to &#039;pickCards&#039;, except that you can pick cards for any sort of location and not only the &amp;quot;hand&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
* from_location is the &amp;quot;pile&amp;quot; style location from where you are picking some cards.&lt;br /&gt;
* to_location is the location where you will place the cards picked.&lt;br /&gt;
* if &amp;quot;location_arg&amp;quot; is specified, the cards picked will be set with this &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
* if &amp;quot;no_deck_reform&amp;quot; is set to &amp;quot;true&amp;quot;, the auto-reshuffle feature is disabled during this method call.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
=== Moving cards ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveCard( $card_id, $location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the specific card to given location.&lt;br /&gt;
&lt;br /&gt;
* card_id: ID of the card to move.&lt;br /&gt;
* location: location where to move the card.&lt;br /&gt;
* location_arg: if specified, location_arg where to move the card. If not specified &amp;quot;location_arg&amp;quot; will be set to 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveCards( $cards, $location, $location_arg )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the specific cards to given location.&lt;br /&gt;
&lt;br /&gt;
* cards: an array of IDs of cards to move.&lt;br /&gt;
* location: location where to move the cards.&lt;br /&gt;
* location_arg: if specified, location_arg where to move the cards. If not specified &amp;quot;location_arg&amp;quot; will be set to 0.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;insertCard( $card_id, $location, $location_arg )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move a card to a specific &amp;quot;pile&amp;quot; location where card are ordered.&lt;br /&gt;
&lt;br /&gt;
If location_arg place is already taken, increment all cards after location_arg in order to insert new card at this precise location.&lt;br /&gt;
&lt;br /&gt;
(note: insertCardOnExtremePosition method below is more useful in most of the case)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;insertCardOnExtremePosition( $card_id, $location, $bOnTop )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move a card on top or at bottom of given &amp;quot;pile&amp;quot; type location.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveAllCardsInLocation(  $from_location, $to_location, $from_location_arg=null, $to_location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move all cards in specified &amp;quot;from&amp;quot; location to given location.&lt;br /&gt;
&lt;br /&gt;
* from_location: where to take the cards&lt;br /&gt;
* to_location: where to put the cards&lt;br /&gt;
* from_location (optional): if specified, only cards with given &amp;quot;location_arg&amp;quot; are moved.&lt;br /&gt;
* to_location (optional): if specified, cards moved &amp;quot;location_arg&amp;quot; is set to given value. Otherwise location_arg is set to zero.&lt;br /&gt;
&lt;br /&gt;
Note: if you want to keep &amp;quot;location_arg&amp;quot; untouched, you should use &amp;quot;moveAllCardsInLocationKeepOrder&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveAllCardsInLocationKeepOrder( $from_location, $to_location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move all cards in specified &amp;quot;from&amp;quot; location to given &amp;quot;to&amp;quot; location. This method does not modify the &amp;quot;location_arg&amp;quot; of cards.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;playCard( $card_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move specified card at the top of the &amp;quot;discard&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
Note: this is an alias for: insertCardOnExtremePosition( $card_id, &amp;quot;discard&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
=== Get cards informations ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCard( $card_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get specific card information.&lt;br /&gt;
&lt;br /&gt;
Return null if this card is not found.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCards( $cards_array )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get specific cards information.&lt;br /&gt;
&lt;br /&gt;
cards_array is an array of cards ID.&lt;br /&gt;
&lt;br /&gt;
If some cards are not found or if some cards IDs are specified multiple times, the method throws an (unexpected) Exception.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsInLocation( $location, $location_arg = null, $order_by = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards in specific location, as an array. Return an empty array if the location is empty.&lt;br /&gt;
&lt;br /&gt;
* location (string): the location where to get the cards.&lt;br /&gt;
* location_arg (optional): if specified, return only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
* order_by (optional): if specified, returned cards are ordered by the given database field. Example: &amp;quot;card_id&amp;quot; or &amp;quot;card_type&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardInLocation( $location, $location_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in specified location.&lt;br /&gt;
&lt;br /&gt;
* location (string): the location where to count the cards.&lt;br /&gt;
* location_arg (optional): if specified, count only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardsInLocations()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in each location of the game.&lt;br /&gt;
&lt;br /&gt;
The method returns an associative array with the format &amp;quot;location&amp;quot; =&amp;gt; &amp;quot;number of cards&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  array(&lt;br /&gt;
    &#039;deck&#039; =&amp;gt; 12,&lt;br /&gt;
    &#039;hand&#039; =&amp;gt; 21,&lt;br /&gt;
    &#039;discard&#039; =&amp;gt; 54,&lt;br /&gt;
    &#039;ontable&#039; =&amp;gt; 3&lt;br /&gt;
  );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardsByLocationArgs( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in each &amp;quot;location_arg&amp;quot; for the given location.&lt;br /&gt;
&lt;br /&gt;
The method returns an associative array with the format &amp;quot;location_arg&amp;quot; =&amp;gt; &amp;quot;number of cards&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Example: count the number of cards in each player&#039;s hand:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    countCardsByLocationArgs( &#039;hand&#039; );&lt;br /&gt;
    &lt;br /&gt;
    // Result:&lt;br /&gt;
    array(&lt;br /&gt;
        122345 =&amp;gt; 5,    // player 122345 has 5 cards in hand&lt;br /&gt;
        123456 =&amp;gt; 4     // and player 123456 has 4 cards in hand&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPlayerHand( $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards in given player hand.&lt;br /&gt;
&lt;br /&gt;
Note: This is an alias for:&lt;br /&gt;
getCardsInLocation( &amp;quot;hand&amp;quot;, $player_id )&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardOnTop( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the card on top of the given (&amp;quot;pile&amp;quot; style) location, or null if the location is empty.&lt;br /&gt;
&lt;br /&gt;
Note that the card pile won&#039;t be &amp;quot;auto-reshuffled&amp;quot; if there is no more card available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOnTop( $nbr, $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the &amp;quot;$nbr&amp;quot; cards on top of the given (&amp;quot;pile&amp;quot; style) location.&lt;br /&gt;
&lt;br /&gt;
The method return an array with at most &amp;quot;$nbr&amp;quot; elements (or a void array if there is no card in this location).&lt;br /&gt;
&lt;br /&gt;
Note that the card pile won&#039;t be &amp;quot;auto-reshuffled&amp;quot; if there is not enough cards available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getExtremePosition( $bGetMax ,$location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(rarely used)&lt;br /&gt;
&lt;br /&gt;
Get the position of cards at the top of the given location / at the bottom of the given location.&lt;br /&gt;
&lt;br /&gt;
Of course this method works only on location in &amp;quot;pile&amp;quot; where you are using &amp;quot;location_arg&amp;quot; to specify the position of each card (example: &amp;quot;deck&amp;quot; location).&lt;br /&gt;
&lt;br /&gt;
If bGetMax=true, return the location of the top card of the pile.&lt;br /&gt;
&lt;br /&gt;
If bGetMax=false, return the location of the bottom card of the pile.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOfType( $type, $type_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards of a specific type (rarely used).&lt;br /&gt;
&lt;br /&gt;
Return an array of cards, or an empty array if there is no cards of the specified type.&lt;br /&gt;
&lt;br /&gt;
* type: the type of cards&lt;br /&gt;
* type_arg: if specified, return only cards with the specified &amp;quot;type_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOfTypeInLocation( $type, $type_arg=null, $location, $location_arg = null )&lt;br /&gt;
&lt;br /&gt;
Get all cards of a specific type in a specific location (rarely used).&lt;br /&gt;
&lt;br /&gt;
Return an array of cards, or an empty array if there is no cards of the specified type.&lt;br /&gt;
&lt;br /&gt;
* type: the type of cards&lt;br /&gt;
* type_arg: if specified, return only cards with the specified &amp;quot;type_arg&amp;quot;.&lt;br /&gt;
* location (string): the location where to get the cards.&lt;br /&gt;
* location_arg (optional): if specified, return only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Shuffling ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;shuffle( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Shuffle all cards in specific location.&lt;br /&gt;
&lt;br /&gt;
Shuffle only works on locations where cards are on a &amp;quot;pile&amp;quot; (ex: &amp;quot;deck&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Please note that all &amp;quot;location_arg&amp;quot; will be reset to reflect the new order of the cards in the pile.&lt;br /&gt;
&lt;br /&gt;
=== Auto-reshuffle ===&lt;br /&gt;
&lt;br /&gt;
To enable auto-reshuffle you must do &amp;quot;$this-&amp;gt;cards-&amp;gt;autoreshuffle = true&amp;quot; during the setup of the component.&lt;br /&gt;
&lt;br /&gt;
Every time a card must be retrieved from the &amp;quot;deck&amp;quot; location, if it is empty the &amp;quot;discard&amp;quot; location will be automatically reshuffled into the &amp;quot;deck&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
If you need to notify players when the deck is shuffled, you can setup a callback method using this feature: $this-&amp;gt;cards-&amp;gt;autoreshuffle_trigger = array(&#039;obj&#039; =&amp;gt; $this, &#039;method&#039; =&amp;gt; &#039;deckAutoReshuffle&#039;);&lt;br /&gt;
&lt;br /&gt;
If you need to use other locations than &amp;quot;deck&amp;quot; and &amp;quot;discard&amp;quot; for auto-reshuffle feature, you can configure it this way: $this-&amp;gt;cards-&amp;gt;autoreshuffle_custom = array(&#039;deck&#039; =&amp;gt; &#039;discard&#039;); (replace &#039;deck&#039; and &#039;discard&#039; with your custom locations).&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Deck&amp;diff=4824</id>
		<title>Deck</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Deck&amp;diff=4824"/>
		<updated>2020-06-30T12:52:21Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* auto-reshuffle */ Capitalize header&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Deck&amp;quot; is one of the most useful component on the PHP side. With &amp;quot;Deck&amp;quot;, you can manage the cards in your game on the server side.&lt;br /&gt;
&lt;br /&gt;
Using &amp;quot;deck&amp;quot;, you will be able to use the following features without writing a single SQL database request:&lt;br /&gt;
* Place cards in a pile, shuffle cards, draw cards one by one or many at a time.&lt;br /&gt;
* &amp;quot;Auto-reshuffle&amp;quot; the discard pile into the deck when the deck is empty.&lt;br /&gt;
* Move cards between different locations: hands of players, the table, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using Deck: Hearts example ==&lt;br /&gt;
&lt;br /&gt;
The Deck component is extensively used in the sample &#039;&#039;Hearts&#039;&#039; card game. You will find in &amp;quot;hearts.game.php&amp;quot; that the object &amp;quot;$this-&amp;gt;cards&amp;quot; is used many times.&lt;br /&gt;
&lt;br /&gt;
== Deck overview ==&lt;br /&gt;
&lt;br /&gt;
With Deck component, you manage all cards of your game.&lt;br /&gt;
&lt;br /&gt;
=== The 5 properties of each card ===&lt;br /&gt;
&lt;br /&gt;
Using the Deck component, each card will have 5 properties:&lt;br /&gt;
* &#039;&#039;&#039;id&#039;&#039;&#039;: This is the unique ID of each card.&lt;br /&gt;
* &#039;&#039;&#039;type&#039;&#039;&#039; and &#039;&#039;&#039;type_arg&#039;&#039;&#039;: These two values define the type of your card (i.e., what sort of card is this?).&lt;br /&gt;
* &#039;&#039;&#039;location&#039;&#039;&#039; and &#039;&#039;&#039;location_arg&#039;&#039;&#039;: These two values define where the card is at now.&lt;br /&gt;
&lt;br /&gt;
The id, type, and type_arg properties are constants throughout the game. location and location_arg change when your cards move from one place to another in the game area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;id&#039;&#039;&#039; is the unique ID of each card. Two cards cannot have the same ID. IDs are generated automatically by the Deck component when you create cards during the Setup phase of your game.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type&#039;&#039;&#039; and &#039;&#039;&#039;type_arg&#039;&#039;&#039; defines the type of your card.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;type&#039;&#039;&#039; is a short string, and &#039;&#039;&#039;type_arg&#039;&#039;&#039; is an integer.&lt;br /&gt;
&lt;br /&gt;
You can use these two values as you like to make sure you will be able to identify the different cards in the game. See usage of &amp;quot;type&amp;quot; and &amp;quot;type_arg&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
Examples of usage of &amp;quot;type&amp;quot; and &amp;quot;type_arg&amp;quot;:&lt;br /&gt;
* In &#039;&#039;Hearts&#039;&#039;, &amp;quot;type&amp;quot; represents the color (suite) of the card (1 to 4) and &amp;quot;type_arg&amp;quot; is the value of the card (1, 2, ... 10, J, Q, K).&lt;br /&gt;
* In &#039;&#039;Seasons&#039;&#039;, &amp;quot;type&amp;quot; represents the type of the card (e.g., 1 is Amulet of Air, 2 is Amulet of Fire, etc...). type_arg is not used.&lt;br /&gt;
* In &#039;&#039;Takenoko&#039;&#039;, a Deck component is used for objective cards. &amp;quot;type&amp;quot; is the kind of objective (irrigation/panda/plot) and &amp;quot;type_arg&amp;quot; is the ID of the specific objective to realize (e.g., &amp;quot;green bamboo x4&amp;quot;). Note that a second Deck component is used in &#039;&#039;Takenoko&#039;&#039; to manage the &amp;quot;garden plot&amp;quot; pile.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;location&#039;&#039;&#039; and &#039;&#039;&#039;location_arg&#039;&#039;&#039; define where a card is at now. &#039;&#039;&#039;location&#039;&#039;&#039; is a short string, and &#039;&#039;&#039;location_arg&#039;&#039;&#039; is an integer.&lt;br /&gt;
&lt;br /&gt;
You can use &#039;location&#039; and &#039;location_arg&#039; as you like, to move your card within the game area.&lt;br /&gt;
&lt;br /&gt;
There are 3 special &#039;location&#039; values that Deck manages automatically. You can choose to use these locations or not, depending on your needs:&lt;br /&gt;
* &#039;deck&#039;: the &#039;deck&#039; location is a standard draw deck. Cards are placed face down in a stack and are drawn in sequential order during the game. &#039;location_arg&#039; is used to specify where the card is located within the stack (the card with the highest location_arg value is the next to be drawn).&lt;br /&gt;
* &#039;hand&#039;: the &#039;hand&#039; location represents cards in a player&#039;s hand. &#039;location_arg&#039; is set to the ID of each player.&lt;br /&gt;
* &#039;discard&#039;: the &#039;discard&#039; location is used for discard piles. Card in &#039;discard&#039; may be reshuffled into the deck if needed (see &amp;quot;autoreshuffle&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tips: using the Deck component, you will use generic properties (&amp;quot;location&amp;quot;, &amp;quot;type_arg&amp;quot;,...) for specific purposes in your game. Thus, during the design step before realizing your game, take a few minutes to write down the exact meaning of each of these generic properties in the context of your game.&lt;br /&gt;
&lt;br /&gt;
=== Create a new Deck component ===&lt;br /&gt;
&lt;br /&gt;
For each Deck component in your game, you need to create a dedicated table in the SQL database. This table has a standard format. In practice, if you just want to have a Deck component named &amp;quot;card&amp;quot;, you can copy/paste the following into your &amp;quot;dbmodel.sql&amp;quot; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TABLE IF NOT EXISTS `card` (&lt;br /&gt;
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&lt;br /&gt;
  `card_type` varchar(16) NOT NULL,&lt;br /&gt;
  `card_type_arg` int(11) NOT NULL,&lt;br /&gt;
  `card_location` varchar(16) NOT NULL,&lt;br /&gt;
  `card_location_arg` int(11) NOT NULL,&lt;br /&gt;
  PRIMARY KEY (`card_id`)&lt;br /&gt;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: the database schema of this table does not have to be exactly what is listed above. You can increase the size of the fields or add more fields. For additional fields&lt;br /&gt;
you just have to do manual queries.&lt;br /&gt;
&lt;br /&gt;
Once you have done this (and restarted your game), you can declare the Deck component in your PHP code in your class constructor. For &#039;&#039;Hearts&#039;&#039; for example, I added to the &amp;quot;Hearts()&amp;quot; method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $this-&amp;gt;cards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;init( &amp;quot;card&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that we specify &amp;quot;card&amp;quot; here: the name of our previously created table. This means you can create several &amp;quot;Deck&amp;quot; components with multiple tables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $this-&amp;gt;firstKindCards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;firstKindCards -&amp;gt;init( &amp;quot;first_kind_card&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;secondKindCards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;secondKindCards -&amp;gt;init( &amp;quot;second_kind_card&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the time this is not useful; a Deck component should manage all objects of the same kind (i.e., all cards in the game).&lt;br /&gt;
&lt;br /&gt;
Afterwards, we can initialize your &amp;quot;Deck&amp;quot; by creating all the cards of the game. Generally, this is done only once during the game, in the &amp;quot;setupNewGame&amp;quot; method.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Deck&amp;quot; component provides a fast way to initialize all your cards at once: createCards. Here is how it is used for &amp;quot;Hearts&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        // Create cards&lt;br /&gt;
        $cards = array();&lt;br /&gt;
        foreach( $this-&amp;gt;colors as  $color_id =&amp;gt; $color ) // spade, heart, diamond, club&lt;br /&gt;
        {&lt;br /&gt;
            for( $value=2; $value&amp;lt;=14; $value++ )   //  2, 3, 4, ... K, A&lt;br /&gt;
            {&lt;br /&gt;
                $cards[] = array( &#039;type&#039; =&amp;gt; $color_id, &#039;type_arg&#039; =&amp;gt; $value, &#039;nbr&#039; =&amp;gt; 1);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;createCards( $cards, &#039;deck&#039; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, &amp;quot;createCards&amp;quot; takes a description of all cards of the game. For each type of card, you have to specify its &amp;quot;type&amp;quot;, &amp;quot;type_arg&amp;quot; and the number of card to create. &amp;quot;createCards&amp;quot; create all cards and place them into the &amp;quot;deck&amp;quot; location (as specified in the second argument).&lt;br /&gt;
&lt;br /&gt;
Now, you are ready to use &amp;quot;Deck&amp;quot;!&lt;br /&gt;
&lt;br /&gt;
=== Simple examples using Deck ===&lt;br /&gt;
&lt;br /&gt;
(Most examples are from &amp;quot;Hearts&amp;quot; game)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // In &amp;quot;getAllDatas&#039;, we need to send to the current player all the cards he has in hand:&lt;br /&gt;
     $result[&#039;hand&#039;] = $this-&amp;gt;cards-&amp;gt;getCardsInLocation( &#039;hand&#039;, $player_id );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // At some time we want to check if all the cards (52) are in player&#039;s hands:&lt;br /&gt;
     if( $this-&amp;gt;cards-&amp;gt;countCardInLocation( &#039;hand&#039; ) == 52 )&lt;br /&gt;
           // do something&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // When a player plays a card in front of him on the table:&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;moveCard( $card_id, &#039;cardsontable&#039;, $player_id );&lt;br /&gt;
&lt;br /&gt;
     // Note the use of the custom location &#039;cardsontable&#039; here to keep track of cards on the table.&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;
     // This is a new hand: let&#039;s gather all cards from everywhere in the deck:&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;moveAllCardsInLocation( null, &amp;quot;deck&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
     // And then shuffle the deck&lt;br /&gt;
     $this-&amp;gt;cards-&amp;gt;shuffle( &#039;deck&#039; );&lt;br /&gt;
&lt;br /&gt;
     // And then deal 13 cards to each player&lt;br /&gt;
     // Deal 13 cards to each players&lt;br /&gt;
     // Create deck, shuffle it and give 13 initial cards&lt;br /&gt;
     $players = self::loadPlayersBasicInfos();&lt;br /&gt;
     foreach( $players as $player_id =&amp;gt; $player )&lt;br /&gt;
     {&lt;br /&gt;
        $cards = $this-&amp;gt;cards-&amp;gt;pickCards( 13, &#039;deck&#039;, $player_id );&lt;br /&gt;
           &lt;br /&gt;
        // Notify player about his cards&lt;br /&gt;
        self::notifyPlayer( $player_id, &#039;newHand&#039;, &#039;&#039;, array( &lt;br /&gt;
            &#039;cards&#039; =&amp;gt; $cards&lt;br /&gt;
         ) );&lt;br /&gt;
     }  &lt;br /&gt;
&lt;br /&gt;
     // Note the use of &amp;quot;notifyPlayer&amp;quot; instead of &amp;quot;notifyAllPlayers&amp;quot;: new cards is a private information ;)  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deck component reference ==&lt;br /&gt;
&lt;br /&gt;
=== Initializing Deck component ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;init( $table_name )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Initialize the Deck component.&lt;br /&gt;
&lt;br /&gt;
Argument:&lt;br /&gt;
* table_name: name of the DB table used by this Deck component.&lt;br /&gt;
&lt;br /&gt;
Must be called before any other Deck method.&lt;br /&gt;
&lt;br /&gt;
Usually, init is called in your game constructor.&lt;br /&gt;
&lt;br /&gt;
Example with Hearts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	function Hearts( )&lt;br /&gt;
	{&lt;br /&gt;
        (...)&lt;br /&gt;
        &lt;br /&gt;
        $this-&amp;gt;cards = self::getNew( &amp;quot;module.common.deck&amp;quot; );&lt;br /&gt;
        $this-&amp;gt;cards-&amp;gt;init( &amp;quot;card&amp;quot; );&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;createCards( $cards, $location=&#039;deck&#039;, $location_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Create card items in your deck component. Usually, all card items are created once, during the setup phase of the game.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;cards&amp;quot; describe all cards that need to be created. &amp;quot;cards&amp;quot; is an array with the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   // Create 1 card of type &amp;quot;1&amp;quot; with type_arg=99,&lt;br /&gt;
   //  and 4 cards of type &amp;quot;2&amp;quot; with type_arg=12,&lt;br /&gt;
   //  and 2 cards of type &amp;quot;3&amp;quot; with type_arg=33&lt;br /&gt;
&lt;br /&gt;
   $cards = array(&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 1, &#039;type_arg&#039; =&amp;gt; 99, &#039;nbr&#039; =&amp;gt; 1 ),&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 2, &#039;type_arg&#039; =&amp;gt; 12, &#039;nbr&#039; =&amp;gt; 4 ),&lt;br /&gt;
        array( &#039;type&#039; =&amp;gt; 3, &#039;type_arg&#039; =&amp;gt; 33, &#039;nbr&#039; =&amp;gt; 2 )&lt;br /&gt;
        ...&lt;br /&gt;
   );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: During the &amp;quot;createCards&amp;quot; process, Deck generates unique IDs for all card items.&lt;br /&gt;
&lt;br /&gt;
Note: createCards is optimized to create a lot of cards at once. Do not use it to create cards one by one.&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;location&amp;quot; and &amp;quot;location_arg&amp;quot; arguments are not set, newly created cards are placed in the &amp;quot;deck&amp;quot; location. If &amp;quot;location&amp;quot; (and optionally location_arg) is specified, cards are created for this specific location.&lt;br /&gt;
&lt;br /&gt;
=== Card standard format ===&lt;br /&gt;
&lt;br /&gt;
When Deck component methods are returning one or several cards, the following format is used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&lt;br /&gt;
   &#039;id&#039; =&amp;gt; ..,          // the card ID&lt;br /&gt;
   &#039;type&#039; =&amp;gt; ..,        // the card type&lt;br /&gt;
   &#039;type_arg&#039; =&amp;gt; ..,    // the card type argument&lt;br /&gt;
   &#039;location&#039; =&amp;gt; ..,    // the card location&lt;br /&gt;
   &#039;location_arg&#039; =&amp;gt; .. // the card location argument&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Picking cards ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCard( $location, $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pick a card from a &amp;quot;pile&amp;quot; location (ex: &amp;quot;deck&amp;quot;) and place it in the &amp;quot;hand&amp;quot; of specified player.&lt;br /&gt;
&lt;br /&gt;
Return the card picked or &amp;quot;null&amp;quot; if there are no more card in given location.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCards( $nbr, $location, $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pick &amp;quot;$nbr&amp;quot; cards from a &amp;quot;pile&amp;quot; location (ex: &amp;quot;deck&amp;quot;) and place them in the &amp;quot;hand&amp;quot; of specified player.&lt;br /&gt;
&lt;br /&gt;
Return an array with the cards picked (indexed by the card ID), or &amp;quot;null&amp;quot; if there are no more card in given location.&lt;br /&gt;
&lt;br /&gt;
Note that the number of cards picked can be less than &amp;quot;$nbr&amp;quot; in case there are not enough cards in the pile location.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below). In case there are not enough cards in the pile, all remaining cards are picked first, then the auto-reshuffle is triggered, then the other cards are picked.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCardForLocation( $from_location, $to_location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method is similar to &#039;pickCard&#039;, except that you can pick a card for any sort of location and not only the &amp;quot;hand&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
* from_location is the &amp;quot;pile&amp;quot; style location from where you are picking a card.&lt;br /&gt;
* to_location is the location where you will place the card picked.&lt;br /&gt;
* if &amp;quot;location_arg&amp;quot; is specified, the card picked will be set with this &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pickCardsForLocation( $nbr, $from_location, $to_location, $location_arg=0, $no_deck_reform=false )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This method is similar to &#039;pickCards&#039;, except that you can pick cards for any sort of location and not only the &amp;quot;hand&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
* from_location is the &amp;quot;pile&amp;quot; style location from where you are picking some cards.&lt;br /&gt;
* to_location is the location where you will place the cards picked.&lt;br /&gt;
* if &amp;quot;location_arg&amp;quot; is specified, the cards picked will be set with this &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
* if &amp;quot;no_deck_reform&amp;quot; is set to &amp;quot;true&amp;quot;, the auto-reshuffle feature is disabled during this method call.&lt;br /&gt;
&lt;br /&gt;
This method supports auto-reshuffle (see &amp;quot;auto-reshuffle&amp;quot; below).&lt;br /&gt;
&lt;br /&gt;
=== Moving cards ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveCard( $card_id, $location, $location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the specific card to given location.&lt;br /&gt;
&lt;br /&gt;
* card_id: ID of the card to move.&lt;br /&gt;
* location: location where to move the card.&lt;br /&gt;
* location_arg: if specified, location_arg where to move the card. If not specified &amp;quot;location_arg&amp;quot; will be set to 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveCards( $cards, $location, $location_arg )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the specific cards to given location.&lt;br /&gt;
&lt;br /&gt;
* cards: an array of IDs of cards to move.&lt;br /&gt;
* location: location where to move the cards.&lt;br /&gt;
* location_arg: if specified, location_arg where to move the cards. If not specified &amp;quot;location_arg&amp;quot; will be set to 0.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;insertCard( $card_id, $location, $location_arg )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move a card to a specific &amp;quot;pile&amp;quot; location where card are ordered.&lt;br /&gt;
&lt;br /&gt;
If location_arg place is already taken, increment all cards after location_arg in order to insert new card at this precise location.&lt;br /&gt;
&lt;br /&gt;
(note: insertCardOnExtremePosition method below is more useful in most of the case)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;insertCardOnExtremePosition( $card_id, $location, $bOnTop )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move a card on top or at bottom of given &amp;quot;pile&amp;quot; type location.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveAllCardsInLocation(  $from_location, $to_location, $from_location_arg=null, $to_location_arg=0 )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move all cards in specified &amp;quot;from&amp;quot; location to given location.&lt;br /&gt;
&lt;br /&gt;
* from_location: where to take the cards&lt;br /&gt;
* to_location: where to put the cards&lt;br /&gt;
* from_location (optional): if specified, only cards with given &amp;quot;location_arg&amp;quot; are moved.&lt;br /&gt;
* to_location (optional): if specified, cards moved &amp;quot;location_arg&amp;quot; is set to given value. Otherwise location_arg is set to zero.&lt;br /&gt;
&lt;br /&gt;
Note: if you want to keep &amp;quot;location_arg&amp;quot; untouched, you should use &amp;quot;moveAllCardsInLocationKeepOrder&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;moveAllCardsInLocationKeepOrder( $from_location, $to_location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move all cards in specified &amp;quot;from&amp;quot; location to given &amp;quot;to&amp;quot; location. This method does not modify the &amp;quot;location_arg&amp;quot; of cards.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;playCard( $card_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move specified card at the top of the &amp;quot;discard&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
Note: this is an alias for: insertCardOnExtremePosition( $card_id, &amp;quot;discard&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
=== Get cards informations ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCard( $card_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get specific card information.&lt;br /&gt;
&lt;br /&gt;
Return null if this card is not found.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCards( $cards_array )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get specific cards information.&lt;br /&gt;
&lt;br /&gt;
cards_array is an array of cards ID.&lt;br /&gt;
&lt;br /&gt;
If some cards are not found or if some cards IDs are specified multiple times, the method throws an (unexpected) Exception.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsInLocation( $location, $location_arg = null, $order_by = null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards in specific location, as an array. Return an empty array if the location is empty.&lt;br /&gt;
&lt;br /&gt;
* location (string): the location where to get the cards.&lt;br /&gt;
* location_arg (optional): if specified, return only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
* order_by (optional): if specified, returned cards are ordered by the given database field. Example: &amp;quot;card_id&amp;quot; or &amp;quot;card_type&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardInLocation( $location, $location_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in specified location.&lt;br /&gt;
&lt;br /&gt;
* location (string): the location where to count the cards.&lt;br /&gt;
* location_arg (optional): if specified, count only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardsInLocations()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in each location of the game.&lt;br /&gt;
&lt;br /&gt;
The method returns an associative array with the format &amp;quot;location&amp;quot; =&amp;gt; &amp;quot;number of cards&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  array(&lt;br /&gt;
    &#039;deck&#039; =&amp;gt; 12,&lt;br /&gt;
    &#039;hand&#039; =&amp;gt; 21,&lt;br /&gt;
    &#039;discard&#039; =&amp;gt; 54,&lt;br /&gt;
    &#039;ontable&#039; =&amp;gt; 3&lt;br /&gt;
  );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;countCardsByLocationArgs( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Return the number of cards in each &amp;quot;location_arg&amp;quot; for the given location.&lt;br /&gt;
&lt;br /&gt;
The method returns an associative array with the format &amp;quot;location_arg&amp;quot; =&amp;gt; &amp;quot;number of cards&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Example: count the number of cards in each player&#039;s hand:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    countCardsByLocationArgs( &#039;hand&#039; );&lt;br /&gt;
    &lt;br /&gt;
    // Result:&lt;br /&gt;
    array(&lt;br /&gt;
        122345 =&amp;gt; 5,    // player 122345 has 5 cards in hand&lt;br /&gt;
        123456 =&amp;gt; 4     // and player 123456 has 4 cards in hand&lt;br /&gt;
    );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getPlayerHand( $player_id )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards in given player hand.&lt;br /&gt;
&lt;br /&gt;
Note: This is an alias for:&lt;br /&gt;
getCardsInLocation( &amp;quot;hand&amp;quot;, $player_id )&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardOnTop( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the card on top of the given (&amp;quot;pile&amp;quot; style) location, or null if the location is empty.&lt;br /&gt;
&lt;br /&gt;
Note that the card pile won&#039;t be &amp;quot;auto-reshuffled&amp;quot; if there is no more card available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOnTop( $nbr, $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get the &amp;quot;$nbr&amp;quot; cards on top of the given (&amp;quot;pile&amp;quot; style) location.&lt;br /&gt;
&lt;br /&gt;
The method return an array with at most &amp;quot;$nbr&amp;quot; elements (or a void array if there is no card in this location).&lt;br /&gt;
&lt;br /&gt;
Note that the card pile won&#039;t be &amp;quot;auto-reshuffled&amp;quot; if there is not enough cards available.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getExtremePosition( $bGetMax ,$location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(rarely used)&lt;br /&gt;
&lt;br /&gt;
Get the position of cards at the top of the given location / at the bottom of the given location.&lt;br /&gt;
&lt;br /&gt;
Of course this method works only on location in &amp;quot;pile&amp;quot; where you are using &amp;quot;location_arg&amp;quot; to specify the position of each card (example: &amp;quot;deck&amp;quot; location).&lt;br /&gt;
&lt;br /&gt;
If bGetMax=true, return the location of the top card of the pile.&lt;br /&gt;
&lt;br /&gt;
If bGetMax=false, return the location of the bottom card of the pile.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOfType( $type, $type_arg=null )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Get all cards of a specific type (rarely used).&lt;br /&gt;
&lt;br /&gt;
Return an array of cards, or an empty array if there is no cards of the specified type.&lt;br /&gt;
&lt;br /&gt;
* type: the type of cards&lt;br /&gt;
* type_arg: if specified, return only cards with the specified &amp;quot;type_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;getCardsOfTypeInLocation( $type, $type_arg=null, $location, $location_arg = null )&lt;br /&gt;
&lt;br /&gt;
Get all cards of a specific type in a specific location (rarely used).&lt;br /&gt;
&lt;br /&gt;
Return an array of cards, or an empty array if there is no cards of the specified type.&lt;br /&gt;
&lt;br /&gt;
* type: the type of cards&lt;br /&gt;
* type_arg: if specified, return only cards with the specified &amp;quot;type_arg&amp;quot;.&lt;br /&gt;
* location (string): the location where to get the cards.&lt;br /&gt;
* location_arg (optional): if specified, return only cards with the specified &amp;quot;location_arg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Shuffling ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;shuffle( $location )&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Shuffle all cards in specific location.&lt;br /&gt;
&lt;br /&gt;
Shuffle only works on locations where cards are on a &amp;quot;pile&amp;quot; (ex: &amp;quot;deck&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Please note that all &amp;quot;location_arg&amp;quot; will be reset to reflect the new order of the cards in the pile.&lt;br /&gt;
&lt;br /&gt;
=== Auto-reshuffle ===&lt;br /&gt;
&lt;br /&gt;
To enable auto-reshuffle you must do &amp;quot;$this-&amp;gt;cards-&amp;gt;autoreshuffle = true&amp;quot; during the setup of the component.&lt;br /&gt;
&lt;br /&gt;
Every time a card must be retrieved from the &amp;quot;deck&amp;quot; location, if it is empty the &amp;quot;discard&amp;quot; location will be automatically reshuffled into the &amp;quot;deck&amp;quot; location.&lt;br /&gt;
&lt;br /&gt;
If you need to notify players when the deck is shuffled, you can setup a callback method using this feature: $this-&amp;gt;cards-&amp;gt;autoreshuffle_trigger = array(&#039;obj&#039; =&amp;gt; $this, &#039;method&#039; =&amp;gt; &#039;deckAutoReshuffle&#039;);&lt;br /&gt;
&lt;br /&gt;
If you need to use other locations than &amp;quot;deck&amp;quot; and &amp;quot;discard&amp;quot; for auto-reshuffle feature, you can configure it this way: $this-&amp;gt;cards-&amp;gt;autoreshuffle_custom = array(&#039;deck&#039; =&amp;gt; &#039;discard&#039;); (replace &#039;deck&#039; and &#039;discard&#039; with your custom locations).&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4783</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4783"/>
		<updated>2020-06-24T15:58:41Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Option &amp;quot;Trumps&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoid taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
== Options availables ==&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;geronimo&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
When playing with this option, each player at his/her turn will choose the hand he/she wants to play. Yet, during the game, all the players will have to play all the hands.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Double&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
After declarer picks a game but before the first trick is led, each of the other players may wager double against one or more of the other players. This operates like a side bet on the relative game score between the two players, who are said to have &amp;quot;business&amp;quot; with each other. The rules for doubling are:&lt;br /&gt;
&lt;br /&gt;
* Each player gets one opportunity to double&lt;br /&gt;
* A player can choose to double only some players (declarer or non-declarer) or pass&lt;br /&gt;
* At a positive game, non-dealers may only double the dealer (who may redouble)&lt;br /&gt;
* Each non-declarer must double against declarer &#039;&#039;&#039;at least twice&#039;&#039;&#039; during the game for each declarer.&lt;br /&gt;
* Any player receiving a wager of double may redouble; &amp;quot;maximum&amp;quot; implies redoubling all received wagers as well as doubling the remaining players&lt;br /&gt;
* Declarer can not double, but may redouble as above. A &amp;quot;maximum&amp;quot; from the dealer therefore redoubles received wagers only&lt;br /&gt;
&lt;br /&gt;
After the hand is played out and scores are tallied, modifications are made for doubles as follows:&lt;br /&gt;
&lt;br /&gt;
* Between each pair of players who doubled, the difference in their scores is calculated. Player with the higher score for that round is awarded the amount of the difference and player with the lower score had the same amount subtracted from his or her score.&lt;br /&gt;
* Redoubled wagers are figured the same way, with the difference in scores doubled before awards and penalties are tallied.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Play an extra hand, the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Anti-Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Similar to the &amp;quot;Salade&amp;quot;, the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Last two&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
In this hand, try to avoid taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Trumps&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The declareer choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
Some rules apply when you play with trumps:&lt;br /&gt;
&lt;br /&gt;
* If a trump is led, each player must, if able, play a higher trump than those played before. Otherwise players follow suit, or discard if they are void in trumps.&lt;br /&gt;
* If a plain suit is led, players follow suit if possible.&lt;br /&gt;
* If they cannot and no trump has been played, they must play a trump card if possible or otherwise play a card of one of the other suits.&lt;br /&gt;
* If a non-trump has been led and trumped, a player must, if possible, play a higher trump than those previously played. Otherwise the player may slough off any card.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Domino&amp;quot; (Klondike) ===&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4780</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4780"/>
		<updated>2020-06-24T15:51:16Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Playing the game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoid taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
== Options availables ==&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;geronimo&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
When playing with this option, each player at his/her turn will choose the hand he/she wants to play. Yet, during the game, all the players will have to play all the hands.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Double&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
After declarer picks a game but before the first trick is led, each of the other players may wager double against one or more of the other players. This operates like a side bet on the relative game score between the two players, who are said to have &amp;quot;business&amp;quot; with each other. The rules for doubling are:&lt;br /&gt;
&lt;br /&gt;
* Each player gets one opportunity to double&lt;br /&gt;
* A player can choose to double only some players (declarer or non-declarer) or pass&lt;br /&gt;
* At a positive game, non-dealers may only double the dealer (who may redouble)&lt;br /&gt;
* Each non-declarer must double against declarer &#039;&#039;&#039;at least twice&#039;&#039;&#039; during the game for each declarer.&lt;br /&gt;
* Any player receiving a wager of double may redouble; &amp;quot;maximum&amp;quot; implies redoubling all received wagers as well as doubling the remaining players&lt;br /&gt;
* Declarer can not double, but may redouble as above. A &amp;quot;maximum&amp;quot; from the dealer therefore redoubles received wagers only&lt;br /&gt;
&lt;br /&gt;
After the hand is played out and scores are tallied, modifications are made for doubles as follows:&lt;br /&gt;
&lt;br /&gt;
* Between each pair of players who doubled, the difference in their scores is calculated. Player with the higher score for that round is awarded the amount of the difference and player with the lower score had the same amount subtracted from his or her score.&lt;br /&gt;
* Redoubled wagers are figured the same way, with the difference in scores doubled before awards and penalties are tallied.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Play an extra hand, the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Anti-Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Similar to the &amp;quot;Salade&amp;quot;, the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Last two&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
In this hand, try to avoid taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Trumps&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The taker choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Domino&amp;quot; (Klondike) ===&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4779</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4779"/>
		<updated>2020-06-24T15:51:05Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: Add doubling and reformat options&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoid taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Options availables ==&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;geronimo&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
When playing with this option, each player at his/her turn will choose the hand he/she wants to play. Yet, during the game, all the players will have to play all the hands.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Double&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
After declarer picks a game but before the first trick is led, each of the other players may wager double against one or more of the other players. This operates like a side bet on the relative game score between the two players, who are said to have &amp;quot;business&amp;quot; with each other. The rules for doubling are:&lt;br /&gt;
&lt;br /&gt;
* Each player gets one opportunity to double&lt;br /&gt;
* A player can choose to double only some players (declarer or non-declarer) or pass&lt;br /&gt;
* At a positive game, non-dealers may only double the dealer (who may redouble)&lt;br /&gt;
* Each non-declarer must double against declarer &#039;&#039;&#039;at least twice&#039;&#039;&#039; during the game for each declarer.&lt;br /&gt;
* Any player receiving a wager of double may redouble; &amp;quot;maximum&amp;quot; implies redoubling all received wagers as well as doubling the remaining players&lt;br /&gt;
* Declarer can not double, but may redouble as above. A &amp;quot;maximum&amp;quot; from the dealer therefore redoubles received wagers only&lt;br /&gt;
&lt;br /&gt;
After the hand is played out and scores are tallied, modifications are made for doubles as follows:&lt;br /&gt;
&lt;br /&gt;
* Between each pair of players who doubled, the difference in their scores is calculated. Player with the higher score for that round is awarded the amount of the difference and player with the lower score had the same amount subtracted from his or her score.&lt;br /&gt;
* Redoubled wagers are figured the same way, with the difference in scores doubled before awards and penalties are tallied.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Play an extra hand, the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Anti-Salade&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Similar to the &amp;quot;Salade&amp;quot;, the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Last two&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
In this hand, try to avoid taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Trumps&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The taker choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
=== Option &amp;quot;Domino&amp;quot; (Klondike) ===&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Post-release_phase&amp;diff=4738</id>
		<title>Post-release phase</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Post-release_phase&amp;diff=4738"/>
		<updated>2020-06-16T08:51:59Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Changes that breaks the games in progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
Your game is now on BGA: congrats!&lt;br /&gt;
&lt;br /&gt;
But what happened when there are some bugs to fix or when you want to optimize something?&lt;br /&gt;
&lt;br /&gt;
Don&#039;t be afraid: you&#039;re still allowed to modify your game. You just have to pay attention to the points below.&lt;br /&gt;
&lt;br /&gt;
== Bugs reporting ==&lt;br /&gt;
&lt;br /&gt;
Bugs are reported in the [http://forum.boardgamearena.com/viewforum.php?f=4 BGA bugs forum].&lt;br /&gt;
&lt;br /&gt;
During days after your game has been published and from time to time, please have a look at it to check if everything is fine.&lt;br /&gt;
&lt;br /&gt;
== How to submit changes? ==&lt;br /&gt;
&lt;br /&gt;
There is 3 (short) steps to make your changes visible on BGA (from your Control Panel):&lt;br /&gt;
&lt;br /&gt;
* Commit your changes.&lt;br /&gt;
* Build a new version (don&#039;t forget to do a successful commit BEFORE your build).&lt;br /&gt;
* Deploy your new version in production.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What can be modified after release? ==&lt;br /&gt;
&lt;br /&gt;
Everything can be modified. BUT, some items requires a special attention, and you must inform us in some cases:&lt;br /&gt;
&lt;br /&gt;
===Changes that breaks the games in progress===&lt;br /&gt;
&lt;br /&gt;
Some changes will break the games in progress at the moment the release/the hotfix will be performed. Each time you make a change, you should ask you the question &amp;quot;it is safe to make this change in a game in progress&amp;quot;, and if the answer is &amp;quot;no&amp;quot; you have to inform us.&lt;br /&gt;
&lt;br /&gt;
Example of changes that break the games in progress:&lt;br /&gt;
* Changes in the database schema of the game (dbmodel.sql).&lt;br /&gt;
* New global variable or game option accessed during the game (if it&#039;s only used during setup, it should be safe).&lt;br /&gt;
* Delete or change ID of existing game option (especially for Arena tables and turn by turn tables)&lt;br /&gt;
* Change ID of existing game states (adding new game states is fine).&lt;br /&gt;
&lt;br /&gt;
Of course, as a rule of thumb, you should avoid to introduce changes that break a game in progress. Sometimes however, you do not have any other choice. In this case:&lt;br /&gt;
* Try to group all your updates in one version, thus we won&#039;t have to block your game several times.&lt;br /&gt;
* Tell us explicitly that you introduce some update that can break games in progress so we can block the game during a short time.&lt;br /&gt;
&lt;br /&gt;
Note: in the near future, we will introduce the possibility for you to block/unblock a game directly from your Control Panel in order to perform all the process by yourself.&lt;br /&gt;
&lt;br /&gt;
=== Updating Statistics ===&lt;br /&gt;
&lt;br /&gt;
You should be careful when updating a statistics:&lt;br /&gt;
&lt;br /&gt;
* If you want to add a new statistic, please be aware that for ongoing games this statistic won&#039;t always be correct since it has not been counted from the start of that game.&lt;br /&gt;
* If you want to update a statistic, please update it and do not remove/create another one. Otherwise, the statistic won&#039;t keep the same ID and players will lose all the historical statistics data.&lt;br /&gt;
* If your game is published on BGA, please don&#039;t remove any statistics (historical data will be lost).&lt;br /&gt;
&lt;br /&gt;
=== Updating the database schema ===&lt;br /&gt;
&lt;br /&gt;
If you want to update the database schema of the game (dbmodel.sql) and your game is already open to everyone on BGA (from BETA onwards), you should inform us before releasing the new version (see &amp;quot;[[#Changes that breaks the games in progress|changes that breaks the games in progress]]&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Any modification in dbmodel.sql should also appear in your nameofyourgame.game.php, in a function&lt;br /&gt;
&lt;br /&gt;
  function upgradeTableDb( $from_version ){&lt;br /&gt;
  &lt;br /&gt;
  if( $from_version &amp;lt;= YYMMDDHHMM ){ // where your CURRENT version in production has number YYMMDD-HHMM&lt;br /&gt;
  &lt;br /&gt;
            // You DB schema update request.&lt;br /&gt;
            // Note: all tables names should be prefixed by &amp;quot;DBPREFIX_&amp;quot; to be compatible with the applyDbUpgradeToAllDB method you should use below&lt;br /&gt;
            $sql = &amp;quot;CREATE TABLE DBPREFIX_xxxxxxx ....&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
            // The method below is applying your DB schema update request to all tables, including the BGA framework utility tables like &amp;quot;zz_replayXXXX&amp;quot; or &amp;quot;zz_savepointXXXX&amp;quot;.&lt;br /&gt;
            // You should really use this request, in conjunction with &amp;quot;DBPREFIX_&amp;quot; in your $sql, so ALL tables are updated. All utility tables MUST have the same schema than the main table, otherwise the game may be blocked.&lt;br /&gt;
            self::applyDbUpgradeToAllDB( $sql );&lt;br /&gt;
  &lt;br /&gt;
  }}&lt;br /&gt;
&lt;br /&gt;
Note1: of course you need to change your dbmodel.sql accordingly, so that new games get your updated scheme.&lt;br /&gt;
&lt;br /&gt;
Note2: this is always risky to modify the DB scheme, so:&lt;br /&gt;
_ if your game is already open to everyone on BGA (from BETA onwards), it may be worth contacting us before, so we can stop the realtime games during the update (this way, only turn based games are concerned by the DB live upgrade).&lt;br /&gt;
_ if you can avoid it... try to avoid it :)&lt;br /&gt;
&lt;br /&gt;
=== Updating string to be translated  ===&lt;br /&gt;
&lt;br /&gt;
When you update a string that has been marked to be translatable, please keep in mind that all current translations done by the BGA community will be lost.&lt;br /&gt;
&lt;br /&gt;
Consequently, when you are about to modify a string to be translated (after release), please ask you the following questions:&lt;br /&gt;
* Is it just an English misspelling? In this case, it is better to fix the English translation of the string than the original string to be translated.&lt;br /&gt;
* Has the meaning of the string changed? If yes, you HAVE to change the original string in order to invalidate all translations that has been done already.&lt;br /&gt;
* Is there a similar string already used elsewhere in my game? In this case, you&#039;d better use it again to enjoy immediately all translations already available.&lt;br /&gt;
&lt;br /&gt;
===Tell the community about your changes :)===&lt;br /&gt;
&lt;br /&gt;
The player&#039;s community is always happy to know that someone is taking care of their preferred game :)&lt;br /&gt;
&lt;br /&gt;
If your are the developer of game XXXX, you are also the administrator of player&#039;s group &amp;quot;XXXX&#039;s players&amp;quot;, and you can publish some news in this group newsfeed.&lt;br /&gt;
&lt;br /&gt;
When you fix a bug or add something, do not hesitate to tell the players about this in this group: you&#039;ll get the &amp;quot;thank you&amp;quot; you deserved :)&lt;br /&gt;
&lt;br /&gt;
See for example Werewolves group:&lt;br /&gt;
https://boardgamearena.com/group?id=2465913&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Major changes===&lt;br /&gt;
&lt;br /&gt;
If you do some major changes to your game like:&lt;br /&gt;
* Introducing a new expansion.&lt;br /&gt;
* Major code rewriting/refactoring.&lt;br /&gt;
&lt;br /&gt;
... please tell us. In this case, we can:&lt;br /&gt;
* Make your game back from &amp;quot;gold&amp;quot; to &amp;quot;public beta&amp;quot;, to incite player to report bugs.&lt;br /&gt;
* And eventually, publish a news about it :)&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4669</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4669"/>
		<updated>2020-06-08T20:02:29Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoir taking the &#039;&#039;&#039;King of Hearts&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
# avoir taking the &#039;&#039;&#039;last two tricks&#039;&#039;&#039; (counts -4 points for the trick before last and -8 points for the last for a 52-cards deck and -3 points and -5 points for a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
An extra hand (optional), the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of Hearts is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
Another extra hand (optional), the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Option &amp;quot;Trumps&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
Only when playing on geronimo mode, you can choose to play Trumps. The taker choose the trump color and the goal is to take as much tricks as possible (tricks count +3 when playing 52-cards deck and +2 when playing 32-cards deck).&lt;br /&gt;
&lt;br /&gt;
== Option &amp;quot;Domino&amp;quot; (Klondike) ==&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 players&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Tips_barbu&amp;diff=4594</id>
		<title>Tips barbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Tips_barbu&amp;diff=4594"/>
		<updated>2020-06-03T08:50:38Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: Created page with &amp;quot;No Hearts and No Barbu (King of Hearts) are generally best bid on hands with many hearts. A hand with long hearts will be short in the other suits, and will thus get more oppo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;No Hearts and No Barbu (King of Hearts) are generally best bid on hands with many hearts. A hand with long hearts will be short in the other suits, and will thus get more opportunities to discard.&lt;br /&gt;
&lt;br /&gt;
In No King of Hearts, a player who holds the King and is confident of not taking it herself can chose that hand.&lt;br /&gt;
&lt;br /&gt;
The total score for No Tricks is -13 or -8, but this is in effect the smallest contract, as the tricks tend to be spread around. It is therefore a suitable hand to keep to last, as playing it with an unsuitable hand is rarely a total disaster. In playing No Tricks, ingenious sacrifice plays (such as are skillful in ramsch and other negative games) are not appropriate. It is better to keep your head down and avoid each trick as it comes round.&lt;br /&gt;
&lt;br /&gt;
Choose wisefuly the Salade and Anti-Salade because they can be worth a lot, especially the Barbu is worth a lot.&lt;br /&gt;
&lt;br /&gt;
No King of Hearts only scores -12 or -13, but is really a big hand. This is because the penalty all comes in one lump.&lt;br /&gt;
&lt;br /&gt;
In Domino, Aces and Kings are liabilities. A suite of cards, like 3-4-5 can be powerful because you can hold this type (provided you don&#039;t have too high cards like Queen, King or Ace in this type).&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4564</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4564"/>
		<updated>2020-06-02T19:40:34Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* Playing the game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoir taking the &#039;&#039;&#039;King of Heartss&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
An extra hand (optional), the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of heart is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
Another extra hand (optional), the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Option &amp;quot;Domino&amp;quot; (Klondike) ==&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 joueurs&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 joueurs&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4563</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4563"/>
		<updated>2020-06-02T19:40:23Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* 3 or 5 players */ corrected typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoir taking the &#039;&#039;&#039;King of Heartss&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
An extra hand (optional), the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of heart is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
Another extra hand (optional), the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Option &amp;quot;Domino&amp;quot; (Klondike) ==&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 players ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 joueurs&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 joueurs&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4562</id>
		<title>Gamehelpbarbu</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpbarbu&amp;diff=4562"/>
		<updated>2020-06-02T19:40:02Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: Created page with &amp;quot;== Goal ==   Your goal is to loose &amp;#039;&amp;#039;&amp;#039;the least point&amp;#039;&amp;#039;&amp;#039; you can.  == Playing the game ==   The game is made of multiple hands (number of hands depends on the options you play...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Goal == &lt;br /&gt;
&lt;br /&gt;
Your goal is to loose &#039;&#039;&#039;the least point&#039;&#039;&#039; you can.&lt;br /&gt;
&lt;br /&gt;
== Playing the game == &lt;br /&gt;
&lt;br /&gt;
The game is made of multiple hands (number of hands depends on the options you play):&lt;br /&gt;
# avoid making &#039;&#039;&#039;tricks&#039;&#039;&#039; (every trick counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;hearts&#039;&#039;&#039; in tricks (every heart card counts -1 point)&lt;br /&gt;
# avoid taking &#039;&#039;&#039;queens&#039;&#039;&#039; in tricks (each queeen counts -3 points for a 52-cards deck and -2 points when playing with a 32-cards deck)&lt;br /&gt;
# avoir taking the &#039;&#039;&#039;King of Heartss&#039;&#039;&#039; (the &#039;&#039;Barbu&#039;&#039;) in your tricks (Barbu counts -12 point for a 52-cards deck and -8 when playing with a 32-cards deck)&lt;br /&gt;
&lt;br /&gt;
An extra hand (optional), the &#039;&#039;&#039;Salade&#039;&#039;&#039; when everything counts, so avoid making tricks, taking hearts, taking queens or the King of Hearts. All the point counts so Queen of heart is worth -4 points (with 52-cards deck), Barbu is worth -13 points (still 52-cards deck)...&lt;br /&gt;
&lt;br /&gt;
Another extra hand (optional), the &#039;&#039;&#039;Anti-salade&#039;&#039;&#039; counts all the same points (tricks, hearts, queens, Barbu) with &#039;&#039;&#039;positive score&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Option &amp;quot;Domino&amp;quot; (Klondike) ==&lt;br /&gt;
&lt;br /&gt;
You can play an extra hand: the &#039;&#039;&#039;Domino&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
During this hand, players have to play cards in a suite, starting from 2 (or 7 when playing 32-cards deck) to the Ace, for each of the 4 types.&lt;br /&gt;
&lt;br /&gt;
When a player plays an Ace, he/she can play again. If a player can&#039;t play, he/she passes. But you can&#039;t pass if you can play any card (even if you wanted to).&lt;br /&gt;
&lt;br /&gt;
Domino also counts points positively.&lt;br /&gt;
&lt;br /&gt;
If you play with a 52-cards deck, the first player with no card left wins 25 points, the second 15 points, the third 5 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
If you play with a 32-cards deck, the first player with no card left wins 20 points, the second 10 points. The other players score nothing.&lt;br /&gt;
&lt;br /&gt;
== 3 or 5 playerss ==&lt;br /&gt;
&lt;br /&gt;
The game is recommended to play at 4 players but you can play at 3 or 5 players. Some cards are removed from the game so that everyone has the same quantity of cards in hand. Here are the cards removed:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! &#039;&#039;&#039;Number of players&#039;&#039;&#039;&lt;br /&gt;
! 32-cards deck&lt;br /&gt;
! 52-cards deck&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;3 players&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;4 joueurs&#039;&#039;&#039;&lt;br /&gt;
|nothing&lt;br /&gt;
|nothing&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;5 joueurs&#039;&#039;&#039;&lt;br /&gt;
|7 diamonds and 7 clubs&lt;br /&gt;
|2 diamonds and 2 clubs&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Translations&amp;diff=4352</id>
		<title>Translations</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Translations&amp;diff=4352"/>
		<updated>2020-05-10T13:56:39Z</updated>

		<summary type="html">&lt;p&gt;Cpasbanal: /* On server side (PHP) */ minor typo on transate -&amp;gt; translate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using BGA Studio, the game you create is ready to be translated to each language by the BGA community. To make this possible, you only need to specify which string must be translated and how to combine them.&lt;br /&gt;
&lt;br /&gt;
== How translation works? ==&lt;br /&gt;
&lt;br /&gt;
When developing your game, all strings must be in English. Strings must be coherent with the English version of the game.&lt;br /&gt;
&lt;br /&gt;
Before the release of the game, BGA team will do the French translation of the game.&lt;br /&gt;
&lt;br /&gt;
After the release of the game, the BGA players community will translate the game in every language.&lt;br /&gt;
&lt;br /&gt;
== What should be translated? ==&lt;br /&gt;
&lt;br /&gt;
Every text that can be visible by the player when the game is running normally. This includes tooltips, texts on cards, error messages, ...&lt;br /&gt;
&lt;br /&gt;
This does NOT include error messages that are not supposed to happen (unexpected errors).&lt;br /&gt;
&lt;br /&gt;
== What rules should I follow for the original English strings? ==&lt;br /&gt;
&lt;br /&gt;
For a coherent and homogeneous interface, here are some rules about ending a sentence with a final dot &#039;.&#039;&lt;br /&gt;
&lt;br /&gt;
* As a general rule:&lt;br /&gt;
** If a sentence is displayed isolated in the interface =&amp;gt; no final dot&lt;br /&gt;
** If a sentence is followed or could be followed by another sentence in the same interface space =&amp;gt; final dot.&lt;br /&gt;
&lt;br /&gt;
* In detail:&lt;br /&gt;
** No final dot:&lt;br /&gt;
*** button labels&lt;br /&gt;
*** section titles&lt;br /&gt;
*** menu elements&lt;br /&gt;
*** links triggering an isolated action&lt;br /&gt;
*** anything that is not a full sentence&lt;br /&gt;
*** current action in the status bar&lt;br /&gt;
** Final dot:&lt;br /&gt;
*** complete explanation sentence, that can be chained with another sentence&lt;br /&gt;
** We can tolerate a dot or no dot (but it should be consistent inside the game) for:&lt;br /&gt;
*** isolated tooltip / isolated small sentence&lt;br /&gt;
*** game log (no dot is usually preferable)&lt;br /&gt;
*** error messages (except if more than one sentence in the error message =&amp;gt; final dot mandatory in this case)&lt;br /&gt;
&lt;br /&gt;
Otherwise, you should try to follow as closely as possible the general style and format (including capitalization) used in the English rulebook and game material of the game.&lt;br /&gt;
&lt;br /&gt;
== Focus on translating notifications ==&lt;br /&gt;
&lt;br /&gt;
Usually, translating a website is simple: you just call a function on every string you have to translate, and the string is translated in the player&#039;s language. On Board Game Arena, this is exactly the same with the &amp;quot;_( string )&amp;quot; function.&lt;br /&gt;
&lt;br /&gt;
However, there is one difference on BGA: notifications. The server is sending notifications to players, and most of the time the notifications are the same for every players, no matter what language each player is using. This is why notifications are translated on client side in the proper language, even if the strings are defined on server side.&lt;br /&gt;
&lt;br /&gt;
== WARNING: how to make sure your strings will be translated ==&lt;br /&gt;
&lt;br /&gt;
For each game, our translation tool is doing a full scan of the code, looking for translator markers like &amp;quot;_()&amp;quot; or &amp;quot;clientranslate()&amp;quot;... (see below the list of translation markers).&lt;br /&gt;
&lt;br /&gt;
If your original string is not &amp;quot;physically&amp;quot; inside one of this marker, it won&#039;t be translated.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Examples: the following strings will be translated:&lt;br /&gt;
    var mystring_translated = _(&amp;quot;my string&amp;quot;);       // JS&lt;br /&gt;
    $mystring_translated = self::_(&amp;quot;my string&amp;quot;);    // PHP&lt;br /&gt;
    $mystring_translated = sprintf( _(&amp;quot;my string with an %s argument&amp;quot;), $argument );   // PHP&lt;br /&gt;
&lt;br /&gt;
    // Examples: the following strings WILL NOT be translated:&lt;br /&gt;
    $my_string = &amp;quot;my string&amp;quot;;&lt;br /&gt;
    $not_translated = self::_( $my_string );   // The original string is not bordered by a translator marker =&amp;gt; no translation&lt;br /&gt;
    $not_translated = self::_( sprintf( &amp;quot;my string with a %s argument&amp;quot;, $argument ) ); // Same thing&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How to not make translators crazy ;) ==&lt;br /&gt;
&lt;br /&gt;
* When you need the same string twice, try to reuse exactly the same string (with the same case) to minimize the number of strings.&lt;br /&gt;
* Do not mark as translatable a game element that does not have to be translated (ex: if the name of a monster on a card is &amp;quot;Zzzzz&amp;quot;, maybe there&#039;s no need to translate it).&lt;br /&gt;
* Words does not come in the same order in each language. Thus, when you have to translate a string with an argument, do not write something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;_(&amp;quot;First part of the string, &amp;quot;).$argument.&#039; &#039;._(&amp;quot;second part of the string&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
Write instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;sprintf( _(&amp;quot;First part of the string, %s second part of the string&amp;quot;), $argument )&amp;lt;/pre&amp;gt;&lt;br /&gt;
(or the equivalent &amp;quot;dojo.string.substitute&amp;quot; in Javascript)&lt;br /&gt;
* When translators are going to translate your game, the most difficult task for them is to get the context of the string to be translated. The more the string is a short insignificant string, the more difficult is the task for them. As a rule of thumb, try to avoid insignificant short strings. You can also leave a comment on what is the context of the string in the translation program (English to English) if you are the developer of the game.&lt;br /&gt;
* The BGA translation policy is to be flexible on grammar... We prefer to write &amp;quot;player gets 1 coin(s)&amp;quot; than write two versions of the same string for plural and singular - it reduces the number of strings to translate.&lt;br /&gt;
* Instead of writing nice strings like &amp;quot;With the effect of ZZZ, player XXX gets a new YYY&amp;quot;, which is very difficult to translate, write strings like &amp;quot;ZZZ: XXX gets YYY&amp;quot;.&lt;br /&gt;
* Use present tense instead of past, i.e. &amp;quot;player gets wood&amp;quot; instead of &amp;quot;player got wood&amp;quot;&lt;br /&gt;
* Avoid using gender specific pronouns, i.e. &amp;quot;player returns card to their hand&amp;quot; instead of &amp;quot;player returns card to his hand&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== On client side (Javascript) ==&lt;br /&gt;
&lt;br /&gt;
On client side, things are quite simple: you just have to use the &amp;quot;_()&amp;quot; function for all strings you want to translate.&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Get a string in player&#039;s language:&lt;br /&gt;
var translated = _(&amp;quot;original english string&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Get a string in player&#039;s language with parameter:&lt;br /&gt;
var translated = dojo.string.substitute( _(&amp;quot;You can pick ${p} cards and discard ${d}&amp;quot;), {&lt;br /&gt;
    p: 2,&lt;br /&gt;
    d: 4&lt;br /&gt;
} );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING:&#039;&#039;&#039; in Javascript strings to translate, you should never use &#039;\n&#039;, &#039;\t&#039; or such, as it will break the translation bundle and result in all the Javascript translation to fail. In any case, the strings will result in HTML code, and such character codes won&#039;t have any impact on the HTML rendering. You should use HTML markup instead.&lt;br /&gt;
&lt;br /&gt;
== On server side (PHP) ==&lt;br /&gt;
&lt;br /&gt;
On PHP side, you can use 3 different functions to specify that a string must be translated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;clienttranslate( &amp;quot;my string to translate&amp;quot; ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This function is &#039;&#039;&#039;transparent&#039;&#039;&#039;: it will return the original English string without any change. It&#039;s only purpose is to mark this string as &amp;quot;must be translated&amp;quot;, and to make sure the translated version of the string will be available on client side.&lt;br /&gt;
&lt;br /&gt;
In general, you use clienttranslate:&lt;br /&gt;
* On your states.inc.php, for field &amp;quot;description&amp;quot; and &amp;quot;descriptionmyturn&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      &amp;quot;description&amp;quot; =&amp;gt; clienttranslate(&#039;${card_name}: ${actplayer} must discard 4 identical energies&#039;),&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On &amp;quot;material.inc.php&amp;quot;, when defining texts for game material that must be displayed on client side.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$this-&amp;gt;card_types = array(&lt;br /&gt;
&lt;br /&gt;
     1 =&amp;gt; array(&lt;br /&gt;
        &#039;name&#039; =&amp;gt; clienttranslate(&amp;quot;Amulet of Air&amp;quot;), // Thus, we can use &amp;quot;_( card_name )&amp;quot; on Javascript side.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* When sending a notification with &amp;quot;notifyAllPlayers&amp;quot; or &amp;quot;notifyPlayer&amp;quot;, for the game log string and all game log arguments that need a translation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     // A game log string with no argument:&lt;br /&gt;
     self::notifyAllPlayers( &#039;pickLibraryCards&#039;, clienttranslate(&amp;quot;Everyone draw cards from his library&amp;quot;), array() );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Translating arguments is a little bit more complex. It is using the &amp;quot;i18n&amp;quot; special argument as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 // In the following example, we translate the game log itself, but also the &amp;quot;card_name&amp;quot; argument:&lt;br /&gt;
&lt;br /&gt;
 self::notifyAllPlayers( &#039;winPoints&#039;, clienttranslate(&#039;${card_name}: ${player_name} gains ${points} point(s)&#039;), array(&lt;br /&gt;
                &#039;i18n&#039; =&amp;gt; array( &#039;card_name&#039; ),     // &amp;lt;===== We specify here that &amp;quot;card_name&amp;quot; argument must be translated&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;points&#039; =&amp;gt; $points,&lt;br /&gt;
                &#039;card_name&#039; =&amp;gt; $this-&amp;gt;card_types[8][&#039;name&#039;] // &amp;lt;==== Here, we provide original English string.&lt;br /&gt;
            ) ); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pay attention when using &#039;i18n&#039; argument when translating argument for client : do NOT use same argument for both translation AND key code for client side action (like using &#039;card_name&#039; to move it on player board as described in the example). It&#039;s pretty obvious in the example, but it can be very tricky when translation is made at the end of the development (which is often the case). Use explicit argument name like &#039;card_name_translated&#039; by example.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;self::_( &amp;quot;my string to translate&amp;quot; ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This function returns a string translated in the language of CURRENT user (ie: player who send the request to the server) (be careful, this is NOT the active player).&lt;br /&gt;
&lt;br /&gt;
Most of the time, you don&#039;t need to translate strings on server side, except on the following 3 situations:&lt;br /&gt;
* When throwing an exception because the player did a forbidden move.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// This will display a translatable red message to the player that just do some wrong action:&lt;br /&gt;
throw new BgaUserException( self::_(&#039;You must choose 3 cards&#039;) );&lt;br /&gt;
&lt;br /&gt;
// ... notice the use of BgaUserException that signals that this exception is &amp;quot;expected&amp;quot;. In theory, all exception that are expected should be translated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In &amp;quot;yourgame.view.php&amp;quot;, when creating the labels for the game interface used in your template (.tpl) file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$this-&amp;gt;tpl[&#039;CARDS_FOR_YEAR_2&#039;] = self::_(&amp;quot;Your cards for year II&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Eventually, in your material.inc.php, if for example you need to use some string elements in your exceptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// In material.inc.php, $this-&amp;gt;energies[n][&#039;nametr&#039;] has been created with the self::_() method. This we can do this:&lt;br /&gt;
throw new BgaUserException( self::_(&amp;quot;To execute this action you need more: &amp;quot;).&#039; &#039;.$this-&amp;gt;energies[$resource_id][&#039;nametr&#039;] );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Eventually, in your &amp;quot;getAllDatas&amp;quot; PHP method, as the data return by this method is used only by current user.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;totranslate( &amp;quot;my string to translate&amp;quot; ):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This function works exactly like &#039;clienttranslate&#039;, except it tells BGA that the string is not needed on client side.&lt;br /&gt;
&lt;br /&gt;
You should not use this function, except on the following cases:&lt;br /&gt;
* Statistics name in stats.inc.php&lt;br /&gt;
* Option names and option values name in gameoptions.inc.php&lt;/div&gt;</summary>
		<author><name>Cpasbanal</name></author>
	</entry>
</feed>