Blocks World
Worksheet 1

 

                                       Name _____________


1. Define a class "basic-block" with the following slots and slot
   properties.
   
   Slot          Accessor          Initial Argument  Default 
   ---------------------------------------------------------
   name          block-name          name
   width         block-width         width
   height        block-height        height
   position      block-position      position         nil

2. Define the following classes.
   
   Class            Superclass(es)        Additional slots
   -----------------------------------------------------------
movable-block        basic-block      
load-bearing-block   basic-block       support-for w/ accessor
                                             block-support-for
                                       & initial value as nil
   

brick               movable-block,
                load-bearing-block

wedge               movable-block
ball                movable-block
table               load-bearing-block

3. Define a class "hand" to move the blocks around the table.

   Slot          Accessor          Initial Argument   Default
   -----------------------------------------------------------
   name          hand-name         name		      (none)
   position      hand-position     position           (none)
   grasping      hand-grasping     (none)               nil

4. Use defvar to define a global variable *blocks* that is a list
   of the current blocks.  Use make-instance to create each new object
   in the list.

   Object      Name      Width    Height    Position
   --------------------------------------------------
   table       table     20       0         (0 0)
   brick       brick1    2        2         (0 0)
   brick       brick2    2        2         (2 0)
   brick       brick3    4        4         (4 0)
   brick       brick4    2        2         (8 0)
   wedge       wedge1    2        4         (10 0)
   brick       brick5    4        2         (12 0)
   wedge       wedge2    2        2         (16 0)
   ball        ball8     2        2         (18,0)















"If once a man indulges himself in murder, very soon he comes to think
little of robbing; and from robbing he next comes to drinking and
Sabbath-breaking, and from that to incivility and procrastination."
                -- Thomas De Quincey (1785 - 1859)