<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Game</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Game</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/lib/libttc_rb.html">
                lib/libttc.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A game of Trap the Cap. It keeps a history of all previous states.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000037">apply_move!</a>&nbsp;&nbsp;
      <a href="#M000039">apply_moves!</a>&nbsp;&nbsp;
      <a href="#M000042">build_state_string</a>&nbsp;&nbsp;
      <a href="#M000036">new</a>&nbsp;&nbsp;
      <a href="#M000040">next_player!</a>&nbsp;&nbsp;
      <a href="#M000041">possible_moves</a>&nbsp;&nbsp;
      <a href="#M000046">read_game</a>&nbsp;&nbsp;
      <a href="#M000043">show_state</a>&nbsp;&nbsp;
      <a href="#M000044">to_s</a>&nbsp;&nbsp;
      <a href="#M000045">to_str</a>&nbsp;&nbsp;
      <a href="#M000038">undo_move!</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">board</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">current_player</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">history</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">pieces</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">players</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000036" class="method-detail">
        <a name="M000036"></a>

        <div class="method-heading">
          <a href="Game.src/M000036.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000036.html');return false;">
          <span class="method-name">new</span><span class="method-args">(players = 6, spokes = 6, spoke_length = 6, arc_length = 6, pieces_each = 6)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a <a href="Game.html#M000036">new</a> game
</p>
        </div>
      </div>

      <div id="method-M000046" class="method-detail">
        <a name="M000046"></a>

        <div class="method-heading">
          <a href="Game.src/M000046.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000046.html');return false;">
          <span class="method-name">read_game</span><span class="method-args">(gamelines)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Given a set of lines from an input file, turn them into a <a
href="Game.html">Game</a> object and a set of <a href="Move.html">Move</a>
objects. Note the multiple return values. Class method
</p>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000037" class="method-detail">
        <a name="M000037"></a>

        <div class="method-heading">
          <a href="Game.src/M000037.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000037.html');return false;">
          <span class="method-name">apply_move!</span><span class="method-args">(move, player = @current_player)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Apply a single move to a game.
</p>
        </div>
      </div>

      <div id="method-M000039" class="method-detail">
        <a name="M000039"></a>

        <div class="method-heading">
          <a href="Game.src/M000039.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000039.html');return false;">
          <span class="method-name">apply_moves!</span><span class="method-args">(moves)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Apply a list of moves in order
</p>
        </div>
      </div>

      <div id="method-M000042" class="method-detail">
        <a name="M000042"></a>

        <div class="method-heading">
          <a href="Game.src/M000042.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000042.html');return false;">
          <span class="method-name">build_state_string</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000040" class="method-detail">
        <a name="M000040"></a>

        <div class="method-heading">
          <a href="Game.src/M000040.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000040.html');return false;">
          <span class="method-name">next_player!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Set the current player to be the next player
</p>
        </div>
      </div>

      <div id="method-M000041" class="method-detail">
        <a name="M000041"></a>

        <div class="method-heading">
          <a href="Game.src/M000041.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000041.html');return false;">
          <span class="method-name">possible_moves</span><span class="method-args">(die_result, player = @current_player)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Return an array of all possible moves from this state, given the die roll
and the active player
</p>
        </div>
      </div>

      <div id="method-M000043" class="method-detail">
        <a name="M000043"></a>

        <div class="method-heading">
          <a href="Game.src/M000043.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000043.html');return false;">
          <span class="method-name">show_state</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Show the state of the board
</p>
        </div>
      </div>

      <div id="method-M000044" class="method-detail">
        <a name="M000044"></a>

        <div class="method-heading">
          <a href="Game.src/M000044.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000044.html');return false;">
          <span class="method-name">to_s</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000045" class="method-detail">
        <a name="M000045"></a>

        <div class="method-heading">
          <a href="Game.src/M000045.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000045.html');return false;">
          <span class="method-name">to_str</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000038" class="method-detail">
        <a name="M000038"></a>

        <div class="method-heading">
          <a href="Game.src/M000038.html" target="Code" class="method-signature"
            onclick="popupCode('Game.src/M000038.html');return false;">
          <span class="method-name">undo_move!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Undo a move
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>