cl-ggp/reference/index.html @ 3ba42c0f6543
cl-pcg: Update site.
author |
Steve Losh <steve@stevelosh.com> |
date |
Thu, 06 Apr 2017 20:08:05 +0000 |
parents |
f5a0fcf62e5e |
children |
9c5ba7f7046a |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title> Main API Reference / cl-ggp</title>
<link rel="stylesheet" href="../_dmedia/pygments-clean.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="main-api-reference"><a href="">Main 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></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="#player-update-game-ii-generic-function">PLAYER-UPDATE-GAME-II (generic function)</a></li>
<li><a href="#read-gdl-from-file-function">READ-GDL-FROM-FILE (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 <code>GGP</code></h2>
<p>The main GGP package.</p>
<h3 id="ggp-player-class"><code>GGP-PLAYER</code> (class)</h3>
<p>The base class for a GGP player. Custom players should extend this.</p>
<h3 id="kill-player-function"><code>KILL-PLAYER</code> (function)</h3>
<div class="codehilite"><pre><span/>(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"><code>PLAYER-SELECT-MOVE</code> (generic function)</h3>
<div class="codehilite"><pre><span/>(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"><code>PLAYER-START-GAME</code> (generic function)</h3>
<div class="codehilite"><pre><span/>(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"><code>PLAYER-STOP-GAME</code> (generic function)</h3>
<div class="codehilite"><pre><span/>(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"><code>PLAYER-UPDATE-GAME</code> (generic function)</h3>
<div class="codehilite"><pre><span/>(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="player-update-game-ii-generic-function"><code>PLAYER-UPDATE-GAME-II</code> (generic function)</h3>
<div class="codehilite"><pre><span/>(PLAYER-UPDATE-GAME-II PLAYER MOVE PERCEPTS)
</pre></div>
<p>Called after all players have made their moves in a GDL-II game.</p>
<p><code>move</code> will be the move you played last turn.</p>
<p><code>percepts</code> are all the percepts you see for the round.</p>
<h3 id="read-gdl-from-file-function"><code>READ-GDL-FROM-FILE</code> (function)</h3>
<div class="codehilite"><pre><span/>(READ-GDL-FROM-FILE FILENAME)
</pre></div>
<p>Read GDL from <code>filename</code></p>
<h3 id="start-player-function"><code>START-PLAYER</code> (function)</h3>
<div class="codehilite"><pre><span/>(START-PLAYER PLAYER &KEY (SERVER :HUNCHENTOOT) (USE-THREAD T))
</pre></div>
<p>Start the HTTP server for the given player.</p>
<p>The <code>:server</code> and <code>:use-thread</code> options will be passed along to Clack.</p>
<h2 id="package-ggp-rules">Package <code>GGP-RULES</code></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>