Simple robot simulation game as an introduction to FP (Was: [plt-scheme] Examples of Scheme (or Lisp) in real-world)

From: Ciprian Dorin, Craciun (ciprian.craciun at
Date: Tue Mar 16 16:51:42 EDT 2010

    Mr. Shriram, after I've read your previous critique to my current
laboratory material -- and I agree with you, they were quite boring --
I've decided to follow your advice and try a different approach (this
is also related with my previous email to the list entitled
"Continuations memory accumulation problem").

    So before describing my new approach, I would like to ask you (if
your time permits) (and everyone else interested) about your opinion
related to this... (Criticism is highly appreciated.) :)

    I've created a small robot simulation platform inspired from GNU
Robots (that I've entitled PLT Robots). This should allow the students
to program some simple robots that live in a two-D matrix world, being
able only to move from tile to tile. Their purpose is simple: collect
food or prizes, avoid (static) baddies or zap them.

    My intents regarding with functional programming:
    * in the beginning the way the robot framework is implemented
permits and encourages mostly imperative programming; this way I hope
that I can start a spark in the minds of my students and get them to
gain interest in Lisp; so at this stage we shall implement a simle
robot AI in terms of imperative programming constructs;
    * then in the second step I intend to introduce them to functional
programming concepts like lists, (tail) recursion, map-ing, lambda's,
etc.; this shall be done in the same (imperative) framework as above,
but this time we try to implement the simple AI in a functional way,
and keep only the robot-control as imperative constructs; (for example
I could ask them to create a memory for the robot by keeping a list of
operations, backtrack the robot to a certain position, etc.)
    * the next step would be to drop the current framework and move to
one that uses the HtDP worlds module, and by using the method
presented to me by Anthony, we would reimplement the robots by using
only (pure) functional programming;
    * and at the end I would like to introduce syntaxes which could
complete the DSL, obtained at the previous step, with what is missing
or is not pleasant to the eye;

    So, what is your opinion on my current approach?

    My current framework (quite unpolished but working) can be found
at the following address:

    Thank you all for your time! I've learned a lot these two weeks! I
just hope I'm able to transmit all this to my students.

On Thu, Mar 11, 2010 at 3:38 PM, Shriram Krishnamurthi <sk at> wrote:
> In my opinion, students don't always know what to do with choice.  You
> would be better off picking two good projects, from two different
> areas, and doing them in depth, rather than giving your students a
> bewildering array of options that they may not even be qualified to
> choose from.  And if you pick your projects well, you can start doing
> them on day 1, rather than this boring walk through minutiae.
> See how Matthias's intro course does it.  And he does this with
> students at a middling institution, so no accusations of elitism will
> stick there.
> [... snip ...]

On Wed, Mar 10, 2010 at 3:50 AM, Shriram Krishnamurthi <sk at> wrote:
> Ciprian,
> I followed upward from the URL you sent earlier, and got here:
> Are the lab materials listed here an accurate depiction of what the
> course is covering?
> And if so, is there a chance that -- and this is the point where I
> remind you to fasten your flak jacket -- is there a chance that the
> students are...bored to tears?
> You say that most of your students want to build *something*.  Of
> course most of them don't know what they want to build -- that's why
> they're students.  But they still represent a great starting point: a
> desire to DO, rather than a desire to sit back, relax, and hope that
> their diploma will guarantee them riches.
> Putting such students through this lab material...well, if I were them
> (and I was, one of those students who wanted to DO something), I would
> be in deep rebellion too.
> Shriram

Posted on the users mailing list.