(FILECREATED "23-JUN-83 11:12:46" {INDIGO}<LOOPS>TRUCKIN>PLAYERS>HOUSEPLAYER.;5 68675  

      changes to:  (CLASSES HousePlayer)
		   (INSTANCES MaxPurchaseHousePlayerRules RateSpotsNearAlicesHousePlayerRules)
		   (VARS HOUSEPLAYERCOMS)
		   (FNS MaxPurchaseHousePlayerRules RateSpotsNearAlicesHousePlayerRules)

      previous date: "16-JUN-83 18:55:52" {INDIGO}<LOOPS>TRUCKIN>PLAYERS>HOUSEPLAYER.;4)


(PRETTYCOMPRINT HOUSEPLAYERCOMS)

(RPAQQ HOUSEPLAYERCOMS ((INSTANCES FindStoppingPlaceHousePlayerRules 
				   GoToStoppingPlaceHousePlayerRules HPRateConsumers 
				   HPRateGasStations HPRateProducers MaxPurchaseHousePlayerRules 
				   RateSpotsNearAlicesHousePlayerRules SellGoodsHousePlayerRules 
				   TakeTurnHousePlayerRules)
			(CLASSES HousePlayer)
			(FNS FindStoppingPlaceHousePlayerRules GoToStoppingPlaceHousePlayerRules 
			     HPRateConsumers HPRateGasStations HPRateProducers 
			     MaxPurchaseHousePlayerRules RateSpotsNearAlicesHousePlayerRules 
			     SellGoodsHousePlayerRules TakeTurnHousePlayerRules)))
(DEFINST RuleSet (FindStoppingPlaceHousePlayerRules "YSSC@<>`")
	 (perspectiveNode #&(RuleSetNode "YSSC@<>r") myViewName RuleSet)
	 (name #(FindStoppingPlaceHousePlayerRules NIL RememberName))
	 (compiledRules FindStoppingPlaceHousePlayerRules)
	 (workSpace HousePlayer)
	 (args NIL)
	 (tempVars (wStation gasStation))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 5)
	 (controlStructure DO1)
	 (whileCondition NIL)
	 (compilerOptions (PR A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (GoToStoppingPlaceHousePlayerRules "YWSC@8@L")
	 (perspectiveNode #&(RuleSetNode "YWSC@8@S") myViewName RuleSet)
	 (name #(GoToStoppingPlaceHousePlayerRules NIL RememberName))
	 (compiledRules GoToStoppingPlaceHousePlayerRules)
	 (workSpace HousePlayer)
	 (args NIL)
	 (tempVars (realLocation numBuy))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 8)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (HPRateConsumers "YWSC@8@p")
	 (perspectiveNode #&(RuleSetNode "YWSC@8AO") myViewName RuleSet)
	 (name #(HPRateConsumers NIL RememberName))
	 (compiledRules HPRateConsumers)
	 (workSpace HousePlayer)
	 (args (rs))
	 (tempVars (rating cargo))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 9)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (HPRateGasStations "YSSC@<>m")
	 (perspectiveNode #&(RuleSetNode "YSSC@<>s") myViewName RuleSet)
	 (name #(HPRateGasStations NIL RememberName))
	 (compiledRules HPRateGasStations)
	 (workSpace HousePlayer)
	 (args (rs))
	 (tempVars (rating))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (HPRateProducers "YWSC@8@h")
	 (perspectiveNode #&(RuleSetNode "YWSC@8AP") myViewName RuleSet)
	 (name #(HPRateProducers NIL RememberName))
	 (compiledRules HPRateProducers)
	 (workSpace HousePlayer)
	 (args (rs))
	 (tempVars (rating maxBuy))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 12)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (MaxPurchaseHousePlayerRules "UVSC@ENE")
	 (perspectiveNode #&(RuleSetNode "UVSC@ENn") myViewName RuleSet)
	 (name #(MaxPurchaseHousePlayerRules NIL RememberName))
	 (compiledRules MaxPurchaseHousePlayerRules)
	 (workSpace HousePlayer)
	 (args (roadStop))
	 (tempVars (volumeCapacity weightCapacity volumeLimit weightLimit cashLimit producerLimit 
				   numBuy cashCapacity))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 3)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass))



(DEFINST RuleSet (RateSpotsNearAlicesHousePlayerRules "UVSC@END")
	 (perspectiveNode #&(RuleSetNode "UVSC@ENo") myViewName RuleSet)
	 (name #(RateSpotsNearAlicesHousePlayerRules NIL RememberName))
	 (compiledRules RateSpotsNearAlicesHousePlayerRules)
	 (workSpace HousePlayer)
	 (args (roadStop))
	 (tempVars (rating cargo))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass))



(DEFINST RuleSet (SellGoodsHousePlayerRules "YWSC@8@x")
	 (perspectiveNode #&(RuleSetNode "YWSC@8AQ") myViewName RuleSet)
	 (name #(SellGoodsHousePlayerRules NIL RememberName))
	 (compiledRules SellGoodsHousePlayerRules)
	 (workSpace HousePlayer)
	 (args NIL)
	 (tempVars (cargo sellQty))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 5)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (TakeTurnHousePlayerRules "YSSC@<>")
	 (perspectiveNode #&(RuleSetNode "YSSC@<↑") myViewName RuleSet)
	 (name #(TakeTurnHousePlayerRules NIL RememberName))
	 (compiledRules TakeTurnHousePlayerRules)
	 (workSpace HousePlayer)
	 (args NIL)
	 (tempVars (possibleStops gasStation))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 9)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSetNode ("YSSC@<>r")
	 (perspectives ? RuleSet #&(RuleSet "YSSC@<>`") Source #&(RuleSetSource "YSSC@<>t")))



(DEFINST RuleSetNode ("YWSC@8@S")
	 (perspectives ? RuleSet #&(RuleSet "YWSC@8@L") Source #&(RuleSetSource "YWSC@8@T")))



(DEFINST RuleSetNode ("YWSC@8AO")
	 (perspectives ? RuleSet #&(RuleSet "YWSC@8@p") Source #&(RuleSetSource "YWSC@8AR")))



(DEFINST RuleSetNode ("YSSC@<>s")
	 (perspectives ? RuleSet #&(RuleSet "YSSC@<>m") Source #&(RuleSetSource "YSSC@<>u")))



(DEFINST RuleSetNode ("YWSC@8AP")
	 (perspectives ? RuleSet #&(RuleSet "YWSC@8@h") Source #&(RuleSetSource "YWSC@8AS")))



(DEFINST RuleSetNode ("UVSC@ENn")
	 (perspectives ? RuleSet #&(RuleSet "UVSC@ENE") Source #&(RuleSetSource "UVSC@ENp")))



(DEFINST RuleSetNode ("UVSC@ENo")
	 (perspectives ? RuleSet #&(RuleSet "UVSC@END") Source #&(RuleSetSource "UVSC@ENq")))



(DEFINST RuleSetNode ("YWSC@8AQ")
	 (perspectives ? RuleSet #&(RuleSet "YWSC@8@x") Source #&(RuleSetSource "YWSC@8AT")))



(DEFINST RuleSetNode ("YSSC@<↑")
	 (perspectives ? RuleSet #&(RuleSet "YSSC@<>") Source #&(RuleSetSource "YSSC@<←")))



(DEFINST RuleSetSource ("YSSC@<>t")
	 (indexedVars ((#&(Rule "UPSC@ELn"))
		       (#&(Rule "UPSC@ELo"))
		       (#&(Rule "UPSC@ELp"))
		       (#&(Rule "UPSC@ELq"))
		       (#&(Rule "UPSC@ELr"))
		       (#&(Rule "YSSC@<>l"))
		       (#&(Rule "FAS@@&Lp"))))
	 (perspectiveNode #&(RuleSetNode "YSSC@<>r") myViewName Source)
	 (created " 1-FEB-83 14:25:23")
	 (creator LOOPSCOURSE)
	 (edited "16-JUN-83 15:08:48")
	 (editor MITTAL))



(DEFINST RuleSetSource ("YWSC@8@T")
	 (indexedVars ((#&(Rule "UPSC@EMi"))
		       (#&(Rule "UPSC@EMw"))
		       (#&(Rule "UPSC@EMx"))
		       (#&(Rule "UPSC@EMy"))
		       (#&(Rule "UPSC@EMj"))
		       (#&(Rule "UPSC@EMz"))
		       (#&(Rule "UPSC@EM{"))
		       (#&(Rule "UPSC@EMk"))))
	 (perspectiveNode #&(RuleSetNode "YWSC@8@S") myViewName Source)
	 (created " 1-FEB-83 14:25:34")
	 (creator LOOPSCOURSE)
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL))



(DEFINST RuleSetSource ("YWSC@8AR")
	 (indexedVars ((#&(Rule "UPSC@ELs"))
		       (#&(Rule "UPSC@ELt"))
		       (#&(Rule "UPSC@ELu"))
		       (#&(Rule "UPSC@ELv"))
		       (#&(Rule "UPSC@ELw"))
		       (#&(Rule "UPSC@ELx"))
		       (#&(Rule "UPSC@ELy"))
		       (#&(Rule "UPSC@ELz"))
		       (#&(Rule "UPSC@EL{"))))
	 (perspectiveNode #&(RuleSetNode "YWSC@8AO") myViewName Source)
	 (created "18-FEB-83 22:45:14")
	 (creator STEFIK)
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL))



(DEFINST RuleSetSource ("YSSC@<>u")
	 (indexedVars ((#&(Rule "UOSC@E\p"))
		       (#&(Rule "UOSC@E\q"))
		       (#&(Rule "UOSC@E\r"))
		       (#&(Rule "UOSC@E\s"))
		       (#&(Rule "UOSC@E\t"))
		       (#&(Rule "UOSC@E\u"))))
	 (perspectiveNode #&(RuleSetNode "YSSC@<>s") myViewName Source)
	 (created "19-MAY-83 17:26:44")
	 (creator MITTAL)
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL))



(DEFINST RuleSetSource ("YWSC@8AS")
	 (indexedVars ((#&(Rule "UPSC@EM\"))
		       (#&(Rule "UPSC@EM]"))
		       (#&(Rule "UPSC@EM↑"))
		       (#&(Rule "UPSC@EM←"))
		       (#&(Rule "UPSC@EM`"))
		       (#&(Rule "UPSC@EMa"))
		       (#&(Rule "UPSC@EMb"))
		       (#&(Rule "UPSC@EMc"))
		       (#&(Rule "UPSC@EMd"))
		       (#&(Rule "UPSC@EMe"))
		       (#&(Rule "UPSC@EMf"))
		       (#&(Rule "UPSC@EMg"))))
	 (perspectiveNode #&(RuleSetNode "YWSC@8AP") myViewName Source)
	 (created "18-FEB-83 22:45:14")
	 (creator STEFIK)
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL))



(DEFINST RuleSetSource ("UVSC@ENp")
	 (indexedVars ((#&(Rule "UISC@AMT"))
		       (#&(Rule "UISC@AMU"))
		       (#&(Rule "UISC@AMV"))
		       (#&(Rule "UISC@<{l"))
		       (#&(Rule "FBS@@A?V"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENn") myViewName Source)
	 (created " 1-FEB-83 14:25:11")
	 (creator LOOPSCOURSE)
	 (edited " 9-JUN-83 22:34:09")
	 (editor STEFIK))



(DEFINST RuleSetSource ("UVSC@ENq")
	 (indexedVars ((#&(Rule "UISC@AMj"))
		       (#&(Rule "UISC@AMk"))
		       (#&(Rule "UISC@AMl"))
		       (#&(Rule "UISC@AMm"))
		       (#&(Rule "UISC@AMn"))
		       (#&(Rule "UISC@AMo"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENo") myViewName Source)
	 (created "18-FEB-83 20:41:23")
	 (creator STEFIK)
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK))



(DEFINST RuleSetSource ("YWSC@8AT")
	 (indexedVars ((#&(Rule "UOSC@E]B"))
		       (#&(Rule "UOSC@E]C"))
		       (#&(Rule "UOSC@E]D"))
		       (#&(Rule "UOSC@E]E"))
		       (#&(Rule "UOSC@ELn"))
		       (#&(Rule "YWSC@8Am"))
		       (#&(Rule "FBS@@A?b"))
		       (#&(Rule "FBS@@A?c"))))
	 (perspectiveNode #&(RuleSetNode "YWSC@8AQ") myViewName Source)
	 (created " 1-FEB-83 14:25:40")
	 (creator LOOPSCOURSE)
	 (edited "15-JUN-83 15:49:26")
	 (editor MITTAL))



(DEFINST RuleSetSource ("YSSC@<←")
	 (indexedVars ((#&(Rule "UPSC@EMn"))
		       (#&(Rule "UPSC@EMo"))
		       (#&(Rule "UPSC@EMp"))
		       (#&(Rule "UPSC@EMq"))
		       (#&(Rule "UPSC@EMr"))
		       (#&(Rule "UPSC@EMs"))
		       (#&(Rule "UPSC@EMt"))
		       (#&(Rule "UPSC@EMu"))
		       (#&(Rule "UPSC@EM|"))))
	 (perspectiveNode #&(RuleSetNode "YSSC@<↑") myViewName Source)
	 (created " 1-FEB-83 14:25:51")
	 (creator LOOPSCOURSE)
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL))



(DEFINST Rule ("UPSC@ELn")
	 (source 

"(* Returns a stopping place en route to a destination.)

(* If already at destination, make it be stoppingPlace)
IF truck:location=destination
THEN stoppingPlace←destination;")
	 (edited "16-JUN-83 15:08:48")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YSSC@<>`")))



(DEFINST Rule ("UPSC@ELo")
	 (source 

"(* Obey the law - stop at WeighStations.)
IF truck:cargo
   wStation←(NearestRoadStop (RoadStops $WeighStation .Range1 direction 'Room))
   (Distance wStation)<(Distance destination) 
THEN stoppingPlace←wStation;")
	 (edited "16-JUN-83 15:08:48")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YSSC@<>`")))



(DEFINST Rule ("UPSC@ELp")
	 (source 
   "IF (Distance destination)<=.Range1 (RoomToParkP destination)
THEN stoppingPlace←destination;")
	 (edited "16-JUN-83 15:08:48")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YSSC@<>`")))



(DEFINST Rule ("UPSC@ELq")
	 (source 

"IF goal~='GoToAlices
   truck:fuel < .6 * truck::MaxFuel
   gasStation←(FurthestRoadStop (RoadStops $GasStation .Range1 direction 'Room))
   gasStation:qty>0
THEN stoppingPlace←gasStation;")
	 (edited "16-JUN-83 15:08:48")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YSSC@<>`")))



(DEFINST Rule ("UPSC@ELr")
	 (source 

"THEN stoppingPlace←(NthRoadStop  (IMIN .Range1  (Distance destination))
                                 direction NIL 'Room);")
	 (edited "16-JUN-83 15:08:48")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YSSC@<>`")))



(DEFINST Rule ("YSSC@<>l")
	 (source "THEN stoppingPlace←(NthRoadStop  maxMove direction NIL 'Room);")
	 (edited "19-MAY-83 17:26:15")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "YSSC@<>`")))



[DEFINST Rule ("FAS@@&Lp")
	 (source NIL)
	 (edited " 1-FEB-83 14:25:33")
	 (editor "LOOPSCOURSE")
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "FAS@@&Li"))
	 (lhs (AND))
	 (rhs (SETQ ↑value (PROGN (PROGN                     (* Rule Tracing Code)
					 (TraceRHS NIL 7)
					 (← (GetObjFromUID "FAS@@&Lp")
					    Print))
				  (NthRoadStop maxMove (GetValue self (QUOTE direction]



(DEFINST Rule ("UPSC@EMi")
	 (source "	THEN direction← (DirectionOf destination);")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EMw")
	 (source "        -> realLocation←truck:location;")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EMx")
	 (source 

"	IF .FindStoppingPlace stoppingPlace~=truck:location
           ~stoppingPlace.BanditP
	THEN (← \gameMaster Move stoppingPlace) 
               realLocation←truck:location;")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EMy")
	 (source 
"        IF realLocation~=stoppingPlace 
	THEN (WriteGameStatus %"Oh!! %" driver %" intercepted!%");")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EMj")
	 (source 

"	IF (ISA realLocation $GasStation) realLocation:qty > 0
	THEN .BuyGas goal←'Peddle destination←NIL (STOP 'Peddle NIL 'BoughtGas);")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EMz")
	 (source 

"	IF (ISA realLocation $Producer) 
           goal='Peddle
	   realLocation=destination 
           numBuy←(← self MaxPurchase realLocation)
           numBuy>=1  
	THEN (← \gameMaster Buy numBuy);")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EM{")
	 (source "	IF (ISA realLocation $Consumer) truck:cargo
	THEN .SellGoods;")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@EMk")
	 (source "        IF realLocation=destination
         THEN destination←NIL;")
	 (edited "16-JUN-83 18:34:08")
	 (editor MITTAL)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "YWSC@8@L")))



(DEFINST Rule ("UPSC@ELs")
	 (source 
      "	(* Rate the suitability of a proposed Consumer.)

-> cargo ← (CAR truck:cargo) rating←0;")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELt")
	 (source 

"(* if spoilt go to CityDump)
IF ~cargo:status (ISA rs $CityDump) 
THEN (STOP 5000 'CityDump 'LookNoMore);")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELu")
	 (source "IF ~cargo:status
THEN (STOP NIL 'SpoiltGoods 'CannotSell);")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELv")
	 (source 

"(* Consumer must want current cargo.)
 IF ~(ISA cargo rs::Commodity)
  THEN (STOP -10000 NIL 'CannotSellHere);")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELw")
	 (source 

"(* Exclude consumers that have full inventory.)
 IF rs:qty < 1
  THEN (STOP -10000 NIL 'CannotSellHere);")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELx")
	 (source "(* Need to be able to park)
 IF ~(RoomToParkP rs)
  THEN rating ← rating - 200;")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELy")
	 (source "(* Dont go if Bandits)
IF rs.BanditP
 THEN rating ← rating - 10000;")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@ELz")
	 (source "(* Favor high price ratios.)
  -> rating ← rating + 100 * rs:pr ;")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UPSC@EL{")
	 (source 
 "(* Favor close places.)
  -> rating ← rating - 5 * [truck::Gpm *(Distance rs truck:location)];")
	 (edited "16-JUN-83 15:20:28")
	 (editor MITTAL)
	 (ruleNumber 9)
	 (ruleSet #&(RuleSet "YWSC@8@p")))



(DEFINST Rule ("UOSC@E\p")
	 (source "(* rate gas stations within range)
 THEN rating ← 0;")
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YSSC@<>m")))



(DEFINST Rule ("UOSC@E\q")
	 (source "IF rs:qty=0 
 THEN rating ← -2000;")
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YSSC@<>m")))



(DEFINST Rule ("UOSC@E\r")
	 (source "IF ~(RoomToParkP rs)
 THEN rating ← rating - 200;")
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YSSC@<>m")))



(DEFINST Rule ("UOSC@E\s")
	 (source "IF rs.BanditP
 THEN rating ← rating - 200;")
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YSSC@<>m")))



(DEFINST Rule ("UOSC@E\t")
	 (source " THEN rating ← rating - [10 * (Distance rs truck:location)];")
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YSSC@<>m")))



(DEFINST Rule ("UOSC@E\u")
	 (source " THEN rating ← rating + (IMIN rs:qty truck::MaxFuel);")
	 (edited "15-JUN-83 17:46:12")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "YSSC@<>m")))



(DEFINST Rule ("UPSC@EM\")
	 (source "	(* Rate the suitability of a proposed Producer.)
-> rating ← 0;")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EM]")
	 (source 
      "(* Exclude gas stations.)
 IF (ISA rs $GasStation)
  THEN (STOP -100000 NIL 'GasStation);")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EM↑")
	 (source 
  "(* Exclude producers that are sold out.)
 IF rs:qty < 1
  THEN (STOP -100000 NIL 'CannotBuy);")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EM←")
	 (source 

"(* Penalize producers for which can buy < 1 items.)
 IF maxBuy←(← self MaxPurchase rs) 
    maxBuy < 1
  THEN (STOP -100000 NIL 'CannotBuy);")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EM`")
	 (source "(* Need to be able to park)
IF ~(RoomToParkP rs)
 THEN rating ← -500;")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMa")
	 (source "(* If Bandits there, dont go)
IF rs.BanditP
THEN rating ← rating - 10000;")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMb")
	 (source 

"(* Exclude perishables.)
 IF (SUBCLASS rs::Commodity $PerishableCommodity)
  THEN rating ← rating - 2000 + [100 * rs::Commodity::MinLifetime];")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMc")
	 (source 

"(* Exclude excessively fragile goods.)
 IF (SUBCLASS rs::Commodity $FragileCommodity)  
  THEN rating ← rating - [100 * rs::Commodity::FragilityLevel];")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMd")
	 (source 
    "(* favor LuxuryGoods)
IF (SUBCLASS rs::Commodity $LuxuryGoods)
THEN rating ← rating + 1000;")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 9)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMe")
	 (source "IF (SUBCLASS rs::Commodity $Xerox1100)
THEN rating ← rating + 1000 ;")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 10)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMf")
	 (source "(* favor higher qty)
 -> rating ← rating + [20 * maxBuy];")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 11)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UPSC@EMg")
	 (source 
"(* Favor close places.)
  -> rating ← rating - [10 * truck::Gpm * (Distance rs truck:location)];")
	 (edited "16-JUN-83 17:34:34")
	 (editor MITTAL)
	 (ruleNumber 12)
	 (ruleSet #&(RuleSet "YWSC@8@h")))



(DEFINST Rule ("UISC@AMT")
	 (source 

"	(* Rules for deciding how much the Peddler could buy at a Producer.)

(* Sale can be limited by volume, weight, cash, or availability.)

-> volumeCapacity ← truck::MaxVolume-truck:volume
   weightCapacity ← truck::MaxWeight-truck:weight
   cashCapacity ← (MAX 0  truck:cashBox-cashReserve);")
	 (edited " 9-JUN-83 22:34:09")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$TR")))



(DEFINST Rule ("UISC@AMU")
	 (source 

"   
-> volumeLimit ← volumeCapacity / roadStop::Commodity::VolPerQty
   weightLimit ← weightCapacity / roadStop::Commodity::WtPerQty
   cashLimit ← cashCapacity / (PricePerUnit roadStop)
   producerLimit ← roadStop:qty;")
	 (edited " 9-JUN-83 22:34:09")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$TR")))



(DEFINST Rule ("UISC@AMV")
	 (source "-> numBuy ← (MIN volumeLimit weightLimit cashLimit producerLimit);")
	 (edited " 9-JUN-83 22:34:09")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$TR")))



(DEFINST Rule ("UISC@<{l")
	 (source "-> numBuy ← (MIN volumeLimit weightLimit cashLimit producerLimit);")
	 (edited " 9-JUN-83 17:59:43")
	 (editor BOBROW)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$TR")))



[DEFINST Rule ("FBS@@A?V")
	 (source NIL)
	 (edited " 2-FEB-83 14:52:17")
	 (editor "LOOPSCOURSE")
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FAS@@&Lh"))
	 (lhs (GREATERP qtyLimit 0))
	 (rhs (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← (GetObjFromUID "FAS@@<\")
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "FBS@@A?V")))
				  (← gameMaster Buy qtyLimit)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Sell)
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Buyers commodity))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE direction)
					       (DirectionOf (GetValue self (QUOTE destination)))
					       ↑auditRecord]



(DEFINST Rule ("UISC@AMj")
	 (source 

"(* Rating RuleSet for spots near Alices.  Returns a number for spots.)

-> cargo ← (CAR truck:cargo);")
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$PR")))



(DEFINST Rule ("UISC@AMk")
	 (source 
	"   (* Favor places closer to Alices.)
-> rating ← 100 - 4 * (Distance roadStop alices);")
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$PR")))



(DEFINST Rule ("UISC@AMl")
	 (source "IF ~(RoomToParkP roadStop)
 THEN rating ← -1000;")
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$PR")))



(DEFINST Rule ("UISC@AMm")
	 (source "IF (ISA roadStop $UnionHall)
 THEN rating ← -1000;")
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$PR")))



(DEFINST Rule ("UISC@AMn")
	 (source "IF (ISA roadStop $AlicesRestaurant)
 THEN rating ← -500;")
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$PR")))



(DEFINST Rule ("UISC@AMo")
	 (source 

"IF cargo (ISA roadStop $Consumer) (ISA cargo roadStop::Commodity)
   roadStop:qty>0 roadStop:pr>1
 THEN rating ← rating + 20;")
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$PR")))



(DEFINST Rule ("UOSC@E]B")
	 (source "(* Make sale as limited by cargo and consumer.)


	-> cargo←(CAR truck:cargo);")
	 (edited "15-JUN-83 15:49:26")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YWSC@8@x")))



(DEFINST Rule ("UOSC@E]C")
	 (source 
	 "	IF ~(ISA cargo truck:location::Commodity)
	THEN (STOP NIL 'NoSale 'WrongKindOfBuyer);")
	 (edited "15-JUN-83 15:49:26")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YWSC@8@x")))



(DEFINST Rule ("UOSC@E]D")
	 (source 

"        IF ~cargo:status (ISA truck:location $CityDump)
         THEN sellQty←(MIN truck:location:qty cargo:qty)
              (← \gameMaster Sell cargo sellQty)
              (STOP T 'Sold 'AtCityDump);")
	 (edited "15-JUN-83 15:49:26")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YWSC@8@x")))



(DEFINST Rule ("UOSC@E]E")
	 (source "	IF truck:location:pr < cargo:pr 
	THEN (STOP NIL 'NoSale 'AvoidLoss);")
	 (edited "15-JUN-83 15:49:26")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YWSC@8@x")))



(DEFINST Rule ("UOSC@ELn")
	 (source 

"	IF cargo:status sellQty←(MIN truck:location:qty cargo:qty) sellQty>=1 
	THEN (← \gameMaster Sell cargo sellQty) 
             cashReserve←(MIN 5000 (TIMES 0.1 truck:cashBox));")
	 (edited "15-JUN-83 15:49:26")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YWSC@8@x")))



(DEFINST Rule ("YWSC@8Am")
	 (source 

"	IF cargo:status sellQty←(MIN truck:location:qty cargo:qty) sellQty>=1 
	THEN (← gameMaster Sell cargo sellQty);")
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FRSC@$PC")))



[DEFINST Rule ("FBS@@A?b")
	 (source NIL)
	 (edited " 2-FEB-83 14:52:20")
	 (editor "LOOPSCOURSE")
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "FAS@@&Lr"))
	 (lhs (AND (PROGN                                    (* Rule Tracing Code)
			  (TraceLHS NIL 7)
			  (← (GetObjFromUID "FBS@@A?b")
			     Print))
		   (EQ cQty sellQty)))
	 (rhs (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← (GetObjFromUID "FAS@@<\")
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "FBS@@A?b")))
				  (PROGN                     (* Rule Tracing Code)
					 (TraceRHS NIL 7)
					 (← (GetObjFromUID "FBS@@A?b")
					    Print))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Buy)
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE destination)
					       NIL ↑auditRecord]



[DEFINST Rule ("FBS@@A?c")
	 (source NIL)
	 (edited " 2-FEB-83 14:52:20")
	 (editor "LOOPSCOURSE")
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "FAS@@&Lr"))
	 (lhs (AND (PROGN                                    (* Rule Tracing Code)
			  (TraceLHS NIL 8)
			  (← (GetObjFromUID "FBS@@A?c")
			     Print))
		   (LESSP sellQty cQty)))
	 (rhs (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← (GetObjFromUID "FAS@@<\")
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "FBS@@A?c")))
				  (PROGN                     (* Rule Tracing Code)
					 (TraceRHS NIL 8)
					 (← (GetObjFromUID "FBS@@A?c")
					    Print))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Buyers cargo1))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE direction)
					       (DirectionOf (GetValue self (QUOTE destination)))
					       ↑auditRecord]



(DEFINST Rule ("UPSC@EMn")
	 (source 

"   (* Top-Level RuleSet for taking turns.  Sets goal and destination.)

  (* If no fuel, but close to end with enough cash, sit tight)
 IF truck:fuel=0 truck:cashBox > 300000  \gameMaster:timeRemaining < 300
  THEN destination←NIL  goal←'SitTight;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMo")
	 (source 

"   (* Don't move away from Alices during endgame.)
 IF goal='GoToAlices (ISA truck:location $AlicesRestaurant)
  THEN goal←'SitTight;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMp")
	 (source 

"   (* make sure not overstaying at Alices)
 IF goal='SitTight (ISA truck:location $AlicesRestaurant)
      .TimeAtStop >=28
  THEN destination← (NearestRoadStop(RoadStops $AlicesRestaurant ))
     goal='GoToAlices;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMq")
	 (source 

"   (* Get near to Alices when time gets close)		
 IF \gameMaster:timeRemaining < 60 ~[goal<<'(SitTight GetClose GoToAlices)]  
  THEN alices←(NearestRoadStop (RoadStops $AlicesRestaurant))
       destination← (PickHiObj self 'RateSpotsNearAlices (RoadStops) )
       goal←'GetClose;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMr")
	 (source 

"   (* Go to Alices now that it is time)
 IF \gameMaster:timeRemaining < 29 
    ~(ISA truck:location $AlicesRestaurant)   
  THEN destination← (NearestRoadStop (RoadStops $AlicesRestaurant NIL NIL T))
       goal←'GoToAlices ;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMs")
	 (source 

" IF goal~='SitTight 
    truck:fuel < .35 * truck::MaxFuel
    truck:cashBox > 0
    gasStation←(PickHiObj self 'RateGasStations (RoadStops $GasStation .Range) )
  THEN goal←'BuyGas destination←gasStation;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMt")
	 (source 

" IF goal='Peddle truck:cargo  possibleStops←(Buyers (CAR truck:cargo) NIL T)
  THEN destination←(PickHiObj self 'RateConsumers possibleStops );")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EMu")
	 (source 

" IF goal='Peddle ~truck:cargo \gameMaster:timeRemaining > 70
    possibleStops←(RoadStops $Producer)
  THEN destination←(PickHiObj  self 'RateProducers possibleStops);")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST Rule ("UPSC@EM|")
	 (source " IF destination
  THEN .GoToStoppingPlace;")
	 (edited "16-JUN-83 18:52:33")
	 (editor MITTAL)
	 (ruleNumber 9)
	 (ruleSet #&(RuleSet "YSSC@<>")))



(DEFINST RuleSet (FindStoppingPlaceToyotaRules "FAS@@&Li")
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mh") myViewName RuleSet)
	 (name #(FindStoppingPlaceToyotaRules NIL RememberName))
	 (compiledRules FindStoppingPlaceToyotaRules)
	 (workSpace Toyota)
	 (args)
	 (tempVars (wStation gasStation))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (PeddlerMaxPurchase "FRSC@$TR")
	 (perspectiveNode #&(RuleSetNode "FRSC@$T←") myViewName RuleSet)
	 (name #(PeddlerMaxPurchase NIL RememberName))
	 (compiledRules PeddlerMaxPurchase)
	 (workSpace Peddler)
	 (args (roadStop))
	 (tempVars (volumeCapacity weightCapacity volumeLimit weightLimit cashLimit producerLimit 
				   numBuy cashCapacity))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 3)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (BuyGoodsToyotaRules "FAS@@&Lh")
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mg") myViewName RuleSet)
	 (name #(BuyGoodsToyotaRules NIL RememberName))
	 (compiledRules BuyGoodsToyotaRules)
	 (workSpace Toyota)
	 (args)
	 (tempVars (commodity volumeCapacity weightCapacity volumeLimit weightLimit cashLimit 
			      producerLimit numBuy))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 4)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (PeddlerRateSpotsNearAlices "FRSC@$PR")
	 (perspectiveNode #&(RuleSetNode "FRSC@$PY") myViewName RuleSet)
	 (name #(PeddlerRateSpotsNearAlices NIL RememberName))
	 (compiledRules PeddlerRateSpotsNearAlices)
	 (workSpace Peddler)
	 (args (roadStop))
	 (tempVars (rating cargo))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (SellGoodsPeddlerRules "FRSC@$PC")
	 (perspectiveNode #&(RuleSetNode "FRSC@$PH") myViewName RuleSet)
	 (name #(SellGoodsPeddlerRules NIL RememberName))
	 (compiledRules SellGoodsPeddlerRules)
	 (workSpace Peddler)
	 (args)
	 (tempVars (cargo sellQty))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSet (SellGoodsToyotaRules "FAS@@&Lr")
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mj") myViewName RuleSet)
	 (name #(SellGoodsToyotaRules NIL RememberName))
	 (compiledRules SellGoodsToyotaRules)
	 (workSpace Toyota)
	 (args)
	 (tempVars (cargo sellQty))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 4)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL)
	 (taskClass)
	 (arguments))



(DEFINST RuleSetNode ("FAS@@&Mh")
	 (perspectives ? RuleSet #&(RuleSet "FAS@@&Li") Source #&(RuleSetSource "FAS@@&Mn")))



(DEFINST RuleSetNode ("FRSC@$T←")
	 (perspectives ? RuleSet #&(RuleSet "FRSC@$TR") Source #&(RuleSetSource "FRSC@$T`")))



(DEFINST RuleSetNode ("FAS@@&Mg")
	 (perspectives ? RuleSet #&(RuleSet "FAS@@&Lh") Source #&(RuleSetSource "FAS@@&Mm")))



(DEFINST RuleSetNode ("FRSC@$PY")
	 (perspectives ? RuleSet #&(RuleSet "FRSC@$PR") Source #&(RuleSetSource "FRSC@$P[")))



(DEFINST RuleSetNode ("FRSC@$PH")
	 (perspectives ? RuleSet #&(RuleSet "FRSC@$PC") Source #&(RuleSetSource "FRSC@$PM")))



(DEFINST RuleSetNode ("FAS@@&Mj")
	 (perspectives ? RuleSet #&(RuleSet "FAS@@&Lr") Source #&(RuleSetSource "FAS@@&Mp")))



(DEFINST RuleSetSource ("FAS@@&Mn")
	 (indexedVars ((#&(Rule "FPSC@$Lw"))
		       (#&(Rule "FPSC@$Lx"))
		       (#&(Rule "FPSC@$Ly"))
		       (#&(Rule "FPSC@$Lz"))
		       (#&(Rule "FPSC@$L{"))
		       (#&(Rule "FPSC@$L|"))
		       (#&(Rule "FAS@@&Lp"))))
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mh") myViewName Source)
	 (created " 1-FEB-83 14:25:23")
	 (creator LOOPSCOURSE)
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FRSC@$T`")
	 (indexedVars ((#&(Rule "UISC@AMT"))
		       (#&(Rule "UISC@AMU"))
		       (#&(Rule "UISC@AMV"))
		       (#&(Rule "UISC@<{l"))
		       (#&(Rule "FBS@@A?V"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$T←") myViewName Source)
	 (created " 1-FEB-83 14:25:11")
	 (creator LOOPSCOURSE)
	 (edited " 9-JUN-83 22:34:09")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FAS@@&Mm")
	 (indexedVars ((#&(Rule "FPSC@$Ls"))
		       (#&(Rule "FPSC@$Lt"))
		       (#&(Rule "FPSC@$Lu"))
		       (#&(Rule "FPSC@$Lv"))
		       (#&(Rule "FBS@@A?V"))))
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mg") myViewName Source)
	 (created " 1-FEB-83 14:25:11")
	 (creator LOOPSCOURSE)
	 (edited "16-FEB-83 14:59:42")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FRSC@$P[")
	 (indexedVars ((#&(Rule "UISC@AMj"))
		       (#&(Rule "UISC@AMk"))
		       (#&(Rule "UISC@AMl"))
		       (#&(Rule "UISC@AMm"))
		       (#&(Rule "UISC@AMn"))
		       (#&(Rule "UISC@AMo"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$PY") myViewName Source)
	 (created "18-FEB-83 20:41:23")
	 (creator STEFIK)
	 (edited " 9-JUN-83 22:03:23")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FRSC@$PM")
	 (indexedVars ((#&(Rule "YWSC@8Ao"))
		       (#&(Rule "YWSC@8Ap"))
		       (#&(Rule "YWSC@8Aq"))
		       (#&(Rule "YWSC@8Ar"))
		       (#&(Rule "YWSC@8As"))
		       (#&(Rule "YWSC@8Am"))
		       (#&(Rule "FBS@@A?b"))
		       (#&(Rule "FBS@@A?c"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$PH") myViewName Source)
	 (created " 1-FEB-83 14:25:40")
	 (creator LOOPSCOURSE)
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL))



(DEFINST RuleSetSource ("FAS@@&Mp")
	 (indexedVars ((#&(Rule "FPSC@$MD"))
		       (#&(Rule "FPSC@$ME"))
		       (#&(Rule "FPSC@$MF"))
		       (#&(Rule "FPSC@$MG"))
		       (#&(Rule "FBS@@A?`"))
		       (#&(Rule "FBS@@A?a"))
		       (#&(Rule "FBS@@A?b"))
		       (#&(Rule "FBS@@A?c"))))
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mj") myViewName Source)
	 (created " 1-FEB-83 14:25:40")
	 (creator LOOPSCOURSE)
	 (edited "16-FEB-83 14:26:24")
	 (editor STEFIK))



(DEFINST Rule ("FPSC@$Lw")
	 (source 

"(* Returns a stopping place en route to a destination.)

IF truck:fuel=0
THEN (AnyRoadStop $UnionHall);")
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Li")))



(DEFINST Rule ("FPSC@$Lx")
	 (source 

"(* Dont run out if gas.)
IF truck:fuel < .25 * truck::MaxFuel
   truck:cashBox>0
   gasStation←(NearestRoadStop (RoadStops $GasStation .Range1 NIL 'Room))
THEN gasStation;")
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Li")))



(DEFINST Rule ("FPSC@$Ly")
	 (source 

"(* Obey the law - stop at WeighStations.)
IF wStation←(NearestRoadStop (RoadStops $WeighStation .Range1 direction 'Room))
   (Distance wStation)<(Distance destination)
THEN wStation;")
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Li")))



(DEFINST Rule ("FPSC@$Lz")
	 (source "IF (Distance destination)<=.Range1
THEN destination;")
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Li")))



(DEFINST Rule ("FPSC@$L{")
	 (source 
    "IF gasStation←(FurthestRoadStop (RoadStops $GasStation .Range1 direction))
THEN gasStation;")
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Li")))



(DEFINST Rule ("FPSC@$L|")
	 (source "THEN (NthRoadStop  maxMove direction);")
	 (edited "16-FEB-83 14:44:17")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Li")))



(DEFINST Rule ("FPSC@$Ls")
	 (source 
   "	(* Rules for deciding what and how much to buy.)

-> commodity ←	truck:location::Commodity;")
	 (edited "16-FEB-83 14:59:42")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lh")))



(DEFINST Rule ("FPSC@$Lt")
	 (source "IF ~(ISA commodity $LuxuryGoods)
THEN (STOP NIL 'NoBuy 'NotLuxury);")
	 (edited "16-FEB-83 14:59:42")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lh")))



(DEFINST Rule ("FPSC@$Lu")
	 (source 

"(* Sale can be limited by volume, weight, cash, or availability.)
-> volumeCapacity ← truck::MaxVolume-truck:volume
   weightCapacity ← truck::MaxWeight-truck:weight   
   volumeLimit ← volumeCapacity / commodity::VolPerQty
   weightLimit ← weightCapacity / commodity::WtPerQty
   cashLimit ← truck:cashBox / (PricePerUnit truck:location)
   producerLimit ← truck:location:qty
   numBuy ← (MIN volumeLimit weightLimit cashLimit producerLimit);")
	 (edited "16-FEB-83 14:59:42")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lh")))



(DEFINST Rule ("FPSC@$Lv")
	 (source 

"(* Buy as much as possible, then decide to sell it.)
IF numBuy>0
THEN (← gameMaster Buy numBuy)
     goal←'Sell
     destination←(NearestRoadStop (Buyers commodity));")
	 (edited "16-FEB-83 14:59:42")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lh")))



(DEFINST Rule ("YWSC@8Ao")
	 (source "	-> cargo←(CAR truck:cargo);")
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FRSC@$PC")))



(DEFINST Rule ("YWSC@8Ap")
	 (source 
	 "	IF ~(ISA cargo truck:location::Commodity)
	THEN (STOP NIL 'NoSale 'WrongKindOfBuyer);")
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FRSC@$PC")))



(DEFINST Rule ("YWSC@8Aq")
	 (source 
	  "	IF truck:location:pr < 1.1 goal='Peddle 
	THEN (STOP NIL 'NoSale 'AvoidCheapSkates);")
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FRSC@$PC")))



(DEFINST Rule ("YWSC@8Ar")
	 (source "	IF truck:location:pr < 0 
	THEN (STOP NIL 'NoSale 'NeverSellAtLoss);")
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FRSC@$PC")))



(DEFINST Rule ("YWSC@8As")
	 (source 

"(* Make sale as limited by cargo and consumer.)

IF ~cargo:status (ISA truck:location $CityDump)
THEN sellQty←(MIN truck:location:qty cargo:qty) (← gameMaster Sell cargo sellQty)
     (STOP T 'Sold 'AtCityDump);")
	 (edited "23-MAY-83 15:37:26")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FRSC@$PC")))



(DEFINST Rule ("FPSC@$MD")
	 (source "	-> cargo←(CAR truck:cargo);")
	 (edited "16-FEB-83 14:26:24")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lr")))



(DEFINST Rule ("FPSC@$ME")
	 (source 

"(* Abort sale if cargo has disappeared.)
	IF ~cargo
	THEN destination←NIL
	(WriteGameStatus %"Yipes! My cargo is gone!%")
	(STOP NIL 'NoSale 'NoCargo);")
	 (edited "16-FEB-83 14:26:24")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lr")))



(DEFINST Rule ("FPSC@$MF")
	 (source 

"(* Make sale as limited by cargo and consumer.)

	IF sellQty←(MIN truck:location:qty cargo:qty) sellQty>0 
	THEN (← gameMaster Sell cargo sellQty);")
	 (edited "16-FEB-83 14:26:24")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lr")))



(DEFINST Rule ("FPSC@$MG")
	 (source 

"(* Find another buyer if all not sold.)

	IF cargo←(CAR truck:cargo) cargo:qty>0
	THEN destination←(NearestRoadStop (Buyers truck:cargo))
	     direction←(DirectionOf destination)
	     (STOP NIL 'NoSale 'CantSell);")
	 (edited "16-FEB-83 14:26:24")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lr")))



[DEFINST Rule ("FBS@@A?`")
	 (source NIL)
	 (edited " 2-FEB-83 14:52:20")
	 (editor "LOOPSCOURSE")
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FAS@@&Lr"))
	 [lhs (AND (PROGN                                    (* Rule Tracing Code)
			  (TraceLHS NIL 5)
			  (← (GetObjFromUID "FBS@@A?`")
			     Print))
		   (OR (EQ sellQty 0)
		       (NOT (ISA cargo1 commodity]
	 (rhs (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← (GetObjFromUID "FAS@@<\")
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "FBS@@A?`")))
				  (PROGN                     (* Rule Tracing Code)
					 (TraceRHS NIL 5)
					 (← (GetObjFromUID "FBS@@A?`")
					    Print))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Buyers cargo1))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE direction)
					       (DirectionOf (GetValue self (QUOTE destination)))
					       ↑auditRecord)
				  (PROGN                     (* ↑value set by RuleSetStop)
					 (RuleSetStop self)
					 (GO QUIT]



[DEFINST Rule ("FBS@@A?a")
	 (source NIL)
	 (edited " 2-FEB-83 14:52:20")
	 (editor "LOOPSCOURSE")
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FAS@@&Lr"))
	 (lhs (PROGN                                         (* Rule Tracing Code)
		     (TraceLHS NIL 6)
		     (← (GetObjFromUID "FBS@@A?a")
			Print)))
	 (rhs (SETQ ↑value (PROGN (PROGN                     (* Rule Tracing Code)
					 (TraceRHS NIL 6)
					 (← (GetObjFromUID "FBS@@A?a")
					    Print))
				  (← gameMaster Sell cargo1 sellQty]



(DEFCLASSES HousePlayer)
[DEFCLASS HousePlayer
   (MetaClass PlayerMeta Edited:                             (* sm: "23-JUN-83 10:39"))
   (Supers Traveler)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))
   (InstanceVariables (goal Peddle)
		      (destination NIL doc                   (* Current destination.))
		      (direction NIL doc                     (* Forward or Backward direction of travel on the 
							     highway.))
		      (alices NIL doc                        (* Instance of Alices chosen for end game.)
			      )
		      (cashReserve 1000 doc                  (* Minimum cash to keep on hand.)))
   (Methods (FindStoppingPlace FindStoppingPlaceHousePlayerRules doc 
                                                             (* RuleSet FindStoppingPlaceHousePlayerRules is 
							     installed as the selector FindStoppingPlace of the class
							     HousePlayer)
			       RuleSet FindStoppingPlaceHousePlayerRules)
	    (GoToStoppingPlace GoToStoppingPlaceHousePlayerRules doc 
                                                             (* RuleSet GoToStoppingPlaceHousePlayerRules is 
							     installed as the selector GoToStoppingPlace of the class
							     HousePlayer)
			       RuleSet GoToStoppingPlaceHousePlayerRules)
	    (SellGoods SellGoodsHousePlayerRules doc         (* RuleSet SellGoodsHousePlayerRules is installed as the
							     selector SellGoods of the class HousePlayer)
		       RuleSet SellGoodsHousePlayerRules)
	    (TakeTurn TakeTurnHousePlayerRules doc           (* RuleSet TakeTurnHousePlayerRules is installed as the 
							     selector TakeTurn of the class HousePlayer)
		      RuleSet TakeTurnHousePlayerRules)
	    (RateProducers HPRateProducers RuleSet HPRateProducers)
	    (RateConsumers HPRateConsumers RuleSet HPRateConsumers)
	    (RateGasStations HPRateGasStations RuleSet HPRateGasStations)
	    (RateSpotsNearAlices RateSpotsNearAlicesHousePlayerRules RuleSet 
				 RateSpotsNearAlicesHousePlayerRules)
	    (MaxPurchase MaxPurchaseHousePlayerRules RuleSet MaxPurchaseHousePlayerRules))]

(DEFINEQ

(FindStoppingPlaceHousePlayerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value wStation gasStation)
          [COND
	    [(EQ (GetValue (GetValue self (QUOTE truck))
			   (QUOTE location))
		 (GetValue self (QUOTE destination)))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@ELn")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (GetValue self (QUOTE destination))
					       ↑auditRecord]
	    [[AND (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo))
		  [SETQ wStation (NearestRoadStop (RoadStops ($ WeighStation)
							     (← self Range1)
							     (GetValue self (QUOTE direction))
							     (QUOTE Room]
		  (LESSP (Distance wStation)
			 (Distance (GetValue self (QUOTE destination]
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@ELo")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       wStation ↑auditRecord]
	    [[AND (LEQ (Distance (GetValue self (QUOTE destination)))
		       (← self Range1))
		  (RoomToParkP (GetValue self (QUOTE destination]
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@ELp")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (GetValue self (QUOTE destination))
					       ↑auditRecord]
	    [(AND (NEQ (GetValue self (QUOTE goal))
		       (QUOTE GoToAlices))
		  [LESSP (GetValue (GetValue self (QUOTE truck))
				   (QUOTE fuel))
			 (TIMES .6 (GetClassValue (GetValue self (QUOTE truck))
						  (QUOTE MaxFuel]
		  [SETQ gasStation (FurthestRoadStop (RoadStops ($ GasStation)
								(← self Range1)
								(GetValue self (QUOTE direction))
								(QUOTE Room]
		  (GREATERP (GetValue gasStation (QUOTE qty))
			    0))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@ELq")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       gasStation ↑auditRecord]
	    (T (SETQ ↑value (PROGN (PROGN                    (* Make an audit record for this rule and set its audit 
							     values.)
					  (SETQ ↑auditRecord (← ($ StandardAuditRecord)
								NewTemp))
					  (PutValue ↑auditRecord (QUOTE rule)
						    (GetObjFromUID "UPSC@ELr")))
				   (PutAuditRec self (QUOTE stoppingPlace)
						(NthRoadStop [IMIN (← self Range1)
								   (Distance (GetValue self
										       (QUOTE 
										      destination]
							     (GetValue self (QUOTE direction))
							     NIL
							     (QUOTE Room))
						↑auditRecord]
      QUIT(RETURN ↑value])

(GoToStoppingPlaceHousePlayerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value realLocation numBuy)
          (SETQ ↑value (PROGN (PROGN                         (* Make an audit record for this rule and set its audit 
							     values.)
				     (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							   NewTemp))
				     (PutValue ↑auditRecord (QUOTE rule)
					       (GetObjFromUID "UPSC@EMi")))
			      (PutAuditRec self (QUOTE direction)
					   (DirectionOf (GetValue self (QUOTE destination)))
					   ↑auditRecord)))
          [SETQ ↑value (SETQ realLocation (GetValue (GetValue self (QUOTE truck))
						    (QUOTE location]
          [COND
	    ((AND (← self FindStoppingPlace)
		  (NEQ (GetValue self (QUOTE stoppingPlace))
		       (GetValue (GetValue self (QUOTE truck))
				 (QUOTE location)))
		  (NOT (← (GetValue self (QUOTE stoppingPlace))
			  BanditP)))
	      (SETQ ↑value (PROGN (← gameMaster Move (GetValue self (QUOTE stoppingPlace)))
				  (SETQ realLocation (GetValue (GetValue self (QUOTE truck))
							       (QUOTE location]
          [COND
	    ((NEQ realLocation (GetValue self (QUOTE stoppingPlace)))
	      (SETQ ↑value (WriteGameStatus "Oh!! " (GetValue self (QUOTE driver))
					    " intercepted!"]
          [COND
	    ((AND (ISA realLocation ($ GasStation))
		  (GREATERP (GetValue realLocation (QUOTE qty))
			    0))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMj")))
				  (← self BuyGas)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Peddle)
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE destination)
					       NIL ↑auditRecord)
				  (PROGN                     (* ↑value set by RuleSetStop)
					 (RuleSetStop (QUOTE Peddle)
						      NIL
						      (QUOTE BoughtGas))
					 (GO QUIT]
          [COND
	    ((AND (ISA realLocation ($ Producer))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle))
		  (EQ realLocation (GetValue self (QUOTE destination)))
		  (SETQ numBuy (← self MaxPurchase realLocation))
		  (GEQ numBuy 1))
	      (SETQ ↑value (← gameMaster Buy numBuy]
          [COND
	    ((AND (ISA realLocation ($ Consumer))
		  (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo)))
	      (SETQ ↑value (← self SellGoods]
          [COND
	    ((EQ realLocation (GetValue self (QUOTE destination)))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMk")))
				  (PutAuditRec self (QUOTE destination)
					       NIL ↑auditRecord]
      QUIT(RETURN ↑value])

(HPRateConsumers
  [LAMBDA (self rs)
    (PROG (↑auditRecord ↑value rating cargo)
          (SETQ ↑value (PROGN [SETQ cargo (CAR (GetValue (GetValue self (QUOTE truck))
							 (QUOTE cargo]
			      (SETQ rating 0)))
          [COND
	    ((AND (NOT (GetValue cargo (QUOTE status)))
		  (ISA rs ($ CityDump)))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop 5000 (QUOTE CityDump)
					       (QUOTE LookNoMore))
				  (GO QUIT]
          [COND
	    ((NOT (GetValue cargo (QUOTE status)))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL (QUOTE SpoiltGoods)
					       (QUOTE CannotSell))
				  (GO QUIT]
          [COND
	    ([NOT (ISA cargo (GetClassValue rs (QUOTE Commodity]
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop (MINUS 10000)
					       NIL
					       (QUOTE CannotSellHere))
				  (GO QUIT]
          [COND
	    ((LESSP (GetValue rs (QUOTE qty))
		    1)
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop (MINUS 10000)
					       NIL
					       (QUOTE CannotSellHere))
				  (GO QUIT]
          [COND
	    ((NOT (RoomToParkP rs))
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 200]
          [COND
	    ((← rs BanditP)
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 10000]
          [SETQ ↑value (SETQ rating (PLUS rating (TIMES 100 (GetValue rs (QUOTE pr]
          [SETQ ↑value (SETQ rating (DIFFERENCE rating
						(TIMES 5 (TIMES (GetClassValue (GetValue
										 self
										 (QUOTE truck))
									       (QUOTE Gpm))
								(Distance rs
									  (GetValue
									    (GetValue self
										      (QUOTE truck))
									    (QUOTE location]
      QUIT(RETURN ↑value])

(HPRateGasStations
  [LAMBDA (self rs)
    (PROG (↑auditRecord ↑value rating)
          (SETQ ↑value (SETQ rating 0))
          [COND
	    ((EQ (GetValue rs (QUOTE qty))
		 0)
	      (SETQ ↑value (SETQ rating (MINUS 2000]
          [COND
	    ((NOT (RoomToParkP rs))
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 200]
          [COND
	    ((← rs BanditP)
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 200]
          [SETQ ↑value (SETQ rating (DIFFERENCE rating (TIMES 10 (Distance
								rs
								(GetValue (GetValue self
										    (QUOTE truck))
									  (QUOTE location]
          [SETQ ↑value (SETQ rating (PLUS rating (IMIN (GetValue rs (QUOTE qty))
						       (GetClassValue (GetValue self (QUOTE truck))
								      (QUOTE MaxFuel]
      QUIT(RETURN ↑value])

(HPRateProducers
  [LAMBDA (self rs)
    (PROG (↑value rating maxBuy)
          (SETQ ↑value (SETQ rating 0))
          [COND
	    ((ISA rs ($ GasStation))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop (MINUS 100000)
					       NIL
					       (QUOTE GasStation))
				  (GO QUIT]
          [COND
	    ((LESSP (GetValue rs (QUOTE qty))
		    1)
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop (MINUS 100000)
					       NIL
					       (QUOTE CannotBuy))
				  (GO QUIT]
          [COND
	    ((AND (SETQ maxBuy (← self MaxPurchase rs))
		  (LESSP maxBuy 1))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop (MINUS 100000)
					       NIL
					       (QUOTE CannotBuy))
				  (GO QUIT]
          [COND
	    ((NOT (RoomToParkP rs))
	      (SETQ ↑value (SETQ rating (MINUS 500]
          [COND
	    ((← rs BanditP)
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 10000]
          [COND
	    ((SUBCLASS (GetClassValue rs (QUOTE Commodity))
		       ($ PerishableCommodity))
	      (SETQ ↑value (SETQ rating (PLUS (DIFFERENCE rating 2000)
					      (TIMES 100 (GetClassValue (GetClassValue rs
										       (QUOTE 
											Commodity))
									(QUOTE MinLifetime]
          [COND
	    ((SUBCLASS (GetClassValue rs (QUOTE Commodity))
		       ($ FragileCommodity))
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating (TIMES 100 (GetClassValue
								    (GetClassValue rs (QUOTE 
											Commodity))
								    (QUOTE FragilityLevel]
          [COND
	    ((SUBCLASS (GetClassValue rs (QUOTE Commodity))
		       ($ LuxuryGoods))
	      (SETQ ↑value (SETQ rating (PLUS rating 1000]
          [COND
	    ((SUBCLASS (GetClassValue rs (QUOTE Commodity))
		       ($ Xerox1100))
	      (SETQ ↑value (SETQ rating (PLUS rating 1000]
          [SETQ ↑value (SETQ rating (PLUS rating (TIMES 20 maxBuy]
          [SETQ ↑value (SETQ rating (DIFFERENCE rating (TIMES (TIMES 10 (GetClassValue
								       (GetValue self (QUOTE truck))
								       (QUOTE Gpm)))
							      (Distance rs
									(GetValue
									  (GetValue self
										    (QUOTE truck))
									  (QUOTE location]
      QUIT(RETURN ↑value])

(MaxPurchaseHousePlayerRules
  [LAMBDA (self roadStop)
    (PROG (↑auditRecord ↑value volumeCapacity weightCapacity volumeLimit weightLimit cashLimit 
			producerLimit numBuy cashCapacity)
          [SETQ ↑value (PROGN [SETQ volumeCapacity (DIFFERENCE (GetClassValue (GetValue self
											(QUOTE truck))
									      (QUOTE MaxVolume))
							       (GetValue (GetValue self (QUOTE truck))
									 (QUOTE volume]
			      [SETQ weightCapacity (DIFFERENCE (GetClassValue (GetValue self
											(QUOTE truck))
									      (QUOTE MaxWeight))
							       (GetValue (GetValue self (QUOTE truck))
									 (QUOTE weight]
			      (SETQ cashCapacity (MAX 0 (DIFFERENCE (GetValue (GetValue self
											(QUOTE truck))
									      (QUOTE cashBox))
								    (GetValue self (QUOTE cashReserve]
          [SETQ ↑value (PROGN [SETQ volumeLimit (QUOTIENT volumeCapacity (GetClassValue
							    (GetClassValue roadStop (QUOTE Commodity))
							    (QUOTE VolPerQty]
			      [SETQ weightLimit (QUOTIENT weightCapacity (GetClassValue
							    (GetClassValue roadStop (QUOTE Commodity))
							    (QUOTE WtPerQty]
			      (SETQ cashLimit (QUOTIENT cashCapacity (PricePerUnit roadStop)))
			      (SETQ producerLimit (GetValue roadStop (QUOTE qty]
          (SETQ ↑value (SETQ numBuy (MIN volumeLimit weightLimit cashLimit producerLimit)))
      QUIT(RETURN ↑value])

(RateSpotsNearAlicesHousePlayerRules
  [LAMBDA (self roadStop)
    (PROG (↑value rating cargo)
          [SETQ ↑value (SETQ cargo (CAR (GetValue (GetValue self (QUOTE truck))
						  (QUOTE cargo]
          [SETQ ↑value (SETQ rating (DIFFERENCE 100 (TIMES 4 (Distance roadStop (GetValue
									 self
									 (QUOTE alices]
          [COND
	    ((NOT (RoomToParkP roadStop))
	      (SETQ ↑value (SETQ rating (MINUS 1000]
          [COND
	    ((ISA roadStop ($ UnionHall))
	      (SETQ ↑value (SETQ rating (MINUS 1000]
          [COND
	    ((ISA roadStop ($ AlicesRestaurant))
	      (SETQ ↑value (SETQ rating (MINUS 500]
          [COND
	    ((AND cargo (ISA roadStop ($ Consumer))
		  (ISA cargo (GetClassValue roadStop (QUOTE Commodity)))
		  (GREATERP (GetValue roadStop (QUOTE qty))
			    0)
		  (GREATERP (GetValue roadStop (QUOTE pr))
			    1))
	      (SETQ ↑value (SETQ rating (PLUS rating 20]
      QUIT(RETURN ↑value])

(SellGoodsHousePlayerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value cargo sellQty)
          [SETQ ↑value (SETQ cargo (CAR (GetValue (GetValue self (QUOTE truck))
						  (QUOTE cargo]
          [COND
	    ([NOT (ISA cargo (GetClassValue (GetValue (GetValue self (QUOTE truck))
						      (QUOTE location))
					    (QUOTE Commodity]
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL (QUOTE NoSale)
					       (QUOTE WrongKindOfBuyer))
				  (GO QUIT]
          [COND
	    ((AND (NOT (GetValue cargo (QUOTE status)))
		  (ISA (GetValue (GetValue self (QUOTE truck))
				 (QUOTE location))
		       ($ CityDump)))
	      (SETQ ↑value (PROGN [SETQ sellQty (MIN (GetValue (GetValue (GetValue self (QUOTE truck))
									 (QUOTE location))
							       (QUOTE qty))
						     (GetValue cargo (QUOTE qty]
				  (← gameMaster Sell cargo sellQty)
				  (PROGN                     (* ↑value set by RuleSetStop)
					 (RuleSetStop T (QUOTE Sold)
						      (QUOTE AtCityDump))
					 (GO QUIT]
          [COND
	    ((LESSP (GetValue (GetValue (GetValue self (QUOTE truck))
					(QUOTE location))
			      (QUOTE pr))
		    (GetValue cargo (QUOTE pr)))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL (QUOTE NoSale)
					       (QUOTE AvoidLoss))
				  (GO QUIT]
          [COND
	    ((AND (GetValue cargo (QUOTE status))
		  [SETQ sellQty (MIN (GetValue (GetValue (GetValue self (QUOTE truck))
							 (QUOTE location))
					       (QUOTE qty))
				     (GetValue cargo (QUOTE qty]
		  (GEQ sellQty 1))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UOSC@ELn")))
				  (← gameMaster Sell cargo sellQty)
				  (PutAuditRec self (QUOTE cashReserve)
					       [MIN 5000 (TIMES .1 (GetValue (GetValue self
										       (QUOTE truck))
									     (QUOTE cashBox]
					       ↑auditRecord]
      QUIT(RETURN ↑value])

(TakeTurnHousePlayerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value possibleStops gasStation)
          [COND
	    ((AND (EQ (GetValue (GetValue self (QUOTE truck))
				(QUOTE fuel))
		      0)
		  (GREATERP (GetValue (GetValue self (QUOTE truck))
				      (QUOTE cashBox))
			    300000)
		  (LESSP (GetValue gameMaster (QUOTE timeRemaining))
			 300))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMn")))
				  (PutAuditRec self (QUOTE destination)
					       NIL ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE SitTight)
					       ↑auditRecord]
          [COND
	    ((AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE GoToAlices))
		  (ISA (GetValue (GetValue self (QUOTE truck))
				 (QUOTE location))
		       ($ AlicesRestaurant)))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMo")))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE SitTight)
					       ↑auditRecord]
          [COND
	    ((AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE SitTight))
		  (ISA (GetValue (GetValue self (QUOTE truck))
				 (QUOTE location))
		       ($ AlicesRestaurant))
		  (GEQ (← self TimeAtStop)
		       28))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMp")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (RoadStops ($ AlicesRestaurant)))
					       ↑auditRecord)
				  (EQ (GetValue self (QUOTE goal))
				      (QUOTE GoToAlices]
          [COND
	    ([AND (LESSP (GetValue gameMaster (QUOTE timeRemaining))
			 60)
		  (NOT (FMEMB (GetValue self (QUOTE goal))
			      (QUOTE (SitTight GetClose GoToAlices]
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMq")))
				  (PutAuditRec self (QUOTE alices)
					       (NearestRoadStop (RoadStops ($ AlicesRestaurant)))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE destination)
					       (PickHiObj self (QUOTE RateSpotsNearAlices)
							  (RoadStops))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE GetClose)
					       ↑auditRecord]
          [COND
	    ([AND (LESSP (GetValue gameMaster (QUOTE timeRemaining))
			 29)
		  (NOT (ISA (GetValue (GetValue self (QUOTE truck))
				      (QUOTE location))
			    ($ AlicesRestaurant]
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMr")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (RoadStops ($ AlicesRestaurant)
									   NIL NIL T))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE GoToAlices)
					       ↑auditRecord]
          [COND
	    ([AND (NEQ (GetValue self (QUOTE goal))
		       (QUOTE SitTight))
		  [LESSP (GetValue (GetValue self (QUOTE truck))
				   (QUOTE fuel))
			 (TIMES .35 (GetClassValue (GetValue self (QUOTE truck))
						   (QUOTE MaxFuel]
		  (GREATERP (GetValue (GetValue self (QUOTE truck))
				      (QUOTE cashBox))
			    0)
		  (SETQ gasStation (PickHiObj self (QUOTE RateGasStations)
					      (RoadStops ($ GasStation)
							 (← self Range]
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMs")))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE BuyGas)
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE destination)
					       gasStation ↑auditRecord]
          [COND
	    ((AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle))
		  (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo))
		  (SETQ possibleStops (Buyers (CAR (GetValue (GetValue self (QUOTE truck))
							     (QUOTE cargo)))
					      NIL T)))
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMt")))
				  (PutAuditRec self (QUOTE destination)
					       (PickHiObj self (QUOTE RateConsumers)
							  possibleStops)
					       ↑auditRecord]
          [COND
	    ([AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle))
		  (NOT (GetValue (GetValue self (QUOTE truck))
				 (QUOTE cargo)))
		  (GREATERP (GetValue gameMaster (QUOTE timeRemaining))
			    70)
		  (SETQ possibleStops (RoadStops ($ Producer]
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← ($ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "UPSC@EMu")))
				  (PutAuditRec self (QUOTE destination)
					       (PickHiObj self (QUOTE RateProducers)
							  possibleStops)
					       ↑auditRecord]
          [COND
	    ((GetValue self (QUOTE destination))
	      (SETQ ↑value (← self GoToStoppingPlace]
      QUIT(RETURN ↑value])
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (46681 68653 (FindStoppingPlaceHousePlayerRules 46691 . 50019) (
GoToStoppingPlaceHousePlayerRules 50021 . 52976) (HPRateConsumers 52978 . 54836) (HPRateGasStations 
54838 . 55631) (HPRateProducers 55633 . 57933) (MaxPurchaseHousePlayerRules 57935 . 59320) (
RateSpotsNearAlicesHousePlayerRules 59322 . 60258) (SellGoodsHousePlayerRules 60260 . 62449) (
TakeTurnHousePlayerRules 62451 . 68651)))))
STOP