[plt-scheme] another game: pacman

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Aug 17 23:28:52 EDT 2006

On Aug 17, 2006, at 9:15 AM, Noel Welsh wrote:

> 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]

Indeed, this is how we actually teach HtDP these days, though more  
with a world-passing style and clock-based invocations rather than  
thread-based ones. [That comes later in the curriculum, where Robby  
and I are developing a third-semester miniSE course.] OO is still a  
good structuring tool for inside the loops. --- HtDP2e will start out  
with these things so that students can write a full-fledged  
interactive, event-driven game within weeks from the start.

-- Matthias

> 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
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.