[Haskell-cafe] Re: Haskell shootout game

Oliver Batchelor saulzar at gmail.com
Mon Jul 16 07:35:44 EDT 2007


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!


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

Oliver Batchelor

On 7/16/07, apfelmus <apfelmus at quantentunnel.de> 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.
> > 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070716/e3553a70/attachment.htm

More information about the Haskell-Cafe mailing list