[plt-scheme] ATTN: Neil Van Dyke (and some philosophical musings on debuggers)

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Sep 15 23:14:02 EDT 2004

What about a functional program that has to model a Parcheesi game?
Parcheesi has a ring around the board, which I represented as a vector,
using modular arithmetic (I never bang into the vector, except to
initialize it).

Also in Parcheesi, there are exit "ramps" that come out of the ring at
different places (one place for each player). During the game, each
player enters the ring just after the exit, makes a nearly complete
cycle and then moves off, into the exit ramp. It's illegal to pass
certain spaces on the board, depending on what's on that space and it's
illegal to go too far (off the end of the exit ramp -- it's possible to
attempt to move from the main ring off the end of the exit ramp, based
on the numbers you could legally move an individual piece in one turn).

Writing a function that detects illegal moves requires keeping all of
that straight, and getting it working right is far easier if you can
see what the values of variables as the program runs on some of the
weireder situations. Sure, I used printf, but I consider printf a
debugger, in this case. What I really needed was the ability to see
what's happening in my program as it executes. Isn't that what a
debugger does? (Lord knows, _I'm_ the one that actually removed the
bugs!)

Robby

[ My corner has little Jack Horner and I've just stolen his pie ]


Posted on the users mailing list.