On 7/15/07, <b class="gmail_sendername">Hugh Perkins</b> &lt;<a href="mailto:hughperkins@gmail.com">hughperkins@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Had an idea: a real shootout game for Haskell.<br><br>The way it would work is:<br>- you email a haskell program to a specific address<br>- it shows up on a web-page<br><br>The webpage shows the last submitted solution for each person
<br>- anyone can select two solutions and click &quot;Fight&quot;<br>-&gt; the scripts &quot;fight&quot; in an arena for a second or so, and the results are published to the website<br><br>The arena itself comprises:<br>
- a 2d grid, of a certain size (or maybe variable size)
<br>- each grid cell can be a wall, or one of the opponents<br>- the boundaries of the grid are walls<br>- random blocks of wall are placed around the grid<br><br>The opponents only perceive what is in a section of space to their front, in a 45 degree arc from either side of the direction they are facing
<br>- each player can face along one of the four grid axes<br><br>Each player takes it in turns to move<br>- at each move the player can:<br>&nbsp;&nbsp; - move one square<br>&nbsp;&nbsp; - turn 90 degrees, in either direction<br>&nbsp;&nbsp; - fire<br>

<br>Firing will score one point if the opponent is in the line of fire at that time, and there are no intervening walls.<br><br>Opponents can see the direction the other opponent is facing, as long as the other opponent is in their view arc, and there are no intervening walls.
<br><br>Each turn is represented by a function something like:<br><br>doturn :: String -&gt; [[GridValue]] -&gt; (Action,String)<br><br>-- [[GridValue]] is a map of what Me sees this turn, or has seen previously<br>-- the Strings are a way for the function to pass state to itself between moves
<br><br>data GridValue = Opponent | Me | Wall | Empty<br>data Action = Fire | MoveNorth | MoveSouth |MoveEast | MoveWest | TurnLeft | TurnRight | Wait &nbsp;&nbsp; -- (players can move backwards and sideways)<br>many&nbsp;&nbsp; :: Parser a -&gt; Parser [a]
<br>many p = do { x &lt;- p; xs &lt;- many p; return (x:xs) }<br>The turn would be run as a separate thread, which either terminates successfully, or is aborted after a fixed time x milliseconds (maybe 10 milliseconds?)
<br><br>The String that doturn produces at the end of a turn is passed back in at the beginning of the next turn (so one could use gread/gshow to serialize/deserialize arbitrary data types, and there is no limitation on what data can be stored in the state).
<br><br>After say 1000 turns, the results are the points of each script. (or we could give each script a number of &quot;lives&quot; and if its loses them all the other script wins outright)<br><br><br>This can run on a hosted webserver probably, because each match is part of a webpage request, and lasts a maximum of about a second, so shouldnt be terminated prematurely by cpu-monitoring scripts.
<br></blockquote></div><br>I think this is a great idea!&nbsp; Besides being a nice AI testing ground, it might be a lot of fun.&nbsp; Of course, that web-hosting issue could end up being more of a minefield than one might expect...
<br><br>David<br>