<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Dice</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Dice</h1> <section> <header> <h2>Dice</h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Dice"><span class="type-signature"></span>new Dice<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Dice with basic functionality to roll using good random generator. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line199">line 199</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="moves"><span class="type-signature"></span>moves<span class="type-signature"> :Array</span></h4> <div class="description"> List of moves the player can make. Usually moves are equal to values, but in most rules doubles (eg. 6:6) are played four times, instead of two, in which case moves array will contain four values in stead of only two (eg. [6, 6, 6, 6]). </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line213">line 213</a> </li></ul></dd> </dl> <h4 class="name" id="movesLeft"><span class="type-signature"></span>movesLeft<span class="type-signature"> :Array</span></h4> <div class="description"> After dice is rolled, movesLeft contains the same values as moves. When the player makes a move, the corresponding value is removed from movesLeft array. If the player wants to undo the moves made, movesLeft is replaced with moves. </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line222">line 222</a> </li></ul></dd> </dl> <h4 class="name" id="movesPlayed"><span class="type-signature"></span>movesPlayed<span class="type-signature"> :Array</span></h4> <div class="description"> After a piece is moved, the value of the die used is added to movesPlayed array. </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line228">line 228</a> </li></ul></dd> </dl> <h4 class="name" id="values"><span class="type-signature"></span>values<span class="type-signature"> :Array</span></h4> <div class="description"> Values of the two dice </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line204">line 204</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".getRemainingMoves"><span class="type-signature">(static) </span>getRemainingMoves<span class="signature">(dice)</span><span class="type-signature"> → {Array}</span></h4> <div class="description"> Get remaining moves from dice object - moves that have not been played. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dice</code></td> <td class="type"> <span class="param-type"><a href="Dice.html">Dice</a></span> </td> <td class="description last">Dice object</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line274">line 274</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> - Array containing remaining move values </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id=".isDouble"><span class="type-signature">(static) </span>isDouble<span class="signature">(dice)</span><span class="type-signature"> → {boolean}</span></h4> <div class="description"> Check if the dice object has double (equal) values. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dice</code></td> <td class="type"> <span class="param-type"><a href="Dice.html">Dice</a></span> </td> <td class="description last">New dice with random values</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line265">line 265</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> - True if dice object has dobule values, false otherwise </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id=".markAsPlayed"><span class="type-signature">(static) </span>markAsPlayed<span class="signature">(dice, move)</span><span class="type-signature"></span></h4> <div class="description"> Roll dice and return result as a new Dice object </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dice</code></td> <td class="type"> <span class="param-type"><a href="Dice.html">Dice</a></span> </td> <td class="description last">New dice with random values</td> </tr> <tr> <td class="name"><code>move</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">New dice with random values</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line249">line 249</a> </li></ul></dd> </dl> <h4 class="name" id=".roll"><span class="type-signature">(static) </span>roll<span class="signature">()</span><span class="type-signature"> → {<a href="Dice.html">Dice</a>}</span></h4> <div class="description"> Roll dice and return result as a new Dice object </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="model.js.html">model.js</a>, <a href="model.js.html#line235">line 235</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> - New dice with random values </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Dice.html">Dice</a></span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Client.html">Client</a></li><li><a href="Dice.html">Dice</a></li><li><a href="Game.html">Game</a></li><li><a href="Match.html">Match</a></li><li><a href="MoveAction.html">MoveAction</a></li><li><a href="Piece.html">Piece</a></li><li><a href="Player.html">Player</a></li><li><a href="PlayerStats.html">PlayerStats</a></li><li><a href="Random.html">Random</a></li><li><a href="Rule.html">Rule</a></li><li><a href="RuleBgCasual.html">RuleBgCasual</a></li><li><a href="RuleBgGulbara.html">RuleBgGulbara</a></li><li><a href="RuleBgTapa.html">RuleBgTapa</a></li><li><a href="State.html">State</a></li><li><a href="Utils.html">Utils</a></li></ul><h3>Global</h3><ul><li><a href="global.html#Message">Message</a></li><li><a href="global.html#MoveActionType">MoveActionType</a></li><li><a href="global.html#PieceType">PieceType</a></li><li><a href="global.html#Protocol">Protocol</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sun Dec 18 2016 20:10:05 GMT+0200 (EET) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>