## Assignmen 1 ## Teresa Brooks & Janet Cheng ## CS 630 ## 2/21/2008 ############################ Move-eater-around operator ############################ # # Propose*move-north: # If I exist, then propose the move-north operator. sp {propose*move-north (state ^io.input-link ) ( ^eater ^my-location.north.content { <> wall }) ( ^x ^y ) --> ( ^operator + >) # give move north higher preference because when we first ran this agent a tie was produced between move-north and move-east ( ^name move-north)} # Apply*move-north: # If the move-north operator is selected, then generate an output command to # move north. sp {apply*move-north (state ^operator ^io ) ( ^output-link ) ( ^name move-north) --> ( ^move ) ( ^direction north)} # Propose*move-east: # If I exist, then propose the move-east operator. sp {propose*move-east (state ^io.input-link ) ( ^eater ^my-location.east.content { <> wall }) # if we are moving east and there is a wall stop ( ^x ^y ) --> ( ^operator +) ( ^name move-east)} # Apply*move-east: # If the move-east operator is selected, then generate an output command to # move east. sp {apply*move-east (state ^operator ^io ) ( ^output-link ) ( ^name move-east) --> ( ^move ) #attach command to the output link ( ^direction east)} # send command to move east on the output link # propose*move-south sp {propose*move-south (state ^io.input-link ) ( ^eater ^my-location.east.content {= wall} ^my-location.south.content {<> wall}) ( ^x ^y ) --> ( ^operator + >) ( ^name move-south)} # apply*move-south sp {apply*move-south (state ^operator ^io ) ( ^output-link ) ( ^name move-south) --> ( ^move ) ( ^direction south)} # propose*move-west sp {propose*move-west (state ^io.input-link ) ( ^eater ^my-location.south.content {= wall} ^my-location.west.content {<> wall}) ( ^x ^y ) --> ( ^operator + >) ( ^name move-west)} # apply*move-west sp {apply*move-west (state ^operator ^io ) ( ^output-link ) ( ^name move-west) --> ( ^move ) ( ^direction west)} #select south better than north sp {select*move*south*better*than*north (state ^operator + ^operator +) ( ^name move-south) ( ^name move-north) --> ( ^operator > )} #select west better than north sp {select*move*west*better*than*north (state ^operator + ^operator +) ( ^name move-west) ( ^name move-north) --> ( ^operator > )} # apply*move-north*remove-move: sp {apply*move-north*remove-move (state ^operator.name move-north ^io.output-link ) ( ^move ) ( ^status complete) --> ( ^move -)} # apply*move-east*remove-move: sp {apply*move-east*remove-move (state ^operator.name move-east ^io.output-link ) ( ^move ) ( ^status complete) --> ( ^move -)}