Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Marion committed Dec 30, 2018
1 parent 2e7af98 commit 9cb98c9
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 14 deletions.
Binary file modified docs/.doctrees/api/algorithms.doctree
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
13 changes: 13 additions & 0 deletions docs/_modules/algorithms/mcts.html
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,19 @@ <h1>Source code for algorithms.mcts</h1><div class="highlight"><pre>

<span class="k">return</span> <span class="p">(</span><span class="n">best_move</span><span class="p">,</span> <span class="n">expand</span><span class="p">)</span></div>

<div class="viewcode-block" id="MCTS.pi"><a class="viewcode-back" href="../../api/algorithms.html#algorithms.MCTS.pi">[docs]</a> <span class="k">def</span> <span class="nf">pi</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">g</span><span class="p">,</span> <span class="n">s</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Return the favorability of each action in a given state</span>

<span class="sd"> Args:</span>
<span class="sd"> g (Game): The game</span>
<span class="sd"> s (any): The state to evaluate</span>

<span class="sd"> Returns:</span>
<span class="sd"> :obj:`list` of :obj:`float`: The favorabiltiy of each action</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">actions</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">action_space</span><span class="p">(</span><span class="n">s</span><span class="p">)</span></div>

<div class="viewcode-block" id="MCTS.update"><a class="viewcode-back" href="../../api/algorithms.html#algorithms.MCTS.update">[docs]</a> <span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">examples</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Backpropagate the result of the training episodes</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/_modules/algorithms/minimax.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ <h1>Source code for algorithms.minimax</h1><div class="highlight"><pre>
<span class="sd"> is set then the game&#39;s hueristic is used</span>
<span class="sd"> &#39;&#39;&#39;</span>

<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">horizon</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;horizon&#39;</span><span class="p">,</span> <span class="nb">float</span><span class="p">(</span><span class="s1">&#39;inf&#39;</span><span class="p">))</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">horizon</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="s1">&#39;inf&#39;</span><span class="p">)):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">horizon</span> <span class="o">=</span> <span class="n">horizon</span>

<div class="viewcode-block" id="Minimax.best_action"><a class="viewcode-back" href="../../api/algorithms.html#algorithms.Minimax.best_action">[docs]</a> <span class="k">def</span> <span class="nf">best_action</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">g</span><span class="p">,</span> <span class="n">s</span><span class="p">,</span> <span class="n">p</span><span class="p">):</span>
<span class="n">actions</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">action_space</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
Expand Down
26 changes: 25 additions & 1 deletion docs/api/algorithms.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,30 @@ <h1>Algorithms<a class="headerlink" href="#algorithms" title="Permalink to this
</table>
</dd></dl>

<dl class="method">
<dt id="algorithms.MCTS.pi">
<code class="descname">pi</code><span class="sig-paren">(</span><em>g</em>, <em>s</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/algorithms/mcts.html#MCTS.pi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#algorithms.MCTS.pi" title="Permalink to this definition"></a></dt>
<dd><p>Return the favorability of each action in a given state</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>g</strong> (<a class="reference internal" href="core.html#core.Game" title="core.Game"><em>Game</em></a>) – The game</li>
<li><strong>s</strong> (<em>any</em>) – The state to evaluate</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The favorabiltiy of each action</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><code class="xref py py-obj docutils literal notranslate"><span class="pre">list</span></code> of <code class="xref py py-obj docutils literal notranslate"><span class="pre">float</span></code></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="staticmethod">
<dt id="algorithms.MCTS.random_playout">
<em class="property">static </em><code class="descname">random_playout</code><span class="sig-paren">(</span><em>g</em>, <em>s</em>, <em>p</em>, <em>max_moves=1000</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/algorithms/mcts.html#MCTS.random_playout"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#algorithms.MCTS.random_playout" title="Permalink to this definition"></a></dt>
Expand Down Expand Up @@ -372,7 +396,7 @@ <h1>Algorithms<a class="headerlink" href="#algorithms" title="Permalink to this

<dl class="class">
<dt id="algorithms.Minimax">
<em class="property">class </em><code class="descclassname">algorithms.</code><code class="descname">Minimax</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/algorithms/minimax.html#Minimax"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#algorithms.Minimax" title="Permalink to this definition"></a></dt>
<em class="property">class </em><code class="descclassname">algorithms.</code><code class="descname">Minimax</code><span class="sig-paren">(</span><em>horizon=inf</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/algorithms/minimax.html#Minimax"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#algorithms.Minimax" title="Permalink to this definition"></a></dt>
<dd><p>Implementation of the minimax algorithm.</p>
<dl class="attribute">
<dt id="algorithms.Minimax.horizon">
Expand Down
6 changes: 4 additions & 2 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,16 @@ <h2 id="N">N</h2>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/algorithms.html#algorithms.MCTS.pi">pi() (algorithms.MCTS method)</a>
</li>
<li><a href="api/core.html#core.Arena.play_game">play_game() (core.Arena method)</a>
</li>
<li><a href="api/core.html#core.Arena.play_games">play_games() (core.Arena method)</a>
</li>
<li><a href="api/core.html#core.Player">Player (class in core)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/core.html#core.Player">Player (class in core)</a>
</li>
<li><a href="api/core.html#core.Player.player_id">player_id (core.Player attribute)</a>
</li>
<li><a href="api/core.html#core.Arena.players">players (core.Arena attribute)</a>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.

0 comments on commit 9cb98c9

Please sign in to comment.