Living in a Scheme world

posted by: Ms. Martin 17 October 2010 No Comment

You know a lot of Scheme and a lot of deep CS concepts.  It’s time to start making the 10 Commandments of Egoless Programming more relevant by launching into a pair project using other people’s code.

Make sure you’ve carefully read the textbook section on designing world programs. Pay special attention to the space invaders example.

You may also want to check out How to Design Worlds, a longer world example worked through.  Note that this uses an older version of the universe teachpack so not all the function names will match!  That’s totally maddening but it’s also entirely realistic — software almost always changes more rapidly than its documentation.

Before you decide what you will be designing and building, make sure this all makes sense to you:

  • you need to pick a way to represent the state of the world.  This will often include nested structures and lists.  Be sure to write thorough data definitions!
  • big-bang takes in the initial state of the world and one or more event handlers
  • to-draw specifies what to visually display based on a world’s state.  Its parameter is a function that takes in a world state and returns a scene (image)
  • on-tick specifies what to do at every tick of the clock.  Its parameter is a function that takes a world state and returns a modified world state.  That function is called every 1/28th of a second
  • on-key specifies what to do when a particular key is pressed.  Its parameter is a function that takes a world state and a key and returns a modified world state based on the key pressed.  That function is called every time any key is pressed
  • stop-when specifies when the simulation should stop.  Its parameter is a function that takes in a world state and produces a boolean.  When that boolean is true, the clock stops, key presses stop being read, etc

You’re free to design pretty much any game/simulation/application you want.  The minimum requirements are:

  • You must use world
  • At least one person can control at least one element on the screen
  • At least three separate entities are on the screen and moving (at some point)
  • At least two entities interact with each other (at some point)
  • There is some way for the simulation to end

Some ideas with guidance:

1 Star2 Stars3 Stars4 Stars5 Stars (39 votes, average: 2.95 out of 5)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>