<?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=Ricardorix</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=Ricardorix"/>
	<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/Special:Contributions/Ricardorix"/>
	<updated>2026-11-19T07:10:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Tools_and_tips_of_BGA_Studio&amp;diff=4293</id>
		<title>Tools and tips of BGA Studio</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Tools_and_tips_of_BGA_Studio&amp;diff=4293"/>
		<updated>2020-05-06T15:06:03Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* PDF Scrapper */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
== Server Tools and Tips ==&lt;br /&gt;
=== Starting a game in one click ===&lt;br /&gt;
&lt;br /&gt;
To start a game:&lt;br /&gt;
* Create a new table with your game.&lt;br /&gt;
* If you want to play a game with 3 players, specify that you want a maximum of 3 players at this table.&lt;br /&gt;
* Click on &amp;quot;Express Start&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Stopping a game in one click ===&lt;br /&gt;
&lt;br /&gt;
* Click on the &amp;quot;quit&amp;quot; icon on the top right of the screen.&lt;br /&gt;
* Click on &amp;quot;Express Stop&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Switching between users ===&lt;br /&gt;
&lt;br /&gt;
When running a game on Studio, you can use the little red arrow near each player&#039;s name to open a new tab with this player&#039;s perspective.&lt;br /&gt;
&lt;br /&gt;
=== Access to game database and Logs ===&lt;br /&gt;
&lt;br /&gt;
At the bottom of the game area, there is section without a title containing 3 useful links:&lt;br /&gt;
&lt;br /&gt;
  Go to game database • BGA request&amp;amp;SQL logs • BGA unexpected exceptions logs&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Go to game database&amp;quot; link is an immediate access to the PhpMyAdmin tool to view/edit the tables of the current game&lt;br /&gt;
* BGA request&amp;amp;SQL logs - link to your studio PHP log - all tables, all severities. Anything you print using debugging and tracing functions from PHP and some framework logs&lt;br /&gt;
* BGA unexpected exceptions logs - same log as above but only severity warning and higher&lt;br /&gt;
&lt;br /&gt;
See [[Practical debugging]] for more info about it.&lt;br /&gt;
&lt;br /&gt;
=== Save &amp;amp; restore state ===&lt;br /&gt;
&lt;br /&gt;
Using links of this section, you can save the complete current (database) state of your game, then restore it later.&lt;br /&gt;
&lt;br /&gt;
This is particularly useful when you want to develop a part of the game that is difficult to reproduce: you just have to save the situation just before, and then restore it until this part works fine.&lt;br /&gt;
&lt;br /&gt;
We provide you 3 &amp;quot;slots&amp;quot;: 1, 2 and 3. This way, you can save 3 different game situations.&lt;br /&gt;
&lt;br /&gt;
Limits:&lt;br /&gt;
* the &amp;quot;restore&amp;quot; function does not work anymore when the game is over.&lt;br /&gt;
* a saved situation from a given table cannot be restored in another table.&lt;br /&gt;
* when you &amp;quot;restore&amp;quot; a situation, the current browser page is refreshed to reflect the updated game situation, but you have to refresh you other tabs/pages manually.&lt;br /&gt;
&lt;br /&gt;
=== Input/Output debugging section ===&lt;br /&gt;
&lt;br /&gt;
This section shows you:&lt;br /&gt;
* The AJAX calls made by your game interface to the game server. AJAX calls (outputs) begins with &amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
* The notifications received by your game interface. Notifications (inputs) begins with &amp;quot;&amp;lt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Note: if you click on some notification title, you can resend it immediately to the user interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Run PHP functions from the chat ===&lt;br /&gt;
&lt;br /&gt;
On BGA Studio, you can directly run a PHP method from the table chat.&lt;br /&gt;
&lt;br /&gt;
For example, if on your PHP you have this method:&lt;br /&gt;
   &lt;br /&gt;
   function giveMoneyToPlayer($player_id, $amount) { ... }&lt;br /&gt;
&lt;br /&gt;
You can call this method directly from the chat like this: &lt;br /&gt;
&lt;br /&gt;
  giveMoneyToPlayer(2564,2)&lt;br /&gt;
&lt;br /&gt;
Note: this is not a real php statement, you cannot use self::, you cannot use &amp;quot;;&amp;quot; at the end and you cannot use quotes,&lt;br /&gt;
if you need to pass a string skip the quotes, like this&lt;br /&gt;
  &lt;br /&gt;
  giveToActivePlayer(money,2)&lt;br /&gt;
&lt;br /&gt;
=== Stopping Hanging Game ===&lt;br /&gt;
&lt;br /&gt;
If game is hanging and you cannot enter it to stop you can type this URL (replace 12345 with your table number),&lt;br /&gt;
which should bring you to a place where you can stop it without entering:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;http://en.studio.boardgamearena.com/#!table?table=12345&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Desktop and Web Tools ==&lt;br /&gt;
=== Code Editors and IDEs ===&lt;br /&gt;
==== Eclipse For PHP Developers ====&lt;br /&gt;
&lt;br /&gt;
Eclipse PHP package can be starting point for development you need. You may also want to &lt;br /&gt;
install Tern JS plugins to understand dojo style JS. All desktops.&lt;br /&gt;
https://projects.eclipse.org/projects/tools.pdt&lt;br /&gt;
&lt;br /&gt;
==== Visual Studio Code ====&lt;br /&gt;
&lt;br /&gt;
Microsoft Visual Studio Code is light weight IDE/Editor. All desktops.&lt;br /&gt;
https://code.visualstudio.com&lt;br /&gt;
&lt;br /&gt;
==== Gedit (Ubuntu) ====&lt;br /&gt;
&#039;&#039;&#039;Edit TPL&#039;&#039;&#039;&lt;br /&gt;
To edit TPL with HTML code highlightings in Gedit under Ubuntu:&lt;br /&gt;
&lt;br /&gt;
find gtksourceview directory in /usr/share, depending on your version (2.0, 3.0,...).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here it&#039;s 3.0, then type in a terminal window:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo gedit /usr/share/gtksourceview-3.0/language-specs/html.lang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then find &#039;globs&#039; section, and change:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;property name=&amp;quot;globs&amp;quot;&amp;gt;*.html;*.htm;*.tpl&amp;lt;/property&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== File Sync ===&lt;br /&gt;
&lt;br /&gt;
==== File Sync on Windows ====&lt;br /&gt;
&lt;br /&gt;
Install [http://winscp.net/ WinSCP]. Map a remote directory to a local one and enable continuous sync (one way). You need SFTP password you get when you registered dev account.&lt;br /&gt;
&lt;br /&gt;
==== File Sync on Linux ====&lt;br /&gt;
&lt;br /&gt;
* Option 1 - Nautilus (file manager)&lt;br /&gt;
You can just use Nautilus &amp;quot;connect to a server&amp;quot; function with URL sftp://1.studio.boardgamearena.com&lt;br /&gt;
Then you&#039;ll get a mounted local folder mapping your studio folder and you can use any editor you like without further need for sync. Downside - if connection goes down you cannot work on source code, no local copy.&lt;br /&gt;
&lt;br /&gt;
* Option 2 - sftp and rsync&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
BASEDIR=`dirname $0`&lt;br /&gt;
REMOTE=$BASEDIR/remote&lt;br /&gt;
LOCAL=$BASEDIR/workspace&lt;br /&gt;
GAME=mygamenamehere&lt;br /&gt;
&lt;br /&gt;
#mount remote&lt;br /&gt;
fusermount -u $REMOTE #this unmounts dir&lt;br /&gt;
echo LongDevPassword | sshfs -o password_stdin myusernamehere@1.studio.boardgamearena.com: $REMOTE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#this starts auto-sync from local to remote mount&lt;br /&gt;
killall lsyncd&lt;br /&gt;
lsyncd -delay 1 -rsync $LOCAL/$GAME/ $REMOTE/$GAME&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be able run on startup, so you don&#039;t have to do anything manually. However sshfs is not very stable you&lt;br /&gt;
have to kill and restart it sometimes. And remote goes away sometimes due to connection issues with studio. &lt;br /&gt;
In this case its handy to have a local copy, which is what lsyncd for.&lt;br /&gt;
&lt;br /&gt;
You can also sync on demand (from a build script or editor command) using&lt;br /&gt;
 rsync -vlrt $LOCAL/$GAME/ $REMOTE/$GAME&lt;br /&gt;
&lt;br /&gt;
==== File Sync using VSCode ====&lt;br /&gt;
You might rely on your IDE to sync the files with the SFTP server. Each time you &amp;quot;save&amp;quot; a file with your modifications, the IDE will also submit it to the sFTP server. These are instructions for VS Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Install this extension&#039;&#039;&#039; https://marketplace.visualstudio.com/items?itemName=liximomo.sftp (File-&amp;gt;Preferences-&amp;gt;Extensions ... type SFTP and Install)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Open VSCode on an empty folder&#039;&#039;&#039; that will be the local root of your project.&lt;br /&gt;
&lt;br /&gt;
* Execute Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac to open the command palette, and the type/run : &#039;&#039;&#039;&amp;quot;SFTP: config&amp;quot;&#039;&#039;&#039; - the edit will open with json config&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Update the json&#039;&#039;&#039; as below: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;BGA&amp;quot;,&lt;br /&gt;
    &amp;quot;host&amp;quot;: &amp;quot;1.studio.boardgamearena.com&amp;quot;,&lt;br /&gt;
    &amp;quot;protocol&amp;quot;: &amp;quot;sftp&amp;quot;,&lt;br /&gt;
    &amp;quot;port&amp;quot;: 22,&lt;br /&gt;
    &amp;quot;username&amp;quot;: &amp;quot;&amp;lt;your SFTP username&amp;gt;&amp;quot;,&lt;br /&gt;
    &amp;quot;password&amp;quot;: &amp;quot;&amp;lt;your SFTP password&amp;gt;&amp;quot;,&lt;br /&gt;
    &amp;quot;remotePath&amp;quot;: &amp;quot;/&amp;lt;your project name&amp;gt;/&amp;quot;,&lt;br /&gt;
    &amp;quot;uploadOnSave&amp;quot;: true,&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;
    ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- Execute Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac to open the command palette, and the type/run : &#039;&#039;&#039;&amp;quot;SFTP: Download Project&amp;quot;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This will download all the files locally, and each time you modify/save a file in VSCode, it will upload it to the SFTP Server.&lt;br /&gt;
&lt;br /&gt;
=== Debuggers ===&lt;br /&gt;
&lt;br /&gt;
Browser is the best tool for JS/HTML5 debugging, see [[Practical debugging]] for details.&lt;br /&gt;
&lt;br /&gt;
=== Version Control ===&lt;br /&gt;
Studio providers svn for you code on server, there are some limited abilities there to see history and restore. I recommend to keep your code in another repository. I suggest to use git with local repo, which you can sync to cloud or backup.&lt;br /&gt;
Other option is to host source code on github, if you do use this convention github.com/&amp;lt;yourname&amp;gt;/bga-&amp;lt;yourgame&amp;gt;. In such case make sure you don&#039;t post high-res publisher graphics only web resources, and post a separate license for graphics files.&lt;br /&gt;
&lt;br /&gt;
=== PHP CLI ===&lt;br /&gt;
Its handy to have php cli (command line) tools install to run php locally, so you can test some stuff without deployment cycle, or create some scripts that generate code or markup.&lt;br /&gt;
&lt;br /&gt;
=== Image Manipulation ===&lt;br /&gt;
==== ImageMagick ====&lt;br /&gt;
Handy set of image manipulation &#039;&#039;&#039;command line&#039;&#039;&#039; tools, useful to for example to stitch together bunch of images and re-size, to use as sprite (in Stock component for example). I.e. you got a graphics file from publisher where every tile is 600x600 PNG file in separate file. You want .jpg instead of .png to make it not like 20Mb, and combine all images in one column and re-size to 128x128:&lt;br /&gt;
&lt;br /&gt;
(Linux example)&lt;br /&gt;
 /usr/bin/montage  `ls Tiles*.png` -tile 1 -geometry 128x128+0+0 out/tiles128.jpg&lt;br /&gt;
&lt;br /&gt;
https://www.imagemagick.org/script/download.php&lt;br /&gt;
&lt;br /&gt;
==== Gimp ====&lt;br /&gt;
&lt;br /&gt;
GUI tool, very complex but will do ALL what you possibly need to do with game graphics&lt;br /&gt;
&lt;br /&gt;
https://www.gimp.org/&lt;br /&gt;
&lt;br /&gt;
==== Shrinking ====&lt;br /&gt;
&lt;br /&gt;
Shrink images without loss of quality https://tinypng.com/ or http://www.iloveimg.com/ &lt;br /&gt;
&lt;br /&gt;
==== PDF Scrapper ====&lt;br /&gt;
extract images from PDF file (i.e. game rulebook) :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
https://www.ilovepdf.com/&lt;br /&gt;
&lt;br /&gt;
http://www.extractpdf.com/&lt;br /&gt;
&lt;br /&gt;
==== Rename/Copy project ====&lt;br /&gt;
&lt;br /&gt;
There is a script available in sharedcode project to do the renaming which can be called in command line if you have php command line installed.&lt;br /&gt;
You need to have php clt (command line interface) installed, then you can download script and run it.&lt;br /&gt;
&lt;br /&gt;
https://github.com/elaskavaia/bga-sharedcode/blob/master/tools/bgaprojectrename.php&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
 php bgaprojectrename.php &amp;lt;originalProjectPath&amp;gt; &amp;lt;copyOfProjectRenamedPath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example on how to call it in command line  if you project name is &amp;quot;heartsmyproject&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 php7.0 git/bga-sharedcode/tools/bgaprojectrename.php remote/hearts/ remote/heartsmyproject/&lt;br /&gt;
&lt;br /&gt;
==== BGA Workbench ====&lt;br /&gt;
&lt;br /&gt;
PHP library providing tools to help manage BGA Studio projects including deployment and test utilities. https://github.com/danielholmes/bga-workbench&lt;br /&gt;
&lt;br /&gt;
== Client Tips ==&lt;br /&gt;
&lt;br /&gt;
=== Speed up game re-loading by disabling Input/Output debug section ===&lt;br /&gt;
&lt;br /&gt;
Development UI have few sections for debugging only, such as &#039;Input/Output debugging section&#039;. Loading this data will significantly slow down&lt;br /&gt;
your reload. I did some profiling and my reloading (i.e. F5) took 14 seconds, 12 of which it was dealing with loading this section. &lt;br /&gt;
If you not using it you can disable it. In your JavaScript code, in the begging of &#039;setup&#039; method add this code&lt;br /&gt;
&lt;br /&gt;
         dojo.destroy(&#039;debug_output&#039;);&lt;br /&gt;
&lt;br /&gt;
That should get rid of this section and overhead associated with loading it (it may have some other side-effects, I have not explored all of them)&lt;br /&gt;
&lt;br /&gt;
=== Speed up CSS development and layout ===&lt;br /&gt;
&lt;br /&gt;
Syncing files to server and refreshing is relative fast but still can take up to 20 seconds which is annoying.&lt;br /&gt;
If you working&lt;br /&gt;
a lot on css/images/layout you can speed it up by coping html in some state of the game to your local folder.&lt;br /&gt;
I.e. in your  project folder create directory misc/ and save your html as misc/test.html and changing path to css to load from local disk (and it will load your images to from local disk as well). &lt;br /&gt;
I.e. find something like&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;http://1.studio.boardgamearena.com:8081/data/themereleases/151226-1240/games/mygame/999999-9999/mygame.css&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and replace with&lt;br /&gt;
   &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;../mygame.css&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
You project structure will look like this&lt;br /&gt;
&lt;br /&gt;
 mygame&lt;br /&gt;
   img/ &amp;lt;-- your images&lt;br /&gt;
   mygame.css  &amp;lt;-- your original css&lt;br /&gt;
   ...&lt;br /&gt;
   misc/&lt;br /&gt;
     test.html &amp;lt;-- your test html&lt;br /&gt;
&lt;br /&gt;
It is a bit tricky to save html exact state, if you do save as it also pulls all resources sometimes.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Tools_and_tips_of_BGA_Studio&amp;diff=4292</id>
		<title>Tools and tips of BGA Studio</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Tools_and_tips_of_BGA_Studio&amp;diff=4292"/>
		<updated>2020-05-06T15:05:42Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* PDF Scrabber */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
== Server Tools and Tips ==&lt;br /&gt;
=== Starting a game in one click ===&lt;br /&gt;
&lt;br /&gt;
To start a game:&lt;br /&gt;
* Create a new table with your game.&lt;br /&gt;
* If you want to play a game with 3 players, specify that you want a maximum of 3 players at this table.&lt;br /&gt;
* Click on &amp;quot;Express Start&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Stopping a game in one click ===&lt;br /&gt;
&lt;br /&gt;
* Click on the &amp;quot;quit&amp;quot; icon on the top right of the screen.&lt;br /&gt;
* Click on &amp;quot;Express Stop&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Switching between users ===&lt;br /&gt;
&lt;br /&gt;
When running a game on Studio, you can use the little red arrow near each player&#039;s name to open a new tab with this player&#039;s perspective.&lt;br /&gt;
&lt;br /&gt;
=== Access to game database and Logs ===&lt;br /&gt;
&lt;br /&gt;
At the bottom of the game area, there is section without a title containing 3 useful links:&lt;br /&gt;
&lt;br /&gt;
  Go to game database • BGA request&amp;amp;SQL logs • BGA unexpected exceptions logs&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Go to game database&amp;quot; link is an immediate access to the PhpMyAdmin tool to view/edit the tables of the current game&lt;br /&gt;
* BGA request&amp;amp;SQL logs - link to your studio PHP log - all tables, all severities. Anything you print using debugging and tracing functions from PHP and some framework logs&lt;br /&gt;
* BGA unexpected exceptions logs - same log as above but only severity warning and higher&lt;br /&gt;
&lt;br /&gt;
See [[Practical debugging]] for more info about it.&lt;br /&gt;
&lt;br /&gt;
=== Save &amp;amp; restore state ===&lt;br /&gt;
&lt;br /&gt;
Using links of this section, you can save the complete current (database) state of your game, then restore it later.&lt;br /&gt;
&lt;br /&gt;
This is particularly useful when you want to develop a part of the game that is difficult to reproduce: you just have to save the situation just before, and then restore it until this part works fine.&lt;br /&gt;
&lt;br /&gt;
We provide you 3 &amp;quot;slots&amp;quot;: 1, 2 and 3. This way, you can save 3 different game situations.&lt;br /&gt;
&lt;br /&gt;
Limits:&lt;br /&gt;
* the &amp;quot;restore&amp;quot; function does not work anymore when the game is over.&lt;br /&gt;
* a saved situation from a given table cannot be restored in another table.&lt;br /&gt;
* when you &amp;quot;restore&amp;quot; a situation, the current browser page is refreshed to reflect the updated game situation, but you have to refresh you other tabs/pages manually.&lt;br /&gt;
&lt;br /&gt;
=== Input/Output debugging section ===&lt;br /&gt;
&lt;br /&gt;
This section shows you:&lt;br /&gt;
* The AJAX calls made by your game interface to the game server. AJAX calls (outputs) begins with &amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
* The notifications received by your game interface. Notifications (inputs) begins with &amp;quot;&amp;lt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Note: if you click on some notification title, you can resend it immediately to the user interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Run PHP functions from the chat ===&lt;br /&gt;
&lt;br /&gt;
On BGA Studio, you can directly run a PHP method from the table chat.&lt;br /&gt;
&lt;br /&gt;
For example, if on your PHP you have this method:&lt;br /&gt;
   &lt;br /&gt;
   function giveMoneyToPlayer($player_id, $amount) { ... }&lt;br /&gt;
&lt;br /&gt;
You can call this method directly from the chat like this: &lt;br /&gt;
&lt;br /&gt;
  giveMoneyToPlayer(2564,2)&lt;br /&gt;
&lt;br /&gt;
Note: this is not a real php statement, you cannot use self::, you cannot use &amp;quot;;&amp;quot; at the end and you cannot use quotes,&lt;br /&gt;
if you need to pass a string skip the quotes, like this&lt;br /&gt;
  &lt;br /&gt;
  giveToActivePlayer(money,2)&lt;br /&gt;
&lt;br /&gt;
=== Stopping Hanging Game ===&lt;br /&gt;
&lt;br /&gt;
If game is hanging and you cannot enter it to stop you can type this URL (replace 12345 with your table number),&lt;br /&gt;
which should bring you to a place where you can stop it without entering:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;http://en.studio.boardgamearena.com/#!table?table=12345&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Desktop and Web Tools ==&lt;br /&gt;
=== Code Editors and IDEs ===&lt;br /&gt;
==== Eclipse For PHP Developers ====&lt;br /&gt;
&lt;br /&gt;
Eclipse PHP package can be starting point for development you need. You may also want to &lt;br /&gt;
install Tern JS plugins to understand dojo style JS. All desktops.&lt;br /&gt;
https://projects.eclipse.org/projects/tools.pdt&lt;br /&gt;
&lt;br /&gt;
==== Visual Studio Code ====&lt;br /&gt;
&lt;br /&gt;
Microsoft Visual Studio Code is light weight IDE/Editor. All desktops.&lt;br /&gt;
https://code.visualstudio.com&lt;br /&gt;
&lt;br /&gt;
==== Gedit (Ubuntu) ====&lt;br /&gt;
&#039;&#039;&#039;Edit TPL&#039;&#039;&#039;&lt;br /&gt;
To edit TPL with HTML code highlightings in Gedit under Ubuntu:&lt;br /&gt;
&lt;br /&gt;
find gtksourceview directory in /usr/share, depending on your version (2.0, 3.0,...).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here it&#039;s 3.0, then type in a terminal window:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    sudo gedit /usr/share/gtksourceview-3.0/language-specs/html.lang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then find &#039;globs&#039; section, and change:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;property name=&amp;quot;globs&amp;quot;&amp;gt;*.html;*.htm;*.tpl&amp;lt;/property&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== File Sync ===&lt;br /&gt;
&lt;br /&gt;
==== File Sync on Windows ====&lt;br /&gt;
&lt;br /&gt;
Install [http://winscp.net/ WinSCP]. Map a remote directory to a local one and enable continuous sync (one way). You need SFTP password you get when you registered dev account.&lt;br /&gt;
&lt;br /&gt;
==== File Sync on Linux ====&lt;br /&gt;
&lt;br /&gt;
* Option 1 - Nautilus (file manager)&lt;br /&gt;
You can just use Nautilus &amp;quot;connect to a server&amp;quot; function with URL sftp://1.studio.boardgamearena.com&lt;br /&gt;
Then you&#039;ll get a mounted local folder mapping your studio folder and you can use any editor you like without further need for sync. Downside - if connection goes down you cannot work on source code, no local copy.&lt;br /&gt;
&lt;br /&gt;
* Option 2 - sftp and rsync&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
BASEDIR=`dirname $0`&lt;br /&gt;
REMOTE=$BASEDIR/remote&lt;br /&gt;
LOCAL=$BASEDIR/workspace&lt;br /&gt;
GAME=mygamenamehere&lt;br /&gt;
&lt;br /&gt;
#mount remote&lt;br /&gt;
fusermount -u $REMOTE #this unmounts dir&lt;br /&gt;
echo LongDevPassword | sshfs -o password_stdin myusernamehere@1.studio.boardgamearena.com: $REMOTE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#this starts auto-sync from local to remote mount&lt;br /&gt;
killall lsyncd&lt;br /&gt;
lsyncd -delay 1 -rsync $LOCAL/$GAME/ $REMOTE/$GAME&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be able run on startup, so you don&#039;t have to do anything manually. However sshfs is not very stable you&lt;br /&gt;
have to kill and restart it sometimes. And remote goes away sometimes due to connection issues with studio. &lt;br /&gt;
In this case its handy to have a local copy, which is what lsyncd for.&lt;br /&gt;
&lt;br /&gt;
You can also sync on demand (from a build script or editor command) using&lt;br /&gt;
 rsync -vlrt $LOCAL/$GAME/ $REMOTE/$GAME&lt;br /&gt;
&lt;br /&gt;
==== File Sync using VSCode ====&lt;br /&gt;
You might rely on your IDE to sync the files with the SFTP server. Each time you &amp;quot;save&amp;quot; a file with your modifications, the IDE will also submit it to the sFTP server. These are instructions for VS Code&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Install this extension&#039;&#039;&#039; https://marketplace.visualstudio.com/items?itemName=liximomo.sftp (File-&amp;gt;Preferences-&amp;gt;Extensions ... type SFTP and Install)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Open VSCode on an empty folder&#039;&#039;&#039; that will be the local root of your project.&lt;br /&gt;
&lt;br /&gt;
* Execute Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac to open the command palette, and the type/run : &#039;&#039;&#039;&amp;quot;SFTP: config&amp;quot;&#039;&#039;&#039; - the edit will open with json config&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Update the json&#039;&#039;&#039; as below: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;BGA&amp;quot;,&lt;br /&gt;
    &amp;quot;host&amp;quot;: &amp;quot;1.studio.boardgamearena.com&amp;quot;,&lt;br /&gt;
    &amp;quot;protocol&amp;quot;: &amp;quot;sftp&amp;quot;,&lt;br /&gt;
    &amp;quot;port&amp;quot;: 22,&lt;br /&gt;
    &amp;quot;username&amp;quot;: &amp;quot;&amp;lt;your SFTP username&amp;gt;&amp;quot;,&lt;br /&gt;
    &amp;quot;password&amp;quot;: &amp;quot;&amp;lt;your SFTP password&amp;gt;&amp;quot;,&lt;br /&gt;
    &amp;quot;remotePath&amp;quot;: &amp;quot;/&amp;lt;your project name&amp;gt;/&amp;quot;,&lt;br /&gt;
    &amp;quot;uploadOnSave&amp;quot;: true,&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;
    ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
- Execute Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac to open the command palette, and the type/run : &#039;&#039;&#039;&amp;quot;SFTP: Download Project&amp;quot;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This will download all the files locally, and each time you modify/save a file in VSCode, it will upload it to the SFTP Server.&lt;br /&gt;
&lt;br /&gt;
=== Debuggers ===&lt;br /&gt;
&lt;br /&gt;
Browser is the best tool for JS/HTML5 debugging, see [[Practical debugging]] for details.&lt;br /&gt;
&lt;br /&gt;
=== Version Control ===&lt;br /&gt;
Studio providers svn for you code on server, there are some limited abilities there to see history and restore. I recommend to keep your code in another repository. I suggest to use git with local repo, which you can sync to cloud or backup.&lt;br /&gt;
Other option is to host source code on github, if you do use this convention github.com/&amp;lt;yourname&amp;gt;/bga-&amp;lt;yourgame&amp;gt;. In such case make sure you don&#039;t post high-res publisher graphics only web resources, and post a separate license for graphics files.&lt;br /&gt;
&lt;br /&gt;
=== PHP CLI ===&lt;br /&gt;
Its handy to have php cli (command line) tools install to run php locally, so you can test some stuff without deployment cycle, or create some scripts that generate code or markup.&lt;br /&gt;
&lt;br /&gt;
=== Image Manipulation ===&lt;br /&gt;
==== ImageMagick ====&lt;br /&gt;
Handy set of image manipulation &#039;&#039;&#039;command line&#039;&#039;&#039; tools, useful to for example to stitch together bunch of images and re-size, to use as sprite (in Stock component for example). I.e. you got a graphics file from publisher where every tile is 600x600 PNG file in separate file. You want .jpg instead of .png to make it not like 20Mb, and combine all images in one column and re-size to 128x128:&lt;br /&gt;
&lt;br /&gt;
(Linux example)&lt;br /&gt;
 /usr/bin/montage  `ls Tiles*.png` -tile 1 -geometry 128x128+0+0 out/tiles128.jpg&lt;br /&gt;
&lt;br /&gt;
https://www.imagemagick.org/script/download.php&lt;br /&gt;
&lt;br /&gt;
==== Gimp ====&lt;br /&gt;
&lt;br /&gt;
GUI tool, very complex but will do ALL what you possibly need to do with game graphics&lt;br /&gt;
&lt;br /&gt;
https://www.gimp.org/&lt;br /&gt;
&lt;br /&gt;
==== Shrinking ====&lt;br /&gt;
&lt;br /&gt;
Shrink images without loss of quality https://tinypng.com/ or http://www.iloveimg.com/ &lt;br /&gt;
&lt;br /&gt;
==== PDF Scrapper ====&lt;br /&gt;
extract images from PDF file (i.e. game rulebook) :&lt;br /&gt;
&lt;br /&gt;
https://www.ilovepdf.com/&lt;br /&gt;
http://www.extractpdf.com/&lt;br /&gt;
&lt;br /&gt;
==== Rename/Copy project ====&lt;br /&gt;
&lt;br /&gt;
There is a script available in sharedcode project to do the renaming which can be called in command line if you have php command line installed.&lt;br /&gt;
You need to have php clt (command line interface) installed, then you can download script and run it.&lt;br /&gt;
&lt;br /&gt;
https://github.com/elaskavaia/bga-sharedcode/blob/master/tools/bgaprojectrename.php&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
 php bgaprojectrename.php &amp;lt;originalProjectPath&amp;gt; &amp;lt;copyOfProjectRenamedPath&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example on how to call it in command line  if you project name is &amp;quot;heartsmyproject&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 php7.0 git/bga-sharedcode/tools/bgaprojectrename.php remote/hearts/ remote/heartsmyproject/&lt;br /&gt;
&lt;br /&gt;
==== BGA Workbench ====&lt;br /&gt;
&lt;br /&gt;
PHP library providing tools to help manage BGA Studio projects including deployment and test utilities. https://github.com/danielholmes/bga-workbench&lt;br /&gt;
&lt;br /&gt;
== Client Tips ==&lt;br /&gt;
&lt;br /&gt;
=== Speed up game re-loading by disabling Input/Output debug section ===&lt;br /&gt;
&lt;br /&gt;
Development UI have few sections for debugging only, such as &#039;Input/Output debugging section&#039;. Loading this data will significantly slow down&lt;br /&gt;
your reload. I did some profiling and my reloading (i.e. F5) took 14 seconds, 12 of which it was dealing with loading this section. &lt;br /&gt;
If you not using it you can disable it. In your JavaScript code, in the begging of &#039;setup&#039; method add this code&lt;br /&gt;
&lt;br /&gt;
         dojo.destroy(&#039;debug_output&#039;);&lt;br /&gt;
&lt;br /&gt;
That should get rid of this section and overhead associated with loading it (it may have some other side-effects, I have not explored all of them)&lt;br /&gt;
&lt;br /&gt;
=== Speed up CSS development and layout ===&lt;br /&gt;
&lt;br /&gt;
Syncing files to server and refreshing is relative fast but still can take up to 20 seconds which is annoying.&lt;br /&gt;
If you working&lt;br /&gt;
a lot on css/images/layout you can speed it up by coping html in some state of the game to your local folder.&lt;br /&gt;
I.e. in your  project folder create directory misc/ and save your html as misc/test.html and changing path to css to load from local disk (and it will load your images to from local disk as well). &lt;br /&gt;
I.e. find something like&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;http://1.studio.boardgamearena.com:8081/data/themereleases/151226-1240/games/mygame/999999-9999/mygame.css&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and replace with&lt;br /&gt;
   &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; href=&amp;quot;../mygame.css&amp;quot;/&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
You project structure will look like this&lt;br /&gt;
&lt;br /&gt;
 mygame&lt;br /&gt;
   img/ &amp;lt;-- your images&lt;br /&gt;
   mygame.css  &amp;lt;-- your original css&lt;br /&gt;
   ...&lt;br /&gt;
   misc/&lt;br /&gt;
     test.html &amp;lt;-- your test html&lt;br /&gt;
&lt;br /&gt;
It is a bit tricky to save html exact state, if you do save as it also pulls all resources sometimes.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpnxs&amp;diff=3806</id>
		<title>Gamehelpnxs</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpnxs&amp;diff=3806"/>
		<updated>2020-01-27T08:48:56Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Official Website and Full Rules Here: [http://www.nxsgame.com/tutorial.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NXS is pronounced &amp;quot;nexus&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Brief rules:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each piece represents a sailing ship.&lt;br /&gt;
&lt;br /&gt;
[[File:4-2.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Turn&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each turn you will:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Select ANY piece and &#039;&#039;&#039;Move&#039;&#039;&#039; OR &#039;&#039;&#039;Capture&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Select ANY piece and &#039;&#039;&#039;Rotate&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Moving&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pieces can move in the direction of their arrows&lt;br /&gt;
&lt;br /&gt;
They can move as far as their number of dots&lt;br /&gt;
&lt;br /&gt;
A piece cannot move through another piece&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pieces can move in a straight line in the direction of their arrows. They can move as many spaces as they have dots. Note that pieces must maintain their original facing as they move. You cannot rotate a piece as it moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capturing&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pieces capture by making a diagonal jump in the direction of their marked corners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NXS pieces have some of their corners marked with bold lines. These lines represent an attack direction. The captured piece is removed from the board and replaced with the capturing piece. The capturing piece maintains its orientation (do not rotate pieces when capturing).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:42_cap.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the game interface, when you click on your piece the hexes where you can move and capture will be highlighted in yellow and red to indicate legal moves.&lt;br /&gt;
&lt;br /&gt;
[[File:5-4_old.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You cannot jump over an enemy piece when capturing.  The pieces highlighted in pink are safe from the piece marked &#039;&#039;a&#039;&#039; because it cannot jump over the piece marked &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:cap_block2.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Merchant Ship piece cannot capture (has no marked corners), but it cannot be captured.&lt;br /&gt;
&lt;br /&gt;
[[File:3-0%20piece.png|100px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rotating&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On the second part of your turn, you &#039;&#039;&#039;must&#039;&#039;&#039; rotate one of your pieces by one facing, right or left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Territory&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Territory is captured by occupying an enemy hex,&lt;br /&gt;
&lt;br /&gt;
By having an unbroken line between your piece in enemy territory and your board edge,&lt;br /&gt;
&lt;br /&gt;
Or by having an unbroken line between two pieces in enemy territory.&lt;br /&gt;
&lt;br /&gt;
Captured spaces are only counted once&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The object of NXS is to capture enemy territory. Territory can be captured in one of three ways. The first is just by occupying the enemy board with one of your pieces.  Secondly, you can make an unbroken line between your piece, and your own border (like between &#039;&#039;b&#039;&#039; and the black board edge).  Lastly, you can have an unbroken line between two of your pieces in enemy territory (like between &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039; below).  Because there is a white piece (&#039;&#039;c&#039;&#039;) between &#039;&#039;a&#039;&#039; and the black border, no territory is captured.&lt;br /&gt;
&lt;br /&gt;
[[File:territory4.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Winning&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Game play continues until one player captures enough enemy territory to win (by default 10 spaces).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FAQ&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Why do I have to rotate a piece?&lt;br /&gt;
&lt;br /&gt;
Rotating a piece is a definitive end to your turn.  When you are playing someone in person, allowing someone to pass on the rotation phase causes long game pauses while you are waiting for your opponent to rotate and they forgot to say that they want to pass (it happened a lot during testing).  Making the rotation mandatory bypasses this, and also makes the board positions more dynamic.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpnxs&amp;diff=3805</id>
		<title>Gamehelpnxs</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpnxs&amp;diff=3805"/>
		<updated>2020-01-27T08:46:15Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Official Website and Full Rules Here: [http://www.nxsgame.com/tutorial.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NXS is pronounced &amp;quot;nexus&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Brief rules:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each piece represents a sailing ship.&lt;br /&gt;
&lt;br /&gt;
[[File:4-2.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
Each turn you will:&lt;br /&gt;
 Select ANY piece and &#039;&#039;&#039;Move&#039;&#039;&#039; OR &#039;&#039;&#039;Capture&#039;&#039;&#039;.&lt;br /&gt;
 Select ANY piece and &#039;&#039;&#039;Rotate&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Moving&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pieces can move in the direction of their arrows&lt;br /&gt;
&lt;br /&gt;
They can move as far as their number of dots&lt;br /&gt;
&lt;br /&gt;
A piece cannot move through another piece&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pieces can move in a straight line in the direction of their arrows. They can move as many spaces as they have dots. Note that pieces must maintain their original facing as they move. You cannot rotate a piece as it moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capturing&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pieces capture by making a diagonal jump in the direction of their marked corners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NXS pieces have some of their corners marked with bold lines. These lines represent an attack direction. The captured piece is removed from the board and replaced with the capturing piece. The capturing piece maintains its orientation (do not rotate pieces when capturing).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:42_cap.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the game interface, when you click on your piece the hexes where you can move and capture will be highlighted in yellow and red to indicate legal moves.&lt;br /&gt;
&lt;br /&gt;
[[File:5-4_old.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You cannot jump over an enemy piece when capturing.  The pieces highlighted in pink are safe from the piece marked &#039;&#039;a&#039;&#039; because it cannot jump over the piece marked &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:cap_block2.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Merchant Ship piece cannot capture (has no marked corners), but it cannot be captured.&lt;br /&gt;
&lt;br /&gt;
[[File:3-0%20piece.png|100px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rotating&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On the second part of your turn, you &#039;&#039;&#039;must&#039;&#039;&#039; rotate one of your pieces by one facing, right or left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Territory&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Territory is captured by occupying an enemy hex,&lt;br /&gt;
&lt;br /&gt;
By having an unbroken line between your piece in enemy territory and your board edge,&lt;br /&gt;
&lt;br /&gt;
Or by having an unbroken line between two pieces in enemy territory.&lt;br /&gt;
&lt;br /&gt;
Captured spaces are only counted once&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The object of NXS is to capture enemy territory. Territory can be captured in one of three ways. The first is just by occupying the enemy board with one of your pieces.  Secondly, you can make an unbroken line between your piece, and your own border (like between &#039;&#039;b&#039;&#039; and the black board edge).  Lastly, you can have an unbroken line between two of your pieces in enemy territory (like between &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039; below).  Because there is a white piece (&#039;&#039;c&#039;&#039;) between &#039;&#039;a&#039;&#039; and the black border, no territory is captured.&lt;br /&gt;
&lt;br /&gt;
[[File:territory4.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Winning&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Game play continues until one player captures enough enemy territory to win (by default 10 spaces).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FAQ&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Why do I have to rotate a piece?&lt;br /&gt;
&lt;br /&gt;
Rotating a piece is a definitive end to your turn.  When you are playing someone in person, allowing someone to pass on the rotation phase causes long game pauses while you are waiting for your opponent to rotate and they forgot to say that they want to pass (it happened a lot during testing).  Making the rotation mandatory bypasses this, and also makes the board positions more dynamic.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpnxs&amp;diff=3802</id>
		<title>Gamehelpnxs</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpnxs&amp;diff=3802"/>
		<updated>2020-01-26T12:48:37Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Official Website and Full Rules Here: [http://www.nxsgame.com/tutorial.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NXS is pronounced &amp;quot;nexus&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Brief rules:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each piece represents a sailing ship.&lt;br /&gt;
&lt;br /&gt;
[[File:4-2.jpg|250px]]&lt;br /&gt;
&lt;br /&gt;
Each turn you will:&lt;br /&gt;
 - Select a piece.&lt;br /&gt;
 - Move or Capture.&lt;br /&gt;
 - Rotate.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Moving&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pieces can move in the direction of their arrows&lt;br /&gt;
&lt;br /&gt;
They can move as far as their number of dots&lt;br /&gt;
&lt;br /&gt;
A piece cannot move through another piece&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pieces can move in a straight line in the direction of their arrows. They can move as many spaces as they have dots. Note that pieces must maintain their original facing as they move. You cannot rotate a piece as it moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capturing&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Pieces capture by making a diagonal jump in the direction of their marked corners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NXS pieces have some of their corners marked with bold lines. These lines represent an attack direction. The captured piece is removed from the board and replaced with the capturing piece. The capturing piece maintains its orientation (do not rotate pieces when capturing).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:42_cap.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the game interface, when you click on your piece the hexes where you can move and capture will be highlighted in yellow and red to indicate legal moves.&lt;br /&gt;
&lt;br /&gt;
[[File:5-4_old.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You cannot jump over an enemy piece when capturing.  The pieces highlighted in pink are safe from the piece marked &#039;&#039;a&#039;&#039; because it cannot jump over the piece marked &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:cap_block2.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Merchant Ship piece cannot capture (has no marked corners), but it cannot be captured.&lt;br /&gt;
&lt;br /&gt;
[[File:3-0%20piece.png|100px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rotating&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On the second part of your turn, you &#039;&#039;&#039;must&#039;&#039;&#039; rotate one of your pieces by one facing, right or left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Territory&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Territory is captured by occupying an enemy hex,&lt;br /&gt;
&lt;br /&gt;
By having an unbroken line between your piece in enemy territory and your board edge,&lt;br /&gt;
&lt;br /&gt;
Or by having an unbroken line between two pieces in enemy territory.&lt;br /&gt;
&lt;br /&gt;
Captured spaces are only counted once&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The object of NXS is to capture enemy territory. Territory can be captured in one of three ways. The first is just by occupying the enemy board with one of your pieces.  Secondly, you can make an unbroken line between your piece, and your own border (like between &#039;&#039;b&#039;&#039; and the black board edge).  Lastly, you can have an unbroken line between two of your pieces in enemy territory (like between &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039; below).  Because there is a white piece (&#039;&#039;c&#039;&#039;) between &#039;&#039;a&#039;&#039; and the black border, no territory is captured.&lt;br /&gt;
&lt;br /&gt;
[[File:territory4.jpg|480px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Winning&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Game play continues until one player captures enough enemy territory to win (by default 10 spaces).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FAQ&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Why do I have to rotate a piece?&lt;br /&gt;
&lt;br /&gt;
Rotating a piece is a definitive end to your turn.  When you are playing someone in person, allowing someone to pass on the rotation phase causes long game pauses while you are waiting for your opponent to rotate and they forgot to say that they want to pass (it happened a lot during testing).  Making the rotation mandatory bypasses this, and also makes the board positions more dynamic.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3795</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3795"/>
		<updated>2020-01-21T23:53:44Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Get the database matching a bug report */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
=== 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;
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;
* 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;
&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>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3793</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3793"/>
		<updated>2020-01-21T10:36:48Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Use Debugger */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
=== 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;
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;
* 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;
&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 &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308257 WHERE player_id = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308258 WHERE player_id = &#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>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3792</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3792"/>
		<updated>2020-01-21T10:36:10Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Use Debugger */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
=== 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 Debugger ===&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;
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;
* 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;
&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 &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308257 WHERE player_id = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308258 WHERE player_id = &#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>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3791</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3791"/>
		<updated>2020-01-21T10:33:50Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Get the database matching a bug report */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
=== 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 Debugger ===&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;
debugger; &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;
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;
* 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;
&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 &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308257 WHERE player_id = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308258 WHERE player_id = &#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>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3790</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3790"/>
		<updated>2020-01-21T10:30:05Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Get the database matching a bug report */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
=== 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 Debugger ===&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;
debugger; &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;
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;
* 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;
&lt;br /&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 &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308257 WHERE player_id = &#039;&amp;quot; . $id0 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
		self::DbQuery(&amp;quot;UPDATE &amp;quot; . $this-&amp;gt;table . &amp;quot; SET player_id=2308258 WHERE player_id = &#039;&amp;quot; . $id1 . &amp;quot;&#039;&amp;quot; );&lt;br /&gt;
          }&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3782</id>
		<title>Gamehelpskat</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3782"/>
		<updated>2020-01-14T17:22:59Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== Point values of cards ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 60%; height: 4em;&amp;quot; border=1&lt;br /&gt;
|-&lt;br /&gt;
!Rank	&lt;br /&gt;
!J	&lt;br /&gt;
!A	&lt;br /&gt;
!10	&lt;br /&gt;
!K	&lt;br /&gt;
!Q	&lt;br /&gt;
!9	&lt;br /&gt;
!8	&lt;br /&gt;
!7&lt;br /&gt;
|-&lt;br /&gt;
!Value	&lt;br /&gt;
!2	&lt;br /&gt;
!11	&lt;br /&gt;
!10	&lt;br /&gt;
!4	&lt;br /&gt;
!3	&lt;br /&gt;
!0	&lt;br /&gt;
!0	&lt;br /&gt;
!0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The non-trump suit cards rank in order &lt;br /&gt;
A-10-K-Q-9-8-7. &lt;br /&gt;
&lt;br /&gt;
The trumps rank the same way with the four jacks on top in the order &lt;br /&gt;
J♣, J♠, J♥, J♦.&lt;br /&gt;
&lt;br /&gt;
The total face value of all cards is 120 points. The declarer&#039;s goal is to take at least 61 points in tricks in order to win that round of the game.&lt;br /&gt;
&lt;br /&gt;
== Grand game ==&lt;br /&gt;
&lt;br /&gt;
In the grand game, only the four jacks are trumps in the suit order given above for a regular suit game. All other ranks are the same as in the regular suit game (10 is ranked just below the ace). There are thus five &amp;quot;suits&amp;quot; in the grand game (if a jack is led to a trick, the other two players must play jacks too, if they have them).&lt;br /&gt;
&lt;br /&gt;
== Null game ==&lt;br /&gt;
&lt;br /&gt;
In a null game there is no trump suit, and in each suit the cards are ranked A-K-Q-J-10-9-8-7.&lt;br /&gt;
&lt;br /&gt;
The goal of a null game is for declarer not to take any tricks. If declarer takes a trick in a null game, he immediately loses and the game is scored right away.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3781</id>
		<title>Gamehelpskat</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3781"/>
		<updated>2020-01-14T17:22:40Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Point values of cards&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 60%; height: 4em;&amp;quot; border=1&lt;br /&gt;
|-&lt;br /&gt;
!Rank	&lt;br /&gt;
!J	&lt;br /&gt;
!A	&lt;br /&gt;
!10	&lt;br /&gt;
!K	&lt;br /&gt;
!Q	&lt;br /&gt;
!9	&lt;br /&gt;
!8	&lt;br /&gt;
!7&lt;br /&gt;
|-&lt;br /&gt;
!Value	&lt;br /&gt;
!2	&lt;br /&gt;
!11	&lt;br /&gt;
!10	&lt;br /&gt;
!4	&lt;br /&gt;
!3	&lt;br /&gt;
!0	&lt;br /&gt;
!0	&lt;br /&gt;
!0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The non-trump suit cards rank in order &lt;br /&gt;
A-10-K-Q-9-8-7. &lt;br /&gt;
&lt;br /&gt;
The trumps rank the same way with the four jacks on top in the order &lt;br /&gt;
J♣, J♠, J♥, J♦.&lt;br /&gt;
&lt;br /&gt;
The total face value of all cards is 120 points. The declarer&#039;s goal is to take at least 61 points in tricks in order to win that round of the game.&lt;br /&gt;
&lt;br /&gt;
== Grand game ==&lt;br /&gt;
&lt;br /&gt;
In the grand game, only the four jacks are trumps in the suit order given above for a regular suit game. All other ranks are the same as in the regular suit game (10 is ranked just below the ace). There are thus five &amp;quot;suits&amp;quot; in the grand game (if a jack is led to a trick, the other two players must play jacks too, if they have them).&lt;br /&gt;
&lt;br /&gt;
== Null game ==&lt;br /&gt;
&lt;br /&gt;
In a null game there is no trump suit, and in each suit the cards are ranked A-K-Q-J-10-9-8-7.&lt;br /&gt;
&lt;br /&gt;
The goal of a null game is for declarer not to take any tricks. If declarer takes a trick in a null game, he immediately loses and the game is scored right away.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3780</id>
		<title>Gamehelpskat</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3780"/>
		<updated>2020-01-14T17:21:40Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Point values of cards&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 60%; height: 4em;&amp;quot; border=1&lt;br /&gt;
|-&lt;br /&gt;
!Rank	&lt;br /&gt;
!J	&lt;br /&gt;
!A	&lt;br /&gt;
!10	&lt;br /&gt;
!K	&lt;br /&gt;
!Q	&lt;br /&gt;
!9	&lt;br /&gt;
!8	&lt;br /&gt;
!7&lt;br /&gt;
|-&lt;br /&gt;
!Value	&lt;br /&gt;
!2	&lt;br /&gt;
!11	&lt;br /&gt;
!10	&lt;br /&gt;
!4	&lt;br /&gt;
!3	&lt;br /&gt;
!0	&lt;br /&gt;
!0	&lt;br /&gt;
!0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The non-trump suit cards rank in order &lt;br /&gt;
A-10-K-Q-9-8-7. &lt;br /&gt;
&lt;br /&gt;
The trumps rank the same way with the four jacks on top in the order &lt;br /&gt;
J♣, J♠, J♥, J♦.&lt;br /&gt;
&lt;br /&gt;
The total face value of all cards is 120 points. The declarer&#039;s goal is to take at least 61 points in tricks in order to win that round of the game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Grand game&lt;br /&gt;
In the grand game, only the four jacks are trumps in the suit order given above for a regular suit game. All other ranks are the same as in the regular suit game (10 is ranked just below the ace). There are thus five &amp;quot;suits&amp;quot; in the grand game (if a jack is led to a trick, the other two players must play jacks too, if they have them).&lt;br /&gt;
&lt;br /&gt;
Null game&lt;br /&gt;
In a null game there is no trump suit, and in each suit the cards are ranked A-K-Q-J-10-9-8-7.&lt;br /&gt;
&lt;br /&gt;
The goal of a null game is for declarer not to take any tricks. If declarer takes a trick in a null game, he immediately loses and the game is scored right away.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3763</id>
		<title>Gamehelpskat</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3763"/>
		<updated>2020-01-13T09:40:32Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Point values of cards&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 60%; height: 14em;&amp;quot; border=1&lt;br /&gt;
|-&lt;br /&gt;
!Rank	&lt;br /&gt;
!J	&lt;br /&gt;
!A	&lt;br /&gt;
!10	&lt;br /&gt;
!K	&lt;br /&gt;
!Q	&lt;br /&gt;
!9	&lt;br /&gt;
!8	&lt;br /&gt;
!7&lt;br /&gt;
|-&lt;br /&gt;
!Value	&lt;br /&gt;
!2	&lt;br /&gt;
!11	&lt;br /&gt;
!10	&lt;br /&gt;
!4	&lt;br /&gt;
!3	&lt;br /&gt;
!0	&lt;br /&gt;
!0	&lt;br /&gt;
!0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The non-trump suit cards rank in order &lt;br /&gt;
A-10-K-Q-9-8-7. &lt;br /&gt;
&lt;br /&gt;
The trumps rank the same way with the four jacks on top in the order &lt;br /&gt;
J♣, J♠, J♥, J♦.&lt;br /&gt;
&lt;br /&gt;
The total face value of all cards is 120 points. The declarer&#039;s goal is to take at least 61 points in tricks in order to win that round of the game.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3762</id>
		<title>Gamehelpskat</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3762"/>
		<updated>2020-01-13T04:06:55Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Point values of cards&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Rank	&lt;br /&gt;
!J	&lt;br /&gt;
!A	&lt;br /&gt;
!10	&lt;br /&gt;
!K	&lt;br /&gt;
!Q	&lt;br /&gt;
!9	&lt;br /&gt;
!8	&lt;br /&gt;
!7&lt;br /&gt;
|-&lt;br /&gt;
!Value	&lt;br /&gt;
!2	&lt;br /&gt;
!11	&lt;br /&gt;
!10	&lt;br /&gt;
!4	&lt;br /&gt;
!3	&lt;br /&gt;
!0	&lt;br /&gt;
!0	&lt;br /&gt;
!0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The non-trump suit cards rank in order &lt;br /&gt;
A-10-K-Q-9-8-7. &lt;br /&gt;
&lt;br /&gt;
The trumps rank the same way with the four jacks on top in the order &lt;br /&gt;
J♣, J♠, J♥, J♦.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3761</id>
		<title>Gamehelpskat</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpskat&amp;diff=3761"/>
		<updated>2020-01-12T22:19:12Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: Created page with &amp;quot; Point values of cards Rank	J	A	10	K	Q	9	8	7 Value	2	11	10	4	3	0	0	0  The non-trump suit cards rank in order  A-10-K-Q-9-8-7.   The trumps rank the same way with the four jack...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Point values of cards&lt;br /&gt;
Rank	J	A	10	K	Q	9	8	7&lt;br /&gt;
Value	2	11	10	4	3	0	0	0&lt;br /&gt;
&lt;br /&gt;
The non-trump suit cards rank in order &lt;br /&gt;
A-10-K-Q-9-8-7. &lt;br /&gt;
&lt;br /&gt;
The trumps rank the same way with the four jacks on top in the order &lt;br /&gt;
J♣, J♠, J♥, J♦.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpdragoncastle&amp;diff=3705</id>
		<title>Gamehelpdragoncastle</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpdragoncastle&amp;diff=3705"/>
		<updated>2019-12-01T10:58:56Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dragon Castle concise reference by [https://boardgamegeek.com/user/hecose hecose]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setup:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
• Board – 1 Spirit card, 1 Dragon card, fill countdown tokens &lt;br /&gt;
according to #players, extras stacked on leftmost space. &lt;br /&gt;
• Player – 1 shrine. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Concepts:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
• Available tile = at least one long side not blocked. &lt;br /&gt;
• Adjacent = orthogonally, not diagonally. Different levels OK.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Turn:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
• 1 Mandatory Action:&lt;br /&gt;
a) Take 1 tile from top floor, then exact matching tile &lt;br /&gt;
from any floor. &lt;br /&gt;
&lt;br /&gt;
b) Take 1 tile from top floor and 1 shrine. &lt;br /&gt;
&lt;br /&gt;
c) Take 1 tile from top floor, then discard facedown for &lt;br /&gt;
1VP. &lt;br /&gt;
&lt;br /&gt;
d) Summon dragon. Allowed when only floor 1 tiles left. &lt;br /&gt;
Claim rightmost countdown token (worth 2VP). Once &lt;br /&gt;
exclamation mark revealed, play until end of round.&lt;br /&gt;
 &lt;br /&gt;
• Put claimed tiles on own board, on free space or facedown &lt;br /&gt;
tile, never on faceup tile or shrine. &lt;br /&gt;
&lt;br /&gt;
• If any 4+ adjacent tiles are of same colour, must consolidate &lt;br /&gt;
by flipping facedown and scoring. &lt;br /&gt;
&lt;br /&gt;
• When consolidating, may build shrine from own pool onto &lt;br /&gt;
newly consolidated tiles. Faction(red/green/yellow) tiles allow 1 shrine, Special &lt;br /&gt;
tiles(blue/black) allow 2, Dragon tile(Purple) also gives 1VP. &lt;br /&gt;
&lt;br /&gt;
• 1 Optional Action: discard faceup tiles or shrine to activate &lt;br /&gt;
Spirit power. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Game end scoring:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
• VP tokens collected.&lt;br /&gt;
• Countdown tokens. &lt;br /&gt;
• Dragon card objective. &lt;br /&gt;
• Shrines score 1/2/3VP at floors 1/2/3+. &lt;br /&gt;
• Tiebreaker: most facedown stacks, then shrines. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Other notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
• For Spirit cards and Dragon cards, refer pages 12 – 15. &lt;br /&gt;
`&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;# of tiles / VP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
4 / 2&lt;br /&gt;
&lt;br /&gt;
5 / 3&lt;br /&gt;
&lt;br /&gt;
6 / 5&lt;br /&gt;
&lt;br /&gt;
7 / 6&lt;br /&gt;
&lt;br /&gt;
8 / 8&lt;br /&gt;
&lt;br /&gt;
&amp;gt; 8 /  +1&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3690</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3690"/>
		<updated>2019-11-25T11:45:04Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Playing a Round: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== SAINT POKER ==&lt;br /&gt;
 &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
https://docs.google.com/document/d/1xmMGI7-e_G0qN7syWGXz9bQV2PkKtZnIPPmjIPntx2E/edit?usp=sharing&lt;br /&gt;
&lt;br /&gt;
== Components required: ==&lt;br /&gt;
&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Rules: ==&lt;br /&gt;
&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules.&lt;br /&gt;
&lt;br /&gt;
The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. &lt;br /&gt;
&lt;br /&gt;
Each poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Hand Ranking Order: ==&lt;br /&gt;
&lt;br /&gt;
                          Straight flush.        Five cards in a sequence, all in the same suit.&lt;br /&gt;
                          Four of a kind.        All four cards of the same rank. e.g. 7,7,7,7&lt;br /&gt;
                          Full house.            Three of a kind with a pair. e.g. e.g. Queen,Queen,Queen,5,5&lt;br /&gt;
                          Flush.                 All 5 cards are of the same suit.&lt;br /&gt;
                          Straight.              5 cards in a sequence. e.g. 4,5,6,7,8, any mixture of suits.&lt;br /&gt;
                          Three of a kind.       Three of the same rank. e.g. 8,8,8&lt;br /&gt;
                          Two pairs.             Two pairs. e.g. Queen,Queen,5,5&lt;br /&gt;
                          High.                  None of the above, the highest card.                    	&lt;br /&gt;
	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner:                Player B wins with a straight flush: &lt;br /&gt;
                          2nd:                   Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:                   Player A comes next with a straight:                       &lt;br /&gt;
                          4th:                   Player D comes last with a (lower) straight: &lt;br /&gt;
&lt;br /&gt;
== Game Setup: ==&lt;br /&gt;
&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
&lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
&lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
&lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Playing a Round: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;River Setup Phase:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. &lt;br /&gt;
&lt;br /&gt;
This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Reveal and Score Phase&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. &lt;br /&gt;
&lt;br /&gt;
The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. &lt;br /&gt;
Tie hands, the points will be split evenly (rounded up), a random pickup turn order will be determined between the tie players.&lt;br /&gt;
(e.g. 2 players tie in the 7th round, each of these players will receive 4 points).&lt;br /&gt;
&lt;br /&gt;
Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pickup&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. &lt;br /&gt;
&lt;br /&gt;
Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Repeat for 8 rounds.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The winner has the most points at the end of the game.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3614</id>
		<title>Gamehelppalace</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3614"/>
		<updated>2019-10-09T10:43:10Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Palace instructions.&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TL;DR:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player becomes the loser, everyone else wins!&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
World-wide there are many variants, this game on BGA is just one of those, specifically:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setup:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
&lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Number of players.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also a &#039;short game&#039; option for a fixed 3-cards per player, there will be a random 16 card deck, the remain cards will not be used.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exchange of cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Playing cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
&lt;br /&gt;
Cards are played into a stack, the next player must play a card at-least as high as the last card played. &lt;br /&gt;
&lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
&lt;br /&gt;
The last player remaining losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the loser with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rank order (Ace high):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Special cards and plays.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
&lt;br /&gt;
9: the immediate next player must play a &#039;&#039;&#039;lower&#039;&#039;&#039; rank card or another 9, or pick up the stack.&lt;br /&gt;
&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example of Play: (The deck is already empty, the last card played to the stack was a 2)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    PlayerA plays 2 3&#039;s.&lt;br /&gt;
    PlayerB doesn&#039;t have any cards in hand and plays from the table, 1 of the face-up 8&#039;s.&lt;br /&gt;
    PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
    PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
    PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
    PlayerC plays a face-down card, a Queen.&lt;br /&gt;
    PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;br /&gt;
    PlayerA luckily again has an empty stack and plays 2 4&#039;s.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3613</id>
		<title>Gamehelppalace</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3613"/>
		<updated>2019-10-09T10:42:34Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Palace instructions.&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TL;DR:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player becomes the loser, everyone else wins!&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
World-wide there are many variants, this game on BGA is just one of those, specifically:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setup:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
&lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Number of players.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also a &#039;short game&#039; option for a fixed 3-cards per player, there will be a 16 card deck, the remain cards will not be used.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exchange of cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Playing cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
&lt;br /&gt;
Cards are played into a stack, the next player must play a card at-least as high as the last card played. &lt;br /&gt;
&lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
&lt;br /&gt;
The last player remaining losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the loser with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rank order (Ace high):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Special cards and plays.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
&lt;br /&gt;
9: the immediate next player must play a &#039;&#039;&#039;lower&#039;&#039;&#039; rank card or another 9, or pick up the stack.&lt;br /&gt;
&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example of Play: (The deck is already empty, the last card played to the stack was a 2)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    PlayerA plays 2 3&#039;s.&lt;br /&gt;
    PlayerB doesn&#039;t have any cards in hand and plays from the table, 1 of the face-up 8&#039;s.&lt;br /&gt;
    PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
    PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
    PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
    PlayerC plays a face-down card, a Queen.&lt;br /&gt;
    PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;br /&gt;
    PlayerA luckily again has an empty stack and plays 2 4&#039;s.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3611</id>
		<title>Gamehelppalace</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3611"/>
		<updated>2019-10-04T09:52:16Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Palace instructions.&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TL;DR:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player becomes the loser, everyone else wins!&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
World-wide there are many variants, this game on BGA is just one of those, specifically:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setup:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
&lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Number of players.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also a &#039;short game&#039; option for a fixed 3-cards per players, some cards will be removed from the deck according to the number of players.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exchange of cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Playing cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
&lt;br /&gt;
Cards are played into a stack, the next player must play a card at-least as high as the last card played. &lt;br /&gt;
&lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
&lt;br /&gt;
The last player remaining losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the loser with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rank order (Ace high):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Special cards and plays.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
&lt;br /&gt;
9: the immediate next player must play a &#039;&#039;&#039;lower&#039;&#039;&#039; rank card or another 9, or pick up the stack.&lt;br /&gt;
&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example of Play: (The deck is already empty, the last card played to the stack was a 2)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    PlayerA plays 2 3&#039;s.&lt;br /&gt;
    PlayerB doesn&#039;t have any cards in hand and plays from the table, 1 of the face-up 8&#039;s.&lt;br /&gt;
    PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
    PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
    PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
    PlayerC plays a face-down card, a Queen.&lt;br /&gt;
    PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;br /&gt;
    PlayerA luckily again has an empty stack and plays 2 4&#039;s.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3610</id>
		<title>Gamehelppalace</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3610"/>
		<updated>2019-10-04T09:49:50Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Palace instructions.&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TL;DR:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player becomes the loser, everyone else wins!&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
World-wide there are many variants, this game on BGA is just one of those, specifically:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setup:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
&lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Number of players.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also a &#039;short game&#039; option for a fixed 3-cards per players, some cards will be removed from the deck according to the number of players.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exchange of cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Playing cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
&lt;br /&gt;
Cards are played into a stack, the next player must play a card at-least as high as the last card played. &lt;br /&gt;
&lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
&lt;br /&gt;
The last player remaining losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the loser with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rank order (Ace high):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Special cards and plays.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
&lt;br /&gt;
9: the immediate next player must play a &#039;&#039;&#039;lower&#039;&#039;&#039; rank card or another 9, or pick up the stack.&lt;br /&gt;
&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example of Play: (The deck is already empty)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    PlayerA plays 2 3&#039;s.&lt;br /&gt;
    PlayerB doesn&#039;t have any cards in hand and plays from the table, 1 of the face-up 8&#039;s.&lt;br /&gt;
    PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
    PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
    PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
    PlayerC plays a face-down card, a Queen.&lt;br /&gt;
    PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;br /&gt;
    PlayerA luckily again has an empty stack and plays 2 4&#039;s.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3609</id>
		<title>Gamehelppalace</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3609"/>
		<updated>2019-10-04T09:42:39Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Palace instructions.&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TL;DR:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player becomes the loser, everyone else wins!&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
World-wide there are many variants, this game on BGA is just one of those, specifically:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Setup:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
&lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Number of players.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also a &#039;short game&#039; option for a fixed 3-cards per players, some cards will be removed from the deck according to the number of players.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exchange of cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Playing cards:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
&lt;br /&gt;
Cards are played into a stack, the next player must play a card at-least as high as the last card played. &lt;br /&gt;
&lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
&lt;br /&gt;
The last player remaining losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the loser with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rank order (Ace high):&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Special cards and plays.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
&lt;br /&gt;
9: the immediate next player must play a [b]lower[/b] rank card or another 9, or pick up the stack.&lt;br /&gt;
&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example of Play: (The deck is already empty)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    PlayerA plays 2 3&#039;s.&lt;br /&gt;
    PlayerB doesn&#039;t have any cards in hand and plays from the table, 1 of the face-up 8&#039;s.&lt;br /&gt;
    PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
    PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
    PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
    PlayerC plays a face-down card, a Queen.&lt;br /&gt;
    PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3608</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3608"/>
		<updated>2019-10-04T09:26:08Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== SAINT POKER ==&lt;br /&gt;
 &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
https://docs.google.com/document/d/1xmMGI7-e_G0qN7syWGXz9bQV2PkKtZnIPPmjIPntx2E/edit?usp=sharing&lt;br /&gt;
&lt;br /&gt;
== Components required: ==&lt;br /&gt;
&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Rules: ==&lt;br /&gt;
&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules.&lt;br /&gt;
&lt;br /&gt;
The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. &lt;br /&gt;
&lt;br /&gt;
Each poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Hand Ranking Order: ==&lt;br /&gt;
&lt;br /&gt;
                          Straight flush.        Five cards in a sequence, all in the same suit.&lt;br /&gt;
                          Four of a kind.        All four cards of the same rank. e.g. 7,7,7,7&lt;br /&gt;
                          Full house.            Three of a kind with a pair. e.g. e.g. Queen,Queen,Queen,5,5&lt;br /&gt;
                          Flush.                 All 5 cards are of the same suit.&lt;br /&gt;
                          Straight.              5 cards in a sequence. e.g. 4,5,6,7,8, any mixture of suits.&lt;br /&gt;
                          Three of a kind.       Three of the same rank. e.g. 8,8,8&lt;br /&gt;
                          Two pairs.             Two pairs. e.g. Queen,Queen,5,5&lt;br /&gt;
                          High.                  None of the above, the highest card.                    	&lt;br /&gt;
	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner:                Player B wins with a straight flush: &lt;br /&gt;
                          2nd:                   Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:                   Player A comes next with a straight:                       &lt;br /&gt;
                          4th:                   Player D comes last with a (lower) straight: &lt;br /&gt;
&lt;br /&gt;
== Game Setup: ==&lt;br /&gt;
&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
&lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
&lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
&lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Playing a Round: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;River Setup Phase:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. &lt;br /&gt;
&lt;br /&gt;
This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Reveal and Score Phase&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. &lt;br /&gt;
&lt;br /&gt;
The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. Tie hands, a random winner will be determined. &lt;br /&gt;
&lt;br /&gt;
Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pickup&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. &lt;br /&gt;
&lt;br /&gt;
Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Repeat for 8 rounds.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The winner has the most points at the end of the game.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3607</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3607"/>
		<updated>2019-10-04T09:19:54Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== SAINT POKER ==&lt;br /&gt;
 &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
https://docs.google.com/document/d/1xmMGI7-e_G0qN7syWGXz9bQV2PkKtZnIPPmjIPntx2E/edit?usp=sharing&lt;br /&gt;
&lt;br /&gt;
== Components required: ==&lt;br /&gt;
&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Rules: ==&lt;br /&gt;
&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules.&lt;br /&gt;
&lt;br /&gt;
The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. &lt;br /&gt;
&lt;br /&gt;
Each poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Hand Ranking Order: ==&lt;br /&gt;
&lt;br /&gt;
* Straight flush.  			Five cards in a sequence, all in the same suit.&lt;br /&gt;
* Four of a kind. 			All four cards of the same rank. e.g. 7,7,7,7&lt;br /&gt;
* Full house.  			        Three of a kind with a pair. e.g. e.g. Queen,Queen,Queen,5,5&lt;br /&gt;
* Flush.				All 5 cards are of the same suit.&lt;br /&gt;
* Straight. 		 		e.g. 4,5,6,7,8, any mixture of suits.&lt;br /&gt;
* Three of a kind. 			Three of the same rank. e.g. 8,8,8&lt;br /&gt;
* Two pairs. 		  		Two pairs. e.g. Queen,Queen,5,5&lt;br /&gt;
* High.			                None of the above, the highest card.                    	&lt;br /&gt;
	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner: 	Player B wins with a straight flush: &lt;br /&gt;
                          2nd:		Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:		Player A comes next with a straight:                       &lt;br /&gt;
                          4th: 		Player D comes last with a (lower) straight: &lt;br /&gt;
&lt;br /&gt;
== Game Setup: ==&lt;br /&gt;
&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
&lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
&lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
&lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Playing a Round: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;River Setup Phase:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. &lt;br /&gt;
&lt;br /&gt;
This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Reveal and Score Phase&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. &lt;br /&gt;
&lt;br /&gt;
The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. Tie hands, a random winner will be determined. &lt;br /&gt;
&lt;br /&gt;
Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pickup&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. &lt;br /&gt;
&lt;br /&gt;
Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Repeat for 8 rounds.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The winner has the most points at the end of the game.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3606</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3606"/>
		<updated>2019-10-04T09:17:52Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://docs.google.com/document/d/1xmMGI7-e_G0qN7syWGXz9bQV2PkKtZnIPPmjIPntx2E/edit?usp=sharing&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SAINT POKER&#039;&#039;&#039; &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Components required: ==&lt;br /&gt;
&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Rules: ==&lt;br /&gt;
&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules.&lt;br /&gt;
&lt;br /&gt;
The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. &lt;br /&gt;
&lt;br /&gt;
Each poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Hand Ranking Order: ==&lt;br /&gt;
&lt;br /&gt;
* Straight flush.  			Five cards in a sequence, all in the same suit.&lt;br /&gt;
* Four of a kind. 			All four cards of the same rank. e.g. 7,7,7,7&lt;br /&gt;
* Full house.  			        Three of a kind with a pair. e.g. e.g. Queen,Queen,Queen,5,5&lt;br /&gt;
* Flush.				All 5 cards are of the same suit.&lt;br /&gt;
* Straight. 		 		e.g. 4,5,6,7,8, any mixture of suits.&lt;br /&gt;
* Three of a kind. 			Three of the same rank. e.g. 8,8,8&lt;br /&gt;
* Two pairs. 		  		Two pairs. e.g. Queen,Queen,5,5&lt;br /&gt;
* High.			                None of the above, the highest card.                    	&lt;br /&gt;
	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner: 	Player B wins with a straight flush: &lt;br /&gt;
                          2nd:		Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:		Player A comes next with a straight:                       &lt;br /&gt;
                          4th: 		Player D comes last with a (lower) straight: &lt;br /&gt;
&lt;br /&gt;
== Game Setup: ==&lt;br /&gt;
&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
&lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
&lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
&lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Playing a Round: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;River Setup Phase:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. &lt;br /&gt;
&lt;br /&gt;
This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Reveal and Score Phase&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. &lt;br /&gt;
&lt;br /&gt;
The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. Tie hands, a random winner will be determined. &lt;br /&gt;
&lt;br /&gt;
Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pickup&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. &lt;br /&gt;
&lt;br /&gt;
Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Repeat for 8 rounds.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The winner has the most points at the end of the game.&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3605</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3605"/>
		<updated>2019-10-03T22:19:24Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://docs.google.com/document/d/1xmMGI7-e_G0qN7syWGXz9bQV2PkKtZnIPPmjIPntx2E/edit?usp=sharing&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SAINT POKER&#039;&#039;&#039; &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Components required: ==&lt;br /&gt;
&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Rules: ==&lt;br /&gt;
&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules. The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. Each players poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Hand Ranking Order: ==&lt;br /&gt;
&lt;br /&gt;
* Straight flush.  			Five cards in a sequence, all in the same suit.&lt;br /&gt;
* Four of a kind. 			All four cards of the same rank.&lt;br /&gt;
* Full house.  			Three of a kind with a pair.&lt;br /&gt;
* Flush.				Same suit.&lt;br /&gt;
* Straight. 		 		e.g. 4,5,6,7,8, any mixture of suits.&lt;br /&gt;
* Three of a kind. 			Three of the same number.&lt;br /&gt;
* Two pairs. 		  		Two pairs.&lt;br /&gt;
* High.			        None of the above, the highest card.                    	&lt;br /&gt;
	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner: 	Player B wins with a straight flush: &lt;br /&gt;
                          2nd:		Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:		Player A comes next with a straight:                       &lt;br /&gt;
                          4th: 		Player D comes last with a (lower) straight: &lt;br /&gt;
Game Setup:&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
Playing a Round:&lt;br /&gt;
River Setup Phase:&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
Reveal and Score Phase&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. Tie hands receive an equal share of the points, fractions are rounded up. Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
Pickup &lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
Repeat for 8 rounds.&lt;br /&gt;
&lt;br /&gt;
Notes&lt;br /&gt;
Winner has the most points at the end of the game.&lt;br /&gt;
Some hand rankings may tie, points are to be shared equally rounded up. As for the Pickup phase, the player with the most points selects last, if that is a tie then the youngest player picks up first.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3604</id>
		<title>Gamehelppalace</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppalace&amp;diff=3604"/>
		<updated>2019-10-03T15:54:45Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: Created page with &amp;quot; Palace instructions. -------------------  TL;DR ----- Go out by getting rid of all your cards in-hand and then on the table. Play higher than previous or pickup the entire st...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Palace instructions.&lt;br /&gt;
-------------------&lt;br /&gt;
&lt;br /&gt;
TL;DR&lt;br /&gt;
-----&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
------------&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player becomes the loser, everyone else wins!&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
Setup:&lt;br /&gt;
------&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
Exchange of cards:&lt;br /&gt;
------------------&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
Playing cards:&lt;br /&gt;
--------------&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
Cards are played into a stack, the next player must play a card at-least as high as the last card played. &lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
The last player remaining losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the loser with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
Rank order (Ace high):&lt;br /&gt;
----------------------&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
Special cards and plays.&lt;br /&gt;
------------------------&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
9: the immediate next player must play a [b]lower[/b] rank card or another 9, or pick up the stack.&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
Example of Play: (The deck is already empty)&lt;br /&gt;
----------------&lt;br /&gt;
PlayerA plays 2 3&#039;s.&lt;br /&gt;
PlayerB doesn&#039;t have any cards in hand and plays from the table, 1 of the face-up 8&#039;s.&lt;br /&gt;
PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
PlayerC plays a face-down card, a Queen.&lt;br /&gt;
PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;br /&gt;
&lt;br /&gt;
Number of players.&lt;br /&gt;
----------------&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3603</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3603"/>
		<updated>2019-10-03T15:52:45Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
https://docs.google.com/document/d/1xmMGI7-e_G0qN7syWGXz9bQV2PkKtZnIPPmjIPntx2E/edit?usp=sharing&lt;br /&gt;
&lt;br /&gt;
SAINT POKER &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
Components required:&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
Rules:&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules. The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. Each players poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
Hand Ranking Order:	&lt;br /&gt;
•Straight flush.  			Five cards in a sequence, all in the same suit.&lt;br /&gt;
•Four of a kind. 			All four cards of the same rank.&lt;br /&gt;
•Full house.  		 		Three of a kind with a pair.&lt;br /&gt;
•Flush.			 		Same suit.&lt;br /&gt;
•Straight. 		 		any mixture of suits.&lt;br /&gt;
•Three of a kind. 			Three of the same number.&lt;br /&gt;
•Two pairs. 		  		Two pairs.&lt;br /&gt;
•High.			    	        None of the above, the highest card.                    	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner: 	Player B wins with a straight flush: &lt;br /&gt;
                          2nd:		Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:		Player A comes next with a straight:                       &lt;br /&gt;
                          4th: 		Player D comes last with a (lower) straight: &lt;br /&gt;
Game Setup:&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
Playing a Round:&lt;br /&gt;
River Setup Phase:&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
Reveal and Score Phase&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. Tie hands receive an equal share of the points, fractions are rounded up. Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
Pickup &lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
Repeat for 8 rounds.&lt;br /&gt;
&lt;br /&gt;
Notes&lt;br /&gt;
Winner has the most points at the end of the game.&lt;br /&gt;
Some hand rankings may tie, points are to be shared equally rounded up. As for the Pickup phase, the player with the most points selects last, if that is a tie then the youngest player picks up first.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3602</id>
		<title>Gamehelpsaintpoker</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpsaintpoker&amp;diff=3602"/>
		<updated>2019-10-03T15:51:19Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: Created page with &amp;quot;SAINT POKER  aka RICHMOND LASER&amp;#039;S CAXTON SHUFFLE  Players: 2-5.              Description: Loosely based on poker Texas hold &amp;#039;em poker card game but without a bidding phase. Th...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SAINT POKER &lt;br /&gt;
aka RICHMOND LASER&#039;S CAXTON SHUFFLE&lt;br /&gt;
&lt;br /&gt;
Players: 2-5.            &lt;br /&gt;
&lt;br /&gt;
Description: Loosely based on poker Texas hold &#039;em poker card game but without a bidding phase. The game is played over several rounds and has more strategic decisions to make because you have more knowledge and influence of the cards.&lt;br /&gt;
&lt;br /&gt;
Components required:&lt;br /&gt;
Standard deck of 52 cards.&lt;br /&gt;
Pen and paper for keeping score. &lt;br /&gt;
 &lt;br /&gt;
Rules:&lt;br /&gt;
At the end of each round of play, each player will make a poker hand of 5 cards according to the standard poker Texas hold&#039;em rules. The 5 cards may be made from any combination of cards in the &#039;river&#039; (the communal cards in the middle of the table) and the 2 individual cards the player has selected. Each players poker hand is then ranked to determine which player won.&lt;br /&gt;
 &lt;br /&gt;
Hand Ranking Order:	&lt;br /&gt;
•Straight flush.  			Five cards in a sequence, all in the same suit.&lt;br /&gt;
•Four of a kind. 			All four cards of the same rank.&lt;br /&gt;
•Full house.  		 		Three of a kind with a pair.&lt;br /&gt;
•Flush.			 		Same suit.&lt;br /&gt;
•Straight. 		 		any mixture of suits.&lt;br /&gt;
•Three of a kind. 			Three of the same number.&lt;br /&gt;
•Two pairs. 		  		Two pairs.&lt;br /&gt;
•High.			    	        None of the above, the highest card.                    	&lt;br /&gt;
 &lt;br /&gt;
Note 1: To settle ties for similar tricks like flushes the rank of the highest card is used. Ace high.&lt;br /&gt;
Note 2: To settle ties for tricks requiring less than 5 cards, the number rank of the &#039;kicker&#039; (the other card) is used.&lt;br /&gt;
&lt;br /&gt;
Example round:&lt;br /&gt;
&lt;br /&gt;
                          Winner: 	Player B wins with a straight flush: &lt;br /&gt;
                          2nd:		Player C has a king flush with hearts: &lt;br /&gt;
                          3rd:		Player A comes next with a straight:                       &lt;br /&gt;
                          4th: 		Player D comes last with a (lower) straight: &lt;br /&gt;
Game Setup:&lt;br /&gt;
Shuffle the deck. &lt;br /&gt;
Deal 10 cards to each player. &lt;br /&gt;
Next turn over a number of cards depending on the number of players face-up, these are the ‘Future river’ cards. &lt;br /&gt;
3 cards in a 2-player game. 2 cards for 3 players, 1 card for 4 players, 0 cards for 5 players. &lt;br /&gt;
The remaining cards become the &#039;deck’.&lt;br /&gt;
&lt;br /&gt;
Playing a Round:&lt;br /&gt;
River Setup Phase:&lt;br /&gt;
Move the face up cards from the future river and place them in the middle to make the start of the current river.&lt;br /&gt;
From the deck, place face-up the same number of cards to one side to make a new future river.&lt;br /&gt;
To complete the current river, each player must select 1 card from their hand and simultaneously reveal them. This will make a total of 5 face-up cards now showing the complete current river.&lt;br /&gt;
 &lt;br /&gt;
Reveal and Score Phase&lt;br /&gt;
Each player selects 2 cards from their hand. Simultaneously players reveal their 2 cards.&lt;br /&gt;
&lt;br /&gt;
According to poker rules determine the winner order. The winner receives points equal to the current round number. So 1 point in the 1st round, 2 points in the 2nd round, etc. Everyone else receives 0 points for their hand. Tie hands receive an equal share of the points, fractions are rounded up. Keep a running total score, anyone is allowed to know the current score at any time.&lt;br /&gt;
Pickup &lt;br /&gt;
Following the reverse winning order, take a card back from either the river or any of the players revealed cards, and place it in your hand, the winner being the last to take a card. Repeat the process again so everyone picks up a total of 2 cards.&lt;br /&gt;
&lt;br /&gt;
Discard the remaining 5 cards, they will no longer be used.&lt;br /&gt;
&lt;br /&gt;
Repeat for 8 rounds.&lt;br /&gt;
&lt;br /&gt;
Notes&lt;br /&gt;
Winner has the most points at the end of the game.&lt;br /&gt;
Some hand rankings may tie, points are to be shared equally rounded up. As for the Pickup phase, the player with the most points selects last, if that is a tie then the youngest player picks up first.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=3585</id>
		<title>Stock</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=3585"/>
		<updated>2019-09-07T11:53:09Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Complete stock component reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
&#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 (a void 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;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;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;
* type: ID of the type to add. You can choose any positive integer. All item types must have distinct IDs.&lt;br /&gt;
* 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;
* 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 like this:&lt;br /&gt;
&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 = 10;&lt;br /&gt;
&amp;lt;/pre&amp;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 addressed 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;
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;removeFromStock( type, to )&#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;
&amp;quot;to&amp;quot; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeFromStockById( id, to )&#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;
&amp;quot;to&amp;quot; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.&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;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;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;
&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;
&#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;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). You can override this class in the css file for your game.&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;
&#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;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;
&#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;
&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;
== 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.&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;.&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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=3584</id>
		<title>Stock</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=3584"/>
		<updated>2019-09-07T11:51:42Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Complete stock component reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
&#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 (a void 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;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;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;
* type: ID of the type to add. You can choose any positive integer. All item types must have distinct IDs.&lt;br /&gt;
* 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;
* 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 like this:&lt;br /&gt;
&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 = 10;&lt;br /&gt;
&amp;lt;/pre&amp;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 addressed 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;
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;removeFromStock( type, to )&#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;
&amp;quot;to&amp;quot; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeFromStockById( id, to )&#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;
&amp;quot;to&amp;quot; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.&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;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;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;
&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;
&#039;&#039;&#039;centerItems&#039;&#039;&#039;&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;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). You can override this class in the css file for your game.&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;
&#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;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;
&#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;
&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;
== 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.&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;.&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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpoutlaws&amp;diff=3555</id>
		<title>Gamehelpoutlaws</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpoutlaws&amp;diff=3555"/>
		<updated>2019-08-15T09:31:37Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== 2 Actions per Turn: ===&lt;br /&gt;
&lt;br /&gt;
During their turn, each player may perform two actions before passing to their opponent.&lt;br /&gt;
There are four actions available and players may perform the same action twice in one turn.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;1. Move&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Take two of your characters from Main Street, without revealing them, and exchange their positions (or not). If you wish to move a character from the saloon you may take the character in question and two other characters from Main Street.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Leaving the Saloon:&#039;&#039;&#039; If a player wishes to move a character from the Saloon, they first take that character and two other characters from the Main Street. They then move these three characters as per the rules of a normal move, placing one back into the Saloon and two on the Main Street.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Saloon:&#039;&#039;&#039; The Saloon is a space located to one side of the Main Street and contains two characters.&lt;br /&gt;
These characters are always visible to both players, and they may not be interacted with while located there. Any character may enter the Saloon with the exception of the Governor, as a man of his standing would never be seen in such an establishment!&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;2. Look at a Token&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Reveal one of your characters to your opponent. You may then look at the token located in front of that character, keeping its identity to yourself.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;3. Take a Token&#039;&#039;&#039;&lt;br /&gt;
Reveal one of your characters before Calling Out the identity of the token in front of that character. Reveal that token. If it corresponds to the type stated then you may take that token.&lt;br /&gt;
&lt;br /&gt;
If the token is not the type announced, or it&#039;s a Bogus Token (Black X) then it is placed face down in its original position. &lt;br /&gt;
&lt;br /&gt;
Only certain characters may pick up certain tokens:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Votes&#039;&#039;&#039; may be picked up by anyone except the Governor. [6 Vote Tokens]&lt;br /&gt;
* &#039;&#039;&#039;Handcuffs&#039;&#039;&#039; may only be picked up by the Sheriff [3 Handcuff Tokens]&lt;br /&gt;
* &#039;&#039;&#039;Bullets&#039;&#039;&#039; may only be picked up by the Hitman [3 Bullet Tokens]&lt;br /&gt;
* The &#039;&#039;&#039;Election&#039;&#039;&#039; token may only be picked up by the Governor [1 Election Token]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Replacing Tokens:&#039;&#039;&#039; After taking a token, the line of tokens slides away from the reserve and a new token is placed at the end of the row.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;4. Use an Ability&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may reveal a character to immediately use their ability.&lt;br /&gt;
Each character’s ability is unique and some may only be used in specific circumstances.&lt;br /&gt;
&lt;br /&gt;
=== Character Abilities ===&lt;br /&gt;
*&#039;&#039;&#039;The Governor&#039;&#039;&#039; – Reveal the Governor to pick up the Election token if his faction possesses more Vote tokens than his opponent’s.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Hitman&#039;&#039;&#039; – Reveal the Hitman and discard one Bullet token to reveal the character across from him. If it is the Governor you successfully assassinate him. If it is any other character the assassination fails. The Bullet token remains discarded and both characters are turned back around.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Sheriff&#039;&#039;&#039; - Reveal the Sheriff, discard one Handcuff token, and Call Out either the Hitman or the Bandit to reveal the character across from him. If you correctly Call Out the Hitman you arrest him. If you correctly Call Out the Bandit then he is immobilized and you may recover your Handcuff token from the discard pile. If the Call Out is incorrect, the arrest fails. The Handcuff token remains discarded and both characters are turned back around.&lt;br /&gt;
&lt;br /&gt;
Additionally, if your Sheriff is adjacent to the Governor when a Hitman assassinates him, you may discard a Handcuff token to save the Governor and arrest the Hitman.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Immobilized:&#039;&#039;&#039; When a character is immobilized, they remain revealed and in place. An immobilized character may not move, be moved,&lt;br /&gt;
be activated or use their abilities in any way.&lt;br /&gt;
This effect may be cancelled by other characters. When cancelled, turn the character back around. That character may now act normally.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Indian&#039;&#039;&#039; – Reveal the Indian to reveal the character opposite him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Storekeep&#039;&#039;&#039; – Reveal the Storekeep to switch the position of two of the three tokens adjacent (opposite and diagonal) to him, or swap one of the three tokens adjacent to him with one from the supply.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Dancer&#039;&#039;&#039; – Reveal the Dancer to choose one of the two characters to the left or one of the two characters to the right of the character opposite her. Place that character in front of the Dancer, sliding the others one space over in the appropriate direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Reporter&#039;&#039;&#039; – Reveal the Reporter and Call Out a character to reveal the character opposite him. If you correctly Call Out the revealed character, take a Headline marker and mark that character’s card. For the rest of the game that character must remain revealed. If the Call Out is incorrect, discard one Headline marker. You may not attempt to perform this action if you have no Headline markers left.  The Reporter may never Call Out the Governor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Bandit&#039;&#039;&#039; – Reveal the Bandit and Call Out either the Hitman or the Sheriff to reveal the character opposite him. If you correctly Call Out the Hitman, take a Bullet token from your opponent&#039;s stash. If you correctly Call Out the Sheriff, take a Handcuff token from your opponent&#039;s stash. If the Call Out is incorrect, the action has no effect and both characters are turned back around.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Reverend&#039;&#039;&#039; – After revealing the Reverend, if there is an immobilized Bandit immediately to his left, cancel the immobilized effect.&lt;br /&gt;
&lt;br /&gt;
Additionally, if the Bandit is immobilized or the Hitman is arrested by the Sheriff immediately to the left of the Reverend, you may reveal the Reverend to cancel the effect. Your opponent&#039;s Handcuff token remains discarded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;The Mayor&#039;&#039;&#039; – When revealing a character immediately to the right of the Mayor in order to use their ability, you may also reveal the Mayor to increase the range of that character&#039;s ability by 1.  Abilities that targeted the character opposite may now target those immediately adjacent to them instead, and the Storekeep has a choice of two of the five tokens adjacent to him. This ability may not be used in conjunction with the Hitman, Dancer or Bandit.&lt;br /&gt;
&lt;br /&gt;
===Winning the game:===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Good Way&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Your Governor reveals and takes the Election token.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Bad Way&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Your Hitman successfully assassinates your opponent’s Governor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Ugly Way&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Your Sheriff successfully arrests your opponent’s Hitman.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sudden Death&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It may happen that it is not possible for either player to win the game (both players have 3 votes and all 6 Bullet and Handcuff Tokens have been used). &lt;br /&gt;
As soon as the last of these tokens has been claimed/used, take the three bullet tokens, the three Handcuff tokens, and two Bogus tokens. Shuffle them together and place them randomly in the Main Street.  Continue playing until either a Bad or Ugly victory has been achieved!&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelpidiot&amp;diff=3418</id>
		<title>Gamehelpidiot</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelpidiot&amp;diff=3418"/>
		<updated>2019-04-05T16:46:26Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: Created page with &amp;quot; Idiot instructions. -------------------  TL;DR ----- Go out by getting rid of all your cards in-hand and then on the table. Play higher than previous or pickup the entire sta...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Idiot instructions.&lt;br /&gt;
-------------------&lt;br /&gt;
&lt;br /&gt;
TL;DR&lt;br /&gt;
-----&lt;br /&gt;
Go out by getting rid of all your cards in-hand and then on the table.&lt;br /&gt;
Play higher than previous or pickup the entire stack.&lt;br /&gt;
a 2 goes on anything, a 10 burns, a 9 means you have to go lower.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Description:&lt;br /&gt;
------------&lt;br /&gt;
2-4 players, played with a standard deck of 52 cards. &lt;br /&gt;
The idea of the game is to get rid of all your cards before the last player.&lt;br /&gt;
The last player loses and becomes the Idiot.&lt;br /&gt;
This is a very quick, fun game with an element of luck and skill.&lt;br /&gt;
&lt;br /&gt;
Setup:&lt;br /&gt;
------&lt;br /&gt;
For a 4-Player game, each player is dealt 3 cards face-down and then 3 cards face-up placed ontop. &lt;br /&gt;
The cards face-down remain secret from all players, do not look at them until the final stage of the game.&lt;br /&gt;
Each player is then dealt 3 more cards for their playing hand. The remaining cards make the draw deck.&lt;br /&gt;
&lt;br /&gt;
Exchange of cards:&lt;br /&gt;
------------------&lt;br /&gt;
Players may now exchange cards from their hand with the face-up cards on the table as they see fit.&lt;br /&gt;
When everyone is finished play proceeds.&lt;br /&gt;
&lt;br /&gt;
Playing cards:&lt;br /&gt;
--------------&lt;br /&gt;
The game randomly picks a player with the lowest card in their hand. (3 and above, not a 2) and must start with that card.&lt;br /&gt;
Cards are played into a stack, the next player must play a card atleast as high as the last card played. &lt;br /&gt;
If a player cannot (or does not want to) play a card they must pick up the complete played stack so far (all the cards previously played), play immediately proceeds to the next player.&lt;br /&gt;
While there are cards in the draw deck, players refill their hand up to 3 cards.&lt;br /&gt;
Once the draw deck is empty and then the players hand is empty, a player then moves onto playing face-up cards from the table.&lt;br /&gt;
Once the face-up cards have all been played, a player must play a single face-down card.&lt;br /&gt;
Only at the point of playing a face-down card will you know if it is a legal play or not. If it is an illegal play then take this card and pick up the stack into your hand.&lt;br /&gt;
If at any point a player has to pick up cards, they forfeit playing any cards for their turn, but in future turns must play all these cards in their hand before resuming playing the table cards.&lt;br /&gt;
Once a player has played all their table cards and all the cards from their hand they are out! Play continues with the remaining players.&lt;br /&gt;
The last player remaining is the idiot and losses! The rest of the players can take solitude in the fact they are far superior&lt;br /&gt;
and start to mock the idiot with raucous laughter, friendly insults, finger pointing and a far too generous pat on the back.&lt;br /&gt;
&lt;br /&gt;
A single play is not limited to just a single card, if a player has multiple exact rank value cards they may play any or all of those cards. This can be done from your hand or the face-up table cards, but not both at the same time.&lt;br /&gt;
For example 2 Jacks, or 4 Kings.&lt;br /&gt;
&lt;br /&gt;
Rank order (Ace high):&lt;br /&gt;
----------------------&lt;br /&gt;
2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace.&lt;br /&gt;
&lt;br /&gt;
Special cards and plays.&lt;br /&gt;
------------------------&lt;br /&gt;
A few of the cards listed below have special rules associated with them:&lt;br /&gt;
&lt;br /&gt;
2: maybe played on ANY rank card.&lt;br /&gt;
9: the immediate next player must play a [b]lower[/b] rank card or another 9, or pick up the stack.&lt;br /&gt;
10: burn the stack of cards and remove them from the game, the player is also granted an additional turn.&lt;br /&gt;
4 cards of the same value. No matter who plays the cards, the player to play the 4th card will burn the stack and is granted an additional turn.&lt;br /&gt;
&lt;br /&gt;
Example of Play: (The deck is already empty)&lt;br /&gt;
----------------&lt;br /&gt;
PlayerA plays 2 3&#039;s.&lt;br /&gt;
PlayerB doesn&#039;t have any cards in hand and plays from the tabel, 1 of the face-up 8&#039;s.&lt;br /&gt;
PlayerC plays 3 more 8&#039;s and burns all the cards in the stack and is granted an additional turn.&lt;br /&gt;
PlayerC plays 4 6&#039;s and burns all the cards in the stack and is granted yet another additional turn. PlayerC has no more cards remaining in her hand.&lt;br /&gt;
PlayerC plays 3 face-up 10&#039;s, again this burns the stack.&lt;br /&gt;
PlayerC plays a face-down card, a Queen.&lt;br /&gt;
PlayerD cannot play (only has a 9 and 10 in hand) and picks up the stack. (luckily it&#039;s just a Queen)&lt;br /&gt;
&lt;br /&gt;
Number of players.&lt;br /&gt;
----------------&lt;br /&gt;
In a 4 player game, players have 3 cards. (3 facedown and 3 faceup, and 3 cards in hand, and draws from the deck when lower than 3).&lt;br /&gt;
In a 3 player game, players have 4 cards instead of 3 as described above. (4 facedown and 4 faceup, and 4 cards in hand, and draws from the deck when lower than 4).&lt;br /&gt;
In a 2 player game, players have 6 cards instead of 3 as described above. (6 facedown and 6 faceup, and 6 cards in hand, and draws from the deck when lower than 6).&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=3417</id>
		<title>Stock</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Stock&amp;diff=3417"/>
		<updated>2019-04-05T11:15:38Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Complete stock component reference */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
&#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 (a void 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;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;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;
* type: ID of the type to add. You can choose any positive integer. All item types must have distinct IDs.&lt;br /&gt;
* 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;
* 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 like this:&lt;br /&gt;
&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 = 10;&lt;br /&gt;
&amp;lt;/pre&amp;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 addressed 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;
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;removeFromStock( type, to )&#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;
&amp;quot;to&amp;quot; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;removeFromStockById( id, to )&#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;
&amp;quot;to&amp;quot; is an optional parameter. If &amp;quot;to&amp;quot; contains the ID of an HTML element, the item removed from the stock is slided to this HTML element before it disappear.&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;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;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;
&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;
&#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). You can override this class in the css file for your game.&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 )&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;
Note: 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;
&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;
&#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;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;
&#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;
&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;
== 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.&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;.&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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3416</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3416"/>
		<updated>2019-04-05T10:41:28Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Debugging my Javascript game interface logic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
=== 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 Debugger ===&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;
debugger; &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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3415</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3415"/>
		<updated>2019-04-05T10:40:27Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Online format checkers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
== 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 Debugger ===&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;
debugger; &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;
&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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3414</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3414"/>
		<updated>2019-04-05T10:39:20Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Online format checkers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
== 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 Debugger ===&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;
debugger; &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;
&lt;br /&gt;
== Online format checkers ==&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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3413</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3413"/>
		<updated>2019-04-05T10:38:41Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Online format checkers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
== 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 Debugger ===&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;
debugger; &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;
&lt;br /&gt;
== Online format checkers ==&lt;br /&gt;
PHP: [https://phpcodechecker.com/ https://phpcodechecker.com/]&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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3412</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3412"/>
		<updated>2019-04-05T10:37:27Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
== 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 Debugger ===&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;
debugger; &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;
&lt;br /&gt;
== Online format checkers ==&lt;br /&gt;
PHP: [https://phpcodechecker.com/]&lt;br /&gt;
JS:  [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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3411</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3411"/>
		<updated>2019-04-05T10:34:20Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Use Debugger */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
== 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 Debugger ===&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;
debugger; &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;
== 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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3410</id>
		<title>Practical debugging</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Practical_debugging&amp;diff=3410"/>
		<updated>2019-04-05T10:33:40Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Use Debugger */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
== 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;
== 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 Debugger ===&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 line to your .js file&lt;br /&gt;
&lt;br /&gt;
debugger; &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;
== 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;
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;
* 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;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3356</id>
		<title>Gamehelptablut</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3356"/>
		<updated>2019-02-10T21:05:35Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Captures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
Tablut is an abstract tactical game for 2 players.&lt;br /&gt;
&lt;br /&gt;
Original Rules: [[http://www.stmoroky.com/games/tablut/tabrules.htm]]&lt;br /&gt;
&lt;br /&gt;
It is played on a 9 per 9 tiled board. There are 16 black pawns, called Muscovites, 8 white pawns, the Swedes, and a special white pawn, the Swedish king.&lt;br /&gt;
&lt;br /&gt;
Players take turns, moving a single pawn of their color each time.&lt;br /&gt;
&lt;br /&gt;
The initial setup looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_board_screenshot.png]]&lt;br /&gt;
&lt;br /&gt;
= Objective of the game =&lt;br /&gt;
For the player with the black pawns, the Muscovites, the goal is to encircle the king in order to capture him.&lt;br /&gt;
&lt;br /&gt;
For the player with the white pawns, the Swedes, the goal his to bring the king on any tile of the corner of the board.&lt;br /&gt;
&lt;br /&gt;
= Moves =&lt;br /&gt;
All pawns move like the tower in chess: horizontally or vertically of any number of tiles.&lt;br /&gt;
&lt;br /&gt;
= Throne =&lt;br /&gt;
The king starting positions is &#039;&#039;&#039;throne&#039;&#039;&#039;:&lt;br /&gt;
Only the king may occupy the throne and the corner squares.&lt;br /&gt;
 &lt;br /&gt;
Other pieces may pass through the throne when it is unoccupied, but may not stop there.&lt;br /&gt;
&lt;br /&gt;
= Captures =&lt;br /&gt;
A pawn is captured, and hence removed from the board, when surrounded by 2 enemy pawns on opposite neighbour tiles :&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_soldier_capture.png]]&lt;br /&gt;
&lt;br /&gt;
A coner can be used like a enemy to capture a pawn.&lt;br /&gt;
However, a pawn willingly moving between 2 enemy pawns does not get captured.&lt;br /&gt;
&lt;br /&gt;
The king is special in regard to capture: 2 Muscovites are not enough to eliminate him,&lt;br /&gt;
he must be encircled on all his 4 neighbour tiles, or with 3 Muscovites and throne or Edge or with 2 Muscovites, one Edge and a corner.&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_king_capture.png]] &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; [[File:KingCapture.png]]&lt;br /&gt;
&lt;br /&gt;
The king may not participate in captures.&lt;br /&gt;
&lt;br /&gt;
= Variant: King exits on the rim =&lt;br /&gt;
Like all tafl games, tablut has many variants.&lt;br /&gt;
&lt;br /&gt;
In this variant, the goal of the king is now to reach any square on the rim.&lt;br /&gt;
All the Muscovites start on the fortress and the king starts on the throne. &lt;br /&gt;
The Muscovites can get out of the fortress squares but never get back in again.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3355</id>
		<title>Gamehelptablut</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3355"/>
		<updated>2019-02-10T21:05:02Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Captures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
Tablut is an abstract tactical game for 2 players.&lt;br /&gt;
&lt;br /&gt;
Original Rules: [[http://www.stmoroky.com/games/tablut/tabrules.htm]]&lt;br /&gt;
&lt;br /&gt;
It is played on a 9 per 9 tiled board. There are 16 black pawns, called Muscovites, 8 white pawns, the Swedes, and a special white pawn, the Swedish king.&lt;br /&gt;
&lt;br /&gt;
Players take turns, moving a single pawn of their color each time.&lt;br /&gt;
&lt;br /&gt;
The initial setup looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_board_screenshot.png]]&lt;br /&gt;
&lt;br /&gt;
= Objective of the game =&lt;br /&gt;
For the player with the black pawns, the Muscovites, the goal is to encircle the king in order to capture him.&lt;br /&gt;
&lt;br /&gt;
For the player with the white pawns, the Swedes, the goal his to bring the king on any tile of the corner of the board.&lt;br /&gt;
&lt;br /&gt;
= Moves =&lt;br /&gt;
All pawns move like the tower in chess: horizontally or vertically of any number of tiles.&lt;br /&gt;
&lt;br /&gt;
= Throne =&lt;br /&gt;
The king starting positions is &#039;&#039;&#039;throne&#039;&#039;&#039;:&lt;br /&gt;
Only the king may occupy the throne and the corner squares.&lt;br /&gt;
 &lt;br /&gt;
Other pieces may pass through the throne when it is unoccupied, but may not stop there.&lt;br /&gt;
&lt;br /&gt;
= Captures =&lt;br /&gt;
A pawn is captured, and hence removed from the board, when surrounded by 2 enemy pawns on opposite neighbour tiles :&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_soldier_capture.png]]&lt;br /&gt;
&lt;br /&gt;
A coner can be used like a enemy to capture a pawn.&lt;br /&gt;
However, a pawn willingly moving between 2 enemy pawns does not get captured.&lt;br /&gt;
&lt;br /&gt;
The king is special in regard to capture: 2 Muscovites are not enough to eliminate him,&lt;br /&gt;
he must be encircled on all his 4 neighbour tiles, or with 3 Muscovites and throne or Edge or with 2 Muscovites, one Edge and a corner.&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_king_capture.png]] [[File:KingCapture.png]]&lt;br /&gt;
&lt;br /&gt;
The king may not participate in captures.&lt;br /&gt;
&lt;br /&gt;
= Variant: King exits on the rim =&lt;br /&gt;
Like all tafl games, tablut has many variants.&lt;br /&gt;
&lt;br /&gt;
In this variant, the goal of the king is now to reach any square on the rim.&lt;br /&gt;
All the Muscovites start on the fortress and the king starts on the throne. &lt;br /&gt;
The Muscovites can get out of the fortress squares but never get back in again.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=File:KingCapture.png&amp;diff=3354</id>
		<title>File:KingCapture.png</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=File:KingCapture.png&amp;diff=3354"/>
		<updated>2019-02-10T21:04:22Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3353</id>
		<title>Gamehelptablut</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3353"/>
		<updated>2019-02-10T20:38:53Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
Tablut is an abstract tactical game for 2 players.&lt;br /&gt;
&lt;br /&gt;
Original Rules: [[http://www.stmoroky.com/games/tablut/tabrules.htm]]&lt;br /&gt;
&lt;br /&gt;
It is played on a 9 per 9 tiled board. There are 16 black pawns, called Muscovites, 8 white pawns, the Swedes, and a special white pawn, the Swedish king.&lt;br /&gt;
&lt;br /&gt;
Players take turns, moving a single pawn of their color each time.&lt;br /&gt;
&lt;br /&gt;
The initial setup looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_board_screenshot.png]]&lt;br /&gt;
&lt;br /&gt;
= Objective of the game =&lt;br /&gt;
For the player with the black pawns, the Muscovites, the goal is to encircle the king in order to capture him.&lt;br /&gt;
&lt;br /&gt;
For the player with the white pawns, the Swedes, the goal his to bring the king on any tile of the corner of the board.&lt;br /&gt;
&lt;br /&gt;
= Moves =&lt;br /&gt;
All pawns move like the tower in chess: horizontally or vertically of any number of tiles.&lt;br /&gt;
&lt;br /&gt;
= Throne =&lt;br /&gt;
The king starting positions is &#039;&#039;&#039;throne&#039;&#039;&#039;:&lt;br /&gt;
Only the king may occupy the throne and the corner squares.&lt;br /&gt;
 &lt;br /&gt;
Other pieces may pass through the throne when it is unoccupied, but may not stop there.&lt;br /&gt;
&lt;br /&gt;
= Captures =&lt;br /&gt;
A pawn is captured, and hence removed from the board, when surrounded by 2 enemy pawns on opposite neighbour tiles :&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_soldier_capture.png]]&lt;br /&gt;
&lt;br /&gt;
A coner can be used like a enemy to capture a pawn.&lt;br /&gt;
However, a pawn willingly moving between 2 enemy pawns does not get captured.&lt;br /&gt;
&lt;br /&gt;
The king is special in regard to capture: 2 Muscovites are not enough to eliminate him,&lt;br /&gt;
he must be encircled on all his 4 neighbour tiles, or with 3 Muscovites and throne or Edge or with 2 Muscovites, one Edge and a corner.&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_king_capture.png]]&lt;br /&gt;
&lt;br /&gt;
The king may not participate in captures.&lt;br /&gt;
&lt;br /&gt;
= Variant: King exits on the rim =&lt;br /&gt;
Like all tafl games, tablut has many variants.&lt;br /&gt;
&lt;br /&gt;
In this variant, the goal of the king is now to reach any square on the rim.&lt;br /&gt;
All the Muscovites start on the fortress and the king starts on the throne. &lt;br /&gt;
The Muscovites can get out of the fortress squares but never get back in again.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3352</id>
		<title>Gamehelptablut</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3352"/>
		<updated>2019-02-10T20:36:53Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Captures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
Tablut is an abstract tactical game for 2 players.&lt;br /&gt;
&lt;br /&gt;
It is played on a 9 per 9 tiled board. There are 16 black pawns, called Muscovites, 8 white pawns, the Swedes, and a special white pawn, the Swedish king.&lt;br /&gt;
&lt;br /&gt;
Players take turns, moving a single pawn of their color each time.&lt;br /&gt;
&lt;br /&gt;
The initial setup looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_board_screenshot.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Objective of the game =&lt;br /&gt;
For the player with the black pawns, the Muscovites, the goal is to encircle the king in order to capture him.&lt;br /&gt;
&lt;br /&gt;
For the player with the white pawns, the Swedes, the goal his to bring the king on any tile of the corner of the board.&lt;br /&gt;
&lt;br /&gt;
= Moves =&lt;br /&gt;
All pawns move like the tower in chess: horizontally or vertically of any number of tiles.&lt;br /&gt;
&lt;br /&gt;
= Throne =&lt;br /&gt;
The king starting positions is &#039;&#039;&#039;throne&#039;&#039;&#039;:&lt;br /&gt;
Only the king may occupy the throne and the corner squares.&lt;br /&gt;
 &lt;br /&gt;
Other pieces may pass through the throne when it is unoccupied, but may not stop there.&lt;br /&gt;
&lt;br /&gt;
= Captures =&lt;br /&gt;
A pawn is captured, and hence removed from the board, when surrounded by 2 enemy pawns on opposite neighbour tiles :&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_soldier_capture.png]]&lt;br /&gt;
&lt;br /&gt;
A coner can be used like a enemy to capture a pawn.&lt;br /&gt;
However, a pawn willingly moving between 2 enemy pawns does not get captured.&lt;br /&gt;
&lt;br /&gt;
The king is special in regard to capture: 2 Muscovites are not enough to eliminate him,&lt;br /&gt;
he must be encircled on all his 4 neighbour tiles, or with 3 Muscovites and throne or Edge or with 2 Muscovites, one Edge and a corner.&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_king_capture.png]]&lt;br /&gt;
&lt;br /&gt;
The king may not participate in captures.&lt;br /&gt;
&lt;br /&gt;
= Variant: King exits on the rim =&lt;br /&gt;
Like all tafl games, tablut has many variants.&lt;br /&gt;
&lt;br /&gt;
In this variant, the goal of the king is now to reach any square on the rim.&lt;br /&gt;
All the Muscovites start on the fortress and the king starts on the throne. &lt;br /&gt;
The Muscovites can get out of the fortress squares but never get back in again.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Tips_battleforhill&amp;diff=3261</id>
		<title>Tips battleforhill</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Tips_battleforhill&amp;diff=3261"/>
		<updated>2018-11-04T00:57:20Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: Created page with &amp;quot;Winning 2 move combos.  AirStrike + SpecialForces.  Artillary + SpecialForces.   Strong Positions:  Surround both sides. left and right no mans land.  Strong Plays: Play to bo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Winning 2 move combos.&lt;br /&gt;
&lt;br /&gt;
AirStrike + SpecialForces.&lt;br /&gt;
&lt;br /&gt;
Artillary + SpecialForces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Strong Positions:&lt;br /&gt;
&lt;br /&gt;
Surround both sides. left and right no mans land.&lt;br /&gt;
&lt;br /&gt;
Strong Plays:&lt;br /&gt;
Play to both Left and TopLeft. For example, 2 Tanks can be played to do this.&lt;br /&gt;
&lt;br /&gt;
A Special Forces can be played to Left, this alone has support back to base. If not destroyed, can play to win Artillary + SpecialForces.&lt;br /&gt;
Similar trick can be played with the Paratroppers.&lt;br /&gt;
&lt;br /&gt;
Paratroppers behind the opponents home base, allows a Heavy Weapons on Left to destroy base and then SpecialForces.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelppolis&amp;diff=3259</id>
		<title>Gamehelppolis</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelppolis&amp;diff=3259"/>
		<updated>2018-10-30T13:21:56Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* End of the Round */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Development Actions ==&lt;br /&gt;
&lt;br /&gt;
# Create Hoplites: Only in one polis per turn; pay 1 metal (or silver) per hoplite&lt;br /&gt;
# Create Galleys: Only in one polis per turn; pay 1 wood (or silver) per galley, then place it in adjacent sea territory (see arrow).&lt;br /&gt;
# Create Merchants: Only in one commercial city per turn; pay 1 wood (or silver) per merchant, then place it in Trade Port.&lt;br /&gt;
&lt;br /&gt;
== Military Actions (cost 1 Prestige) ==&lt;br /&gt;
&lt;br /&gt;
# Move Hoplites: Destination territory of all hoplites has to be the same; each unit is moved separately (via land or sea territories, but not both); territories controlled by opponent (with greater number of units) block movement.&lt;br /&gt;
# Move Galleys: Destination territory of all galleys has to be the same; each unit is moved separately (only sea territories); territories controlled by opponent block movement.&lt;br /&gt;
# Besiege Polis: Player has to control territory with at least as many hoplites as polis has Fortification. Throw the die:&lt;br /&gt;
* If result higher than/equal to Fortification: take Polis Tile (with all projects); receive Prestige (= Fortification).&lt;br /&gt;
* If result lower than Fortification, attacker loses 1 hoplite. If polis owned by opponent, it loses 1 Population Cube.&lt;br /&gt;
# Collection: Must own polis in region. Take resources corresponding to number of hoplites from the region placed in Tribute Box. Place disk to show region exhausted and return hoplites. No Prestige cost for action in home region.&lt;br /&gt;
&lt;br /&gt;
== Political Actions ==&lt;br /&gt;
&lt;br /&gt;
# Trade: Move one merchant via free trade route to Foreign Market and place it on available shipload:&lt;br /&gt;
* Goods exchange (goods for wheat / silver); then increase market value (roll die; move marker right).&lt;br /&gt;
* Purchase (silver paid for wheat); then decrease market value (roll die twice; use higher result to move marker left).&lt;br /&gt;
# Move Proxenos: Movement via land or sea territories. Has to bribe each enemy unit with 1 silver (not to the opponent).&lt;br /&gt;
# Redeem Proxenos: Pay 2 silver to opponent; place Proxenos in capital.&lt;br /&gt;
# Instigate Civil War: Proxenos needed; action costs 2x Base Population (neutral polis) or 3x current Population (owned by opponent). Receive Prestige (= Population bribed, not amount of money spent).&lt;br /&gt;
&lt;br /&gt;
== Battle ==&lt;br /&gt;
&lt;br /&gt;
If 8 or more units in territory after player&#039;s turn. Attacker plays 2 cards, defender tries to match formations. Card pairs are then compared:&lt;br /&gt;
* not matching: defender loses 1 unit, attacker gains Prestige on card.&lt;br /&gt;
* matching: no loss for defender, attacker gains Prestige difference if his value is higher. Attacker draws 2 cards; defender draws one less card for each loss suffered (maximum 2).&lt;br /&gt;
&lt;br /&gt;
The battle ends if:&lt;br /&gt;
# not enough cards are left in the Combat Card deck.&lt;br /&gt;
# one player retreats (and pays 1 Prestige to opponent).&lt;br /&gt;
# one player has less than 2 units left.&lt;br /&gt;
&lt;br /&gt;
== End of the Round ==&lt;br /&gt;
&lt;br /&gt;
# Projects: all are completed, and award immediate Prestige.&lt;br /&gt;
# Supply: player has to pay wheat = total of Population Cubes; if insufficient, difference either paid with Prestige, or poleis are discarded.&lt;br /&gt;
# Growth: increase Population in poleis with wheat (1:1); heed Maximum Growth and Population Maximum. Optional.&lt;br /&gt;
# Megalopolis: 1 Prestige awarded for every polis exceeding Base Population.&lt;br /&gt;
# Storage: halve amount of oil, wine, and wheat in storage (rounded up). E.G. originally you have: 3 oil, 5 wine and 7 wheat and afterwards: 2 oil, 3 wine and 4 wheat.&lt;br /&gt;
# Phoros: exchange Prestige for silver (1:1). Optional.&lt;br /&gt;
&lt;br /&gt;
== Preparations for the next Round ==&lt;br /&gt;
&lt;br /&gt;
Move round marker one space to the right. Remove all discs from Tribute Boxes. Place merchants back in Trade Ports. Place 3 new Project Tiles (discard remaining tiles). Draw new Event Card.&lt;br /&gt;
&lt;br /&gt;
== End of Game Conditions ==&lt;br /&gt;
&lt;br /&gt;
# A player cannot supply enough wheat/Prestige to feed his capital.&lt;br /&gt;
# A player does not have any Prestige left after “End of Round” phase.&lt;br /&gt;
# The fourth round (5β) has been finished.&lt;br /&gt;
&lt;br /&gt;
== Final Score ==&lt;br /&gt;
&lt;br /&gt;
* total of Population Cubes in all poleis, plus&lt;br /&gt;
* current Prestige, plus&lt;br /&gt;
* ”Prestige for Posterity” (on project tiles).&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
	<entry>
		<id>https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3205</id>
		<title>Gamehelptablut</title>
		<link rel="alternate" type="text/html" href="https://en.doc.boardgamearena.com/index.php?title=Gamehelptablut&amp;diff=3205"/>
		<updated>2018-09-26T12:57:54Z</updated>

		<summary type="html">&lt;p&gt;Ricardorix: /* Objective of the game */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Description =&lt;br /&gt;
Tablut is an abstract tactical game for 2 players.&lt;br /&gt;
&lt;br /&gt;
It is played on a 9 per 9 tiled board. There are 16 black pawns, called Muscovites, 8 white pawns, the Swedes, and a special white pawn, the Swedish king.&lt;br /&gt;
&lt;br /&gt;
Players take turns, moving a single pawn of their color each time.&lt;br /&gt;
&lt;br /&gt;
The initial setup looks like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_board_screenshot.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Objective of the game =&lt;br /&gt;
For the player with the black pawns, the Muscovites, the goal is to make encircle the king in order to capture him.&lt;br /&gt;
&lt;br /&gt;
For the player with the white pawns, the Swedes, the goal his to bring the king on any tile of the corner of the board.&lt;br /&gt;
&lt;br /&gt;
= Moves =&lt;br /&gt;
All pawns move like the tower in chess: horizontally or vertically of any number of tiles.&lt;br /&gt;
&lt;br /&gt;
= Fortresses =&lt;br /&gt;
The Muscovites and the king starting positions are &#039;&#039;&#039;fortresses&#039;&#039;&#039;:&lt;br /&gt;
as long as they do not leave those tiles, pawns can freely move inside them.&lt;br /&gt;
 &lt;br /&gt;
However, any pawn at a stop outside a fortress cannot enter nor pass through those tiles.&lt;br /&gt;
&lt;br /&gt;
= Captures =&lt;br /&gt;
A pawn is captured, and hence removed from the board, when surrounded by 2 enemy pawns on opposite neighbour tiles :&lt;br /&gt;
&lt;br /&gt;
[[File:Tablut_soldier_capture.png]]&lt;br /&gt;
&lt;br /&gt;
However, a pawn willingly moving between 2 enemy pawns does not get captured.&lt;br /&gt;
&lt;br /&gt;
The king is special in regard to capture: 2 Muscovites are not enough to eliminate him,&lt;br /&gt;
he must be encircled on all his 4 neighbour tiles, by Muscovites or fortress squares :&lt;br /&gt;
&lt;br /&gt;
[[File:King_capture.png]] &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; [[File:Tablut_king_capture.png]]&lt;br /&gt;
&lt;br /&gt;
= Variant: King in the corners =&lt;br /&gt;
Like all tafl games, tablut has many variants.&lt;br /&gt;
&lt;br /&gt;
In this variant, the goal of the king is now to reach one of the 4 corners.&lt;br /&gt;
He cannot capture any enemy pawn but be can captured by 3 Muscovites when he is on a board edge.&lt;br /&gt;
Finally, the Muscovites starting positions are no more impassable.&lt;/div&gt;</summary>
		<author><name>Ricardorix</name></author>
	</entry>
</feed>