cl-ggp/reference-reasoner/index.html @ 0f6bab39c0f4 default tip

adopt: Update site.
author Steve Losh <steve@stevelosh.com>
date Thu, 13 Jun 2024 13:05:28 -0400
parents 5e5299655012
children (none)
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title> Reasoner API Reference / cl-ggp</title>
        <link rel="stylesheet" href="../_dmedia/tango.css"/>
        <link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
        <script src="../_dmedia/less.js" type="text/javascript">
        </script>
    </head>
    <body class="content">
        <div class="wrap">
            <header><h1><a href="..">cl-ggp</a></h1></header>
                <div class="markdown">
<h1 id="reasoner-api-reference"><a href="">Reasoner API Reference</a></h1><p>cl-ggp includes a simple Prolog-based reasoner you can use as a starting point when writing general game players in the <code>ggp.reasoner</code> system.</p>
<div class="toc">
<ul>
<li><a href="#package-ggpreasoner">Package GGP.REASONER</a><ul>
<li><a href="#goal-value-for-function">GOAL-VALUE-FOR (function)</a></li>
<li><a href="#initial-state-function">INITIAL-STATE (function)</a></li>
<li><a href="#legal-moves-for-function">LEGAL-MOVES-FOR (function)</a></li>
<li><a href="#make-reasoner-function">MAKE-REASONER (function)</a></li>
<li><a href="#next-state-function">NEXT-STATE (function)</a></li>
<li><a href="#roles-function">ROLES (function)</a></li>
<li><a href="#terminalp-function">TERMINALP (function)</a></li>
</ul>
</li>
</ul></div>
<h2 id="package-ggpreasoner">Package <code>GGP.REASONER</code></h2>
<p>This package contains a simple GGP reasoner.  It can be useful as a starting point for writing general game players.</p>
<h3 id="goal-value-for-function"><code>GOAL-VALUE-FOR</code> (function)</h3>
<div class="codehilite"><pre><span/>(GOAL-VALUE-FOR REASONER STATE ROLE)
</pre></div>


<p>Return the goal value for <code>role</code> in <code>state</code>, or <code>nil</code> if none exists.</p>
<p>Note that the GDL spec only requires that such values have meaning in terminal
  states.  Game authors sometimes add goal values to nonterminal states, but
  this is probably not something you should rely on.</p>
<h3 id="initial-state-function"><code>INITIAL-STATE</code> (function)</h3>
<div class="codehilite"><pre><span/>(INITIAL-STATE REASONER)
</pre></div>


<p>Return the initial state of <code>reasoner</code>.</p>
<h3 id="legal-moves-for-function"><code>LEGAL-MOVES-FOR</code> (function)</h3>
<div class="codehilite"><pre><span/>(LEGAL-MOVES-FOR REASONER STATE ROLE)
</pre></div>


<p>Return a list of legal moves for <code>role</code> in <code>state</code>.</p>
<p><code>ggp:player-select-move</code> must return exactly one of the items in this list.</p>
<h3 id="make-reasoner-function"><code>MAKE-REASONER</code> (function)</h3>
<div class="codehilite"><pre><span/>(MAKE-REASONER RULES)
</pre></div>


<p>Create and return a reasoner for the given GDL <code>rules</code>.</p>
<p><code>rules</code> should be a list of GDL rules with the symbols interned into the
  appropriate packages.  <code>ggp:player-start-game</code> will give you this, or you can
  use <code>ggp:read-gdl-from-file</code> to get them without a player if you want to just
  poke at the reasoner.</p>
<h3 id="next-state-function"><code>NEXT-STATE</code> (function)</h3>
<div class="codehilite"><pre><span/>(NEXT-STATE REASONER STATE MOVES)
</pre></div>


<p>Compute and return the successor to <code>state</code>, assuming <code>moves</code> were made.</p>
<p><code>moves</code> should be an alist of <code>(role . move)</code> pairs, which is what
  <code>ggp:player-update-game</code> will give you.</p>
<h3 id="roles-function"><code>ROLES</code> (function)</h3>
<div class="codehilite"><pre><span/>(ROLES REASONER)
</pre></div>


<p>Return a fresh list of all the roles of <code>reasoner</code>.</p>
<h3 id="terminalp-function"><code>TERMINALP</code> (function)</h3>
<div class="codehilite"><pre><span/>(TERMINALP REASONER STATE)
</pre></div>


<p>Return whether <code>state</code> is terminal.</p>
                </div>
            <footer><p><i>Made with Lisp and love by <a href="http://stevelosh.com/">Steve Losh</a> in Reykjavík, Iceland.</i></p></footer>
        </div>
    </body>
</html>