
Had an idea: a real shootout game for Haskell. The way it would work is: - you email a haskell program to a specific address - it shows up on a web-page The webpage shows the last submitted solution for each person - anyone can select two solutions and click "Fight" -> the scripts "fight" in an arena for a second or so, and the results are published to the website The arena itself comprises: - a 2d grid, of a certain size (or maybe variable size) - each grid cell can be a wall, or one of the opponents - the boundaries of the grid are walls - random blocks of wall are placed around the grid 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 - each player can face along one of the four grid axes Each player takes it in turns to move - at each move the player can: - move one square - turn 90 degrees, in either direction - fire Firing will score one point if the opponent is in the line of fire at that time, and there are no intervening walls. 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. Each turn is represented by a function something like: doturn :: String -> [[GridValue]] -> (Action,String) -- [[GridValue]] is a map of what Me sees this turn, or has seen previously -- the Strings are a way for the function to pass state to itself between moves data GridValue = Opponent | Me | Wall | Empty data Action = Fire | MoveNorth | MoveSouth |MoveEast | MoveWest | TurnLeft | TurnRight | Wait -- (players can move backwards and sideways) 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?) 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). After say 1000 turns, the results are the points of each script. (or we could give each script a number of "lives" and if its loses them all the other script wins outright) 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.

On 7/15/07, Hugh Perkins
Had an idea: a real shootout game for Haskell.
The way it would work is: - you email a haskell program to a specific address - it shows up on a web-page
The webpage shows the last submitted solution for each person - anyone can select two solutions and click "Fight" -> the scripts "fight" in an arena for a second or so, and the results are published to the website
The arena itself comprises: - a 2d grid, of a certain size (or maybe variable size) - each grid cell can be a wall, or one of the opponents - the boundaries of the grid are walls - random blocks of wall are placed around the grid
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 - each player can face along one of the four grid axes
Each player takes it in turns to move - at each move the player can: - move one square - turn 90 degrees, in either direction - fire
Firing will score one point if the opponent is in the line of fire at that time, and there are no intervening walls.
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.
Each turn is represented by a function something like:
doturn :: String -> [[GridValue]] -> (Action,String)
-- [[GridValue]] is a map of what Me sees this turn, or has seen previously -- the Strings are a way for the function to pass state to itself between moves
data GridValue = Opponent | Me | Wall | Empty data Action = Fire | MoveNorth | MoveSouth |MoveEast | MoveWest | TurnLeft | TurnRight | Wait -- (players can move backwards and sideways) many :: Parser a -> Parser [a] many p = do { x <- p; xs <- many p; return (x:xs) } 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?)
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).
After say 1000 turns, the results are the points of each script. (or we could give each script a number of "lives" and if its loses them all the other script wins outright)
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.
I think this is a great idea! Besides being a nice AI testing ground, it might be a lot of fun. Of course, that web-hosting issue could end up being more of a minefield than one might expect... David

Hugh Perkins wrote:
Had an idea: a real shootout game for Haskell.
scripts "fight" in an arena for a second or so, and the results are published to the website
Sounds great :) There are lots of "robot battle" games out there, like http://realtimebattle.sourceforge.net/ http://robocode.sourceforge.net but none in Haskell, of course. I think there's a classic predecessor to those but I don't know exactly.
Each turn is represented by a function something like:
doturn :: String -> [[GridValue]] -> (Action,String)
The explicit state can be dispensed with by introducing a stream type data Robot = Robot (BattleField -> (Action, Robot) type BattleField = [[GridValue]] This way, the program is entirely free in how to choose its state representation. You can turn any doturn - based program into a stream-based one toRobot :: String -> (BattleField -> String -> (Action,String)) -> Robot toRobot s doturn = Robot $ \arena -> let (action, s') = doturn bf s in (action, toRobot s' doturn) The drawback is that it's no longer possible to save a snapshot of each program's state to disk and resume the fight later. Regards, apfelmus

apfelmus wrote:
Hugh Perkins wrote:
Had an idea: a real shootout game for Haskell.
scripts "fight" in an arena for a second or so, and the results are published to the website
Sounds great :)
There are lots of "robot battle" games out there, like
http://realtimebattle.sourceforge.net/ http://robocode.sourceforge.net
but none in Haskell, of course. I think there's a classic predecessor to those but I don't know exactly.
I suspect they are probably viewed as 'descendants' in a weak sense from Core War, which in turn was inspired by Darwin. However these two, since the act more 'directly' in the memory space of a virtual CPU are quite different in character. I can't substantiate that suspicion with any evidence, though. Either way it would be a fun thing for someone to write for haskell. Jules

There are lots of "robot battle" games out there, like but none in Haskell, of course.
do the icfp contests count? not even limited to haskell, and there were several tasks that look related, including: http://alliance.seas.upenn.edu/~plclub/cgi-bin/contest/ants.html http://icfpc.plt-scheme.org/spec.html http://web.cecs.pdx.edu/%7Esheard/2002IcfpContest/task.html claus

On 7/16/07, Claus Reinke
There are lots of "robot battle" games out there, like but none in Haskell, of course.
do the icfp contests count? not even limited to haskell, and there were several tasks that look related, including:
http://alliance.seas.upenn.edu/~plclub/cgi-bin/contest/ants.html
claus Perhaps it would be interesting to generalize the notion of a 'game' so that programmers could design their own simple games to compete in as well as designing game-playing agents? I'm not sure if this presents problems as far as running untrusted code but it would add a lot of appeal to the site in my mind. If designed right, the agents could be run against multiple games; seeing a hierarchy of agent performance across a number of different challenges would be very cool. David

Hi,
I've had a go at making a robot battle game in Haskell (a robocode clone), I
was using Yampa for both the robots and the game logic - however using Yampa
for the game logic presented a number of problems, mostly in ensuring every
single piece of data "emitted" from the game logic portion was evaluated.
I had a fair amount of work done, and it was shaping up nicely, but it
needed simplification, trying to add in too many extras such as physical
simulation of collisions etc. turned it into a bit of a monster when the
core design needed some work!
http://saulzar.orcon.net.nz/robots2.jpg
I'd definitely like to give it another go, this time without Yampa for game
logic - though it seems fantastic for the user robot code, perhaps it
needn't be compulsory - interested users could always use Yampa if they
desired.
Oliver Batchelor
On 7/16/07, apfelmus
Hugh Perkins wrote:
Had an idea: a real shootout game for Haskell.
scripts "fight" in an arena for a second or so, and the results are published to the website
Sounds great :)
There are lots of "robot battle" games out there, like
http://realtimebattle.sourceforge.net/ http://robocode.sourceforge.net
but none in Haskell, of course. I think there's a classic predecessor to those but I don't know exactly.
Each turn is represented by a function something like:
doturn :: String -> [[GridValue]] -> (Action,String)
The explicit state can be dispensed with by introducing a stream type
data Robot = Robot (BattleField -> (Action, Robot)
type BattleField = [[GridValue]]
This way, the program is entirely free in how to choose its state representation. You can turn any doturn - based program into a stream-based one
toRobot :: String -> (BattleField -> String -> (Action,String)) -> Robot toRobot s doturn = Robot $ \arena -> let (action, s') = doturn bf s in (action, toRobot s' doturn)
The drawback is that it's no longer possible to save a snapshot of each program's state to disk and resume the fight later.
Regards, apfelmus
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

This would be a lot of fun! Make sure to take the lessons from
http://haskell.org/haskellwiki/Safely_running_untrusted_Haskell_code
into account.
regards,
Bas van Dijk
On 7/15/07, Hugh Perkins
Had an idea: a real shootout game for Haskell.
The way it would work is: - you email a haskell program to a specific address - it shows up on a web-page
The webpage shows the last submitted solution for each person - anyone can select two solutions and click "Fight" -> the scripts "fight" in an arena for a second or so, and the results are published to the website
The arena itself comprises: - a 2d grid, of a certain size (or maybe variable size) - each grid cell can be a wall, or one of the opponents - the boundaries of the grid are walls - random blocks of wall are placed around the grid
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 - each player can face along one of the four grid axes
Each player takes it in turns to move - at each move the player can: - move one square - turn 90 degrees, in either direction - fire
Firing will score one point if the opponent is in the line of fire at that time, and there are no intervening walls.
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.
Each turn is represented by a function something like:
doturn :: String -> [[GridValue]] -> (Action,String)
-- [[GridValue]] is a map of what Me sees this turn, or has seen previously -- the Strings are a way for the function to pass state to itself between moves
data GridValue = Opponent | Me | Wall | Empty data Action = Fire | MoveNorth | MoveSouth |MoveEast | MoveWest | TurnLeft | TurnRight | Wait -- (players can move backwards and sideways)
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?)
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).
After say 1000 turns, the results are the points of each script. (or we could give each script a number of "lives" and if its loses them all the other script wins outright)
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.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Interestingly enough, we're doing something very similar for ACM@UIUC's 2007 MechMania XIII contest (http://en.wikipedia.org/wiki/Mechmania), an AI competition hosted during our annual Reflections Projections conference. I can't release too many details until the day of the contest (Oct 13), but it's tactical, grid based combat game where you get one day to write an AI (while testing in a pre-arena of sorts that is rendered to a video wall in the middle of the conference building's atrium) and then the next morning we run a (usually double elimination) tournament and display all the simulations on a giant projector. You can look at screenshots / client API docs from 2006 as an example until we post the details the night of the contest. After the contest we post results, (hopefully) clean up the code, and release it for people to play with. We're not professionals, nor do we mainly write games, but it should be clean enough for someone to modify and play around with. I guess it goes without saying that you can actually enter the contest proper by coming to the conference if you happen to live in the middle of nowhere (Champaign-Urbana, IL USA). Registration will be up (www.acm.uiuc.edu/conference/) towards the end of summer. ________________________________ From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Hugh Perkins Sent: Sunday, July 15, 2007 2:47 PM To: haskell-cafe Subject: [Haskell-cafe] Haskell shootout game Had an idea: a real shootout game for Haskell. The arena itself comprises: - a 2d grid, of a certain size (or maybe variable size) - each grid cell can be a wall, or one of the opponents - the boundaries of the grid are walls - random blocks of wall are placed around the grid 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. -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Hi, a similar variation of the idea can be found on http://infon.dividuum.de A nice feature o this game is that you can upload the (lua) code while the game is running, so the rounds tend to be quite long (~1h maybe) and the people can adjust their AI constantly. It was very popular at the last two GPN conferences in Karlsruhe. Greetings, Joachim Am Montag, den 16.07.2007, 11:31 -0400 schrieb Re, Joseph (IT):
Interestingly enough, we're doing something very similar for ACM@UIUC's 2007 MechMania XIII contest (http://en.wikipedia.org/wiki/Mechmania), an AI competition hosted during our annual Reflections Projections conference.
I can't release too many details until the day of the contest (Oct 13), but it's tactical, grid based combat game where you get one day to write an AI (while testing in a pre-arena of sorts that is rendered to a video wall in the middle of the conference building's atrium) and then the next morning we run a (usually double elimination) tournament and display all the simulations on a giant projector. You can look at screenshots / client API docs from 2006 as an example until we post the details the night of the contest.
After the contest we post results, (hopefully) clean up the code, and release it for people to play with. We're not professionals, nor do we mainly write games, but it should be clean enough for someone to modify and play around with.
I guess it goes without saying that you can actually enter the contest proper by coming to the conference if you happen to live in the middle of nowhere (Champaign-Urbana, IL USA). Registration will be up (www.acm.uiuc.edu/conference/) towards the end of summer.
________________________________
From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Hugh Perkins Sent: Sunday, July 15, 2007 2:47 PM To: haskell-cafe Subject: [Haskell-cafe] Haskell shootout game
Had an idea: a real shootout game for Haskell.
The arena itself comprises: - a 2d grid, of a certain size (or maybe variable size) - each grid cell can be a wall, or one of the opponents - the boundaries of the grid are walls - random blocks of wall are placed around the grid
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. --------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: joachimbreitner@amessage.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org

Hugh Perkins wrote:
Had an idea: a real shootout game for Haskell.
The way it would work is: - you email a haskell program to a specific address - it shows up on a web-page
The webpage shows the last submitted solution for each person - anyone can select two solutions and click "Fight" -> the scripts "fight" in an arena for a second or so, and the results are published to the website
...
Something like this was done as a student project at Chalmers a few years ago. Unfortunately the web site is gone, but some of it survives in the Wayback machine: http://web.archive.org/web/20040811042735/www.dtek.chalmers.se/~d00nibro/hwa... You can probably find out more if you ask the project members: http://web.archive.org/web/20040811042126/www.dtek.chalmers.se/~d00nibro/hwa... /Björn
participants (10)
-
apfelmus
-
Bas van Dijk
-
Björn Bringert
-
Claus Reinke
-
David LaPalomento
-
Hugh Perkins
-
Joachim Breitner
-
Jules Bean
-
Oliver Batchelor
-
Re, Joseph (IT)