<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: Match</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: Match</h1>

    




<section>

<header>
    
        <h2>Match</h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    

    <h4 class="name" id="Match"><span class="type-signature"></span>new Match<span class="signature">()</span><span class="type-signature"></span></h4>

    



<div class="description">
    Match
</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#line805">line 805</a>
    </li></ul></dd>
    

    

    

    
</dl>
















    
    </div>

    

    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id="currentGame"><span class="type-signature"></span>currentGame<span class="type-signature"> :<a href="Game.html">Game</a></span></h4>




<div class="description">
    Current game
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="Game.html">Game</a></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#line853">line 853</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="guest"><span class="type-signature"></span>guest<span class="type-signature"> :<a href="Player.html">Player</a></span></h4>




<div class="description">
    Player that joined the match
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="Player.html">Player</a></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#line822">line 822</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="host"><span class="type-signature"></span>host<span class="type-signature"> :<a href="Player.html">Player</a></span></h4>




<div class="description">
    Player that created the match
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type"><a href="Player.html">Player</a></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#line816">line 816</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="id"><span class="type-signature"></span>id<span class="type-signature"> :number</span></h4>




<div class="description">
    Unique ID of match object
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">number</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#line810">line 810</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="isOver"><span class="type-signature"></span>isOver<span class="type-signature"> :boolean</span></h4>




<div class="description">
    Is match over
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">boolean</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#line859">line 859</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="length"><span class="type-signature"></span>length<span class="type-signature"> :number</span></h4>




<div class="description">
    Match length - the score needed to win the match.
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">number</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#line841">line 841</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="players"><span class="type-signature"></span>players<span class="type-signature"> :Array</span></h4>




<div class="description">
    List of all players participating in the match
</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#line828">line 828</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="ruleName"><span class="type-signature"></span>ruleName<span class="type-signature"> :string</span></h4>




<div class="description">
    Name of the rule used for current match.
Equals the class name of the rule (eg. 'RuleBgCasual').
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">string</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#line835">line 835</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
            
<h4 class="name" id="score"><span class="type-signature"></span>score<span class="type-signature"> :Array</span></h4>




<div class="description">
    Score of players for current match
</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#line847">line 847</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id=".addGuestPlayer"><span class="type-signature">(static) </span>addGuestPlayer<span class="signature">(match, player)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Add guest player
</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>match</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Match.html">Match</a></span>


            
            </td>

            

            

            <td class="description last">Match to add player to</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>player</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Player.html">Player</a></span>


            
            </td>

            

            

            <td class="description last">Player to add</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#line910">line 910</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

    <div class="param-desc">
    
        Throws error if the match already has a guest player
    
    </div>


    





        
            

    

    <h4 class="name" id=".addHostPlayer"><span class="type-signature">(static) </span>addHostPlayer<span class="signature">(match, player)</span><span class="type-signature"></span></h4>

    



<div class="description">
    Add host player to match
</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>match</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Match.html">Match</a></span>


            
            </td>

            

            

            <td class="description last">Match to add player to</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>player</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Player.html">Player</a></span>


            
            </td>

            

            

            <td class="description last">Player to add</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#line894">line 894</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

    <div class="param-desc">
    
        Throws error if the match already has a host player
    
    </div>


    





        
            

    

    <h4 class="name" id=".createNew"><span class="type-signature">(static) </span>createNew<span class="signature">(rule)</span><span class="type-signature"> &rarr; {<a href="Match.html">Match</a>}</span></h4>

    



<div class="description">
    Create new match object with unique ID and initialize it.
Match object is not saved in database.
</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>rule</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Rule.html">Rule</a></span>


            
            </td>

            

            

            <td class="description last">Rule object to use</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#line868">line 868</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    - A new match object with unique ID
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type"><a href="Match.html">Match</a></span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id=".createNewGame"><span class="type-signature">(static) </span>createNewGame<span class="signature">(rule)</span><span class="type-signature"> &rarr; {<a href="Match.html">Match</a>}</span></h4>

    



<div class="description">
    Create new game for this match. Fill game object with data from match
Game object is not saved in database.
</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>rule</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Rule.html">Rule</a></span>


            
            </td>

            

            

            <td class="description last">Rule object to use</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#line882">line 882</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    - A new match object with unique ID
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type"><a href="Match.html">Match</a></span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id=".hasGuestJoined"><span class="type-signature">(static) </span>hasGuestJoined<span class="signature">(match)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    



<div class="description">
    Check if another player has joined the match
</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>match</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Match.html">Match</a></span>


            
            </td>

            

            

            <td class="description last">Match</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#line937">line 937</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    - True if a another player has joined the match
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    



        
            

    

    <h4 class="name" id=".isHost"><span class="type-signature">(static) </span>isHost<span class="signature">(match, player)</span><span class="type-signature"> &rarr; {boolean}</span></h4>

    



<div class="description">
    Check if specified player is the host of the match
</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>match</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Match.html">Match</a></span>


            
            </td>

            

            

            <td class="description last">Match</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>player</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="Player.html">Player</a></span>


            
            </td>

            

            

            <td class="description last">Specified player</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#line926">line 926</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    - True if there is a host player and their ID matches that of the player parameter
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</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>