cl-ggp/reference/index.html @ 73c9b8445871

bones: Update site.
author Steve Losh <steve@stevelosh.com>
date Mon, 28 Mar 2016 17:52:57 +0000
parents e0132bd24efe
children 48a6ba2d68b9
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title> API Reference / cl-ggp</title>
        <link rel="stylesheet" href="../_dmedia/bootstrap.css"/>
        <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="api-reference"><a href="">API Reference</a></h1><p>The following is a list of all user-facing parts of <code>cl-ggp</code>.</p>
<p>If there are backwards-incompatible changes to anything listed here, they will
be noted in the changelog and the author will feel bad.</p>
<p>Anything not listed here is subject to change at any time with no warning, so
don't touch it.</p>
<div class="toc">
<ul>
<li><a href="#package-ggp">Package GGP</a><ul>
<li><a href="#ggp-player-class">GGP-PLAYER (class)</a><ul>
<li><a href="#slot-name">Slot NAME</a></li>
<li><a href="#slot-port">Slot PORT</a></li>
<li><a href="#slot-match-roles">Slot MATCH-ROLES</a></li>
<li><a href="#slot-start-clock">Slot START-CLOCK</a></li>
<li><a href="#slot-play-clock">Slot PLAY-CLOCK</a></li>
<li><a href="#slot-message-start">Slot MESSAGE-START</a></li>
<li><a href="#slot-current-match">Slot CURRENT-MATCH</a></li>
<li><a href="#slot-server">Slot SERVER</a></li>
</ul>
</li>
<li><a href="#kill-player-function">KILL-PLAYER (function)</a></li>
<li><a href="#player-select-move-generic-function">PLAYER-SELECT-MOVE (generic function)</a></li>
<li><a href="#player-start-game-generic-function">PLAYER-START-GAME (generic function)</a></li>
<li><a href="#player-stop-game-generic-function">PLAYER-STOP-GAME (generic function)</a></li>
<li><a href="#player-update-game-generic-function">PLAYER-UPDATE-GAME (generic function)</a></li>
<li><a href="#start-player-function">START-PLAYER (function)</a></li>
</ul>
</li>
<li><a href="#package-ggp-rules">Package GGP-RULES</a></li>
</ul></div>
<h2 id="package-ggp">Package GGP</h2>
<p>The main GGP package.</p>
<h3 id="ggp-player-class">GGP-PLAYER (class)</h3>
<p>The base class for a GGP player.  Custom players should extend this.</p>
<h4 id="slot-name">Slot NAME</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Type: <code>STRING</code></li>
<li>Initarg: <code>:NAME</code></li>
<li>Initform: <code>"CL-GGP"</code></li>
<li>Reader: <code>PLAYER-NAME</code></li>
</ul>
<p>The name of the player.</p>
<h4 id="slot-port">Slot PORT</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Type: <code>(INTEGER 0)</code></li>
<li>Initarg: <code>:PORT</code></li>
<li>Initform: <code>9999</code></li>
<li>Reader: <code>PLAYER-PORT</code></li>
</ul>
<p>The port the HTTP server should listen on.</p>
<h4 id="slot-match-roles">Slot MATCH-ROLES</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Type: <code>(OR NULL LIST)</code></li>
<li>Initform: <code>NIL</code></li>
<li>Reader: <code>PLAYER-MATCH-ROLES</code></li>
</ul>
<p>A list of the roles for the current match.  Feel free to read and use this if you like.  <strong>Do not modify this.</strong></p>
<h4 id="slot-start-clock">Slot START-CLOCK</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Type: <code>(OR NULL (INTEGER 1))</code></li>
<li>Initform: <code>NIL</code></li>
</ul>
<p>The start clock for the current game.  <strong>Do not touch this.</strong>  Use the <code>timeout</code> value passed to your methods instead.</p>
<h4 id="slot-play-clock">Slot PLAY-CLOCK</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Type: <code>(OR NULL (INTEGER 1))</code></li>
<li>Initform: <code>NIL</code></li>
</ul>
<p>The play clock for the current game.  <strong>Do not touch this.</strong>  Use the <code>timeout</code> value passed to your methods instead.</p>
<h4 id="slot-message-start">Slot MESSAGE-START</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Type: <code>(OR NULL (INTEGER 0))</code></li>
<li>Initform: <code>NIL</code></li>
</ul>
<p>The (internal-real) timestamp of when the current GGP message was received.  <strong>Do not touch this.</strong>  Use the <code>timeout</code> value passed to your methods instead.</p>
<h4 id="slot-current-match">Slot CURRENT-MATCH</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
<li>Initform: <code>NIL</code></li>
</ul>
<p>The ID of the current match the player is playing, or <code>nil</code> if it is waiting.  <strong>Do not touch this.</strong></p>
<h4 id="slot-server">Slot SERVER</h4>
<ul>
<li>Allocation: <code>:INSTANCE</code></li>
</ul>
<p>The Clack server object of the player.  <strong>Do not touch this.</strong>  Use <code>start-player</code> and <code>kill-player</code> to start/stop the server safely.</p>
<h3 id="kill-player-function">KILL-PLAYER (function)</h3>
<div class="codehilite"><pre>(KILL-PLAYER PLAYER)
</pre></div>


<p>Kill the HTTP server for the given player.</p>
<p>This will <strong>not</strong> be done gently.  No cleanup will be performed if the player
  is in the middle of a game.  Be careful.</p>
<h3 id="player-select-move-generic-function">PLAYER-SELECT-MOVE (generic function)</h3>
<div class="codehilite"><pre>(PLAYER-SELECT-MOVE PLAYER TIMEOUT)
</pre></div>


<p>Called when it's time for the player to select a move to play.</p>
<p>Must return a list/symbol of the GDL move to play.  Note that any symbols in
  the move should be ones that are interned in the <code>GGP-RULES</code> package.  The
  author is aware that this sucks and welcomes suggestions on how to make it
  less awful.</p>
<p><code>timeout</code> is the timestamp that the response to the server is due by, in
  internal-real time units.  Basically: when <code>(get-internal-real-time)</code> returns
  this number, your message better have reached the server.</p>
<h3 id="player-start-game-generic-function">PLAYER-START-GAME (generic function)</h3>
<div class="codehilite"><pre>(PLAYER-START-GAME PLAYER RULES ROLE TIMEOUT)
</pre></div>


<p>Called when the game is started.</p>
<p><code>rules</code> is a list of lists/symbols representing the GDL description of the
  game.  Note that all symbols are interned in the <code>GGP-RULES</code> package.</p>
<p><code>role</code> is a symbol representing the role of the player in this game.</p>
<p><code>timeout</code> is the timestamp that the response to the server is due by, in
  internal-real time units.  Basically: when <code>(get-internal-real-time)</code> returns
  this number, your message better have reached the server.</p>
<h3 id="player-stop-game-generic-function">PLAYER-STOP-GAME (generic function)</h3>
<div class="codehilite"><pre>(PLAYER-STOP-GAME PLAYER)
</pre></div>


<p>Called when the game is stopped.</p>
<p>This is a good place to do any teardown stuff your player might need, or maybe
  to suggest a GC to your Lisp implementation.</p>
<h3 id="player-update-game-generic-function">PLAYER-UPDATE-GAME (generic function)</h3>
<div class="codehilite"><pre>(PLAYER-UPDATE-GAME PLAYER MOVES)
</pre></div>


<p>Called after all players have made their moves.</p>
<p><code>moves</code> will be a list of <code>(role . move)</code> conses representing moves made by
  each player last turn.</p>
<h3 id="start-player-function">START-PLAYER (function)</h3>
<div class="codehilite"><pre>(START-PLAYER PLAYER)
</pre></div>


<p>Start the HTTP server for the given player.</p>
<h2 id="package-ggp-rules">Package GGP-RULES</h2>
<p>Symbol storage package.</p>
<p>The <code>GGP-RULES</code> package is used to hold all the symbols in the GDL game
  descriptions, as well as some special symbols in the GGP protocol.  It is
  cleared between game runs to avoid a buildup of garbage symbols (especially
  when GDL scrambling is turned on), though certain special symbols are allowed
  to survive the clearing.</p>
<p>This is ugly.  I'm sorry.  I'm open to suggestions on better ways to do this.</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>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-15328874-3', 'auto');
  ga('send', 'pageview');

</script></footer>
        </div>
    </body>
</html>