[Edu-sig] Vacuum World version 1e-6alpha ;) released
Brian Blais
bblais at bryant.edu
Mon Apr 3 20:27:49 CEST 2006
Hello,
I am just learning Python, and my first somewhat significant project is now available at
http://web.bryant.edu/~bblais/python/vac.tgz
What is it?
Vacuum World is a simple simulation environment used to introduce some concepts in
Artificial Intelligence (Norvig, 2002), but can also be used as a simple introduction
to a programming language. In this case, of course, it is in Python. You write
python scripts to control a vacuum cleaner in a simulated room of dirt and furniture,
trying to vacuum up as much dirt and get back home to turn off. I've used wax to
make a nice gui for running the simulator.
A sample agent might look like:
Forward()
if IsDirt():
Vacuum()
Off()
Some Questions:
As I was making this, I had a number of issues. I invite anyone who cares to look
at the code to give me feedback about anything from GUI development, to code
organization, or anything else. I have a few questions right off the bat:
1) how is code like this usually distributed? Does one make a setup.py to install it
somewhere, and are there certain files that should be in the distribution that I
don't have? Should it include a windows binary from py2exe too?
2) I had some problems getting the center panel to fit right. I'd like to have it so
that when I resize the board, that the window grows and shrinks to the right size,
down to a minimum size (so I can still see the menus). I could do this, using the
Fit() method, but I found at the smaller sizes the individual images in the panel
started to have large (and growing) spaces between them. I'd rather the whole board
be centered in the panel. I tried every combination of Pack() and Fit() and
expand=... and align=... , but couldn't get it to work.
3) what sorts of documentation are standard for this? is there a standard way of
formatting docstrings (and am I thinking correctly that docstrings are just the
quoted strings right after a function declaration?)?
I'm sure that I will have more, but answers to these questions will get me a long
way. Let me know what you think! Please be gentle, because this is really my first
somewhat significant python project, so there is probably some cruft from my Matlab
and C experience (stray semi-colons here and there, etc.)
thanks,
Brian Blais
--
-----------------
bblais at bryant.edu
http://web.bryant.edu/~bblais
More information about the Edu-sig
mailing list