[plt-scheme] another game: pacman

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Thu Aug 17 09:15:06 EDT 2006

Nice!  It worked out of the box for me, which is incredible
(load of stuff doesn't work on my Linux box).  Game play
was smooth, except for a few random pauses which I assume
were caused by GC.

I've had to write many similar programs for my PhD work,
and I quite like the communicating sequential processes
(CSP) style for this sort of system.  In the CSP style you
have a bunch of threads that communicate via channels.  For
Pacman you'd have a game world thread, threads for each
ghost, and a thread for the player.  The game world thread
is the boss and tells the other threads when to stop and
start, and when to perform particular actions.  The other
threads response to commands from the game world thread. 
Each thread is a tail recursive loop. I find this style
much easier to program reactive systems in than OO style. 
There is much less explicit state, and you get your main
loop back.  [This is basically the Erlang style, and also
very similar to FRP]

HTH,
Noel

--- Jon Rafkind <workmin at ccs.neu.edu> wrote:

> I wrote pacman in scheme using the Allegro planet package
> I made. It
> should run on windows and linux, but not OS X. It comes
> with 2 levels
> and there is a level editor should you choose to use it.
> 
> download: http://www.rafkind.com/jon/tar/pacman-0.1.zip
> 
> To use the editor uncomment out (editor) and comment out
> (run) at the
> bottom of pacman.ss.
> Screenshots/more info:
>
http://www.rafkind.com/jon/showproject.php?id=37&entry=105
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 


Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
AIM: noelhwelsh
Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Posted on the users mailing list.