(FILECREATED "26-Mar-85 19:48:49" {INDIGO}<LOOPS>SOURCES>TRUCKIN>PEDDLER.;3 49574  

      changes to:  (METHODS Peddler.FindStoppingPlace Peddler.GoToStoppingPlace Peddler.MaxPurchase 
			    Peddler.RateConsumers Peddler.RateProducers Peddler.RateSpotsNearAlices 
			    Peddler.SellGoods Peddler.TakeTurn)
		   (FNS Peddler.FindStoppingPlace Peddler.GoToStoppingPlace Peddler.MaxPurchase 
			Peddler.RateConsumers Peddler.RateProducers Peddler.RateSpotsNearAlices 
			Peddler.SellGoods Peddler.TakeTurn)

      previous date: "13-NOV-83 18:34:54" {INDIGO}<LOOPS>SOURCES>TRUCKIN>PEDDLER.;2)


(* Copyright (c)  by NIL. All rights reserved.)

(PRETTYCOMPRINT PEDDLERCOMS)

(RPAQQ PEDDLERCOMS ((CLASSES Peddler)
		    (METHODS Peddler.FindStoppingPlace Peddler.GoToStoppingPlace Peddler.MaxPurchase 
			     Peddler.RateConsumers Peddler.RateProducers Peddler.RateSpotsNearAlices 
			     Peddler.SellGoods Peddler.TakeTurn)
		    (FNS FindStoppingPlacePeddlerRules GoToStoppingPlacePeddlerRules 
			 PeddlerMaxPurchase PeddlerRateConsumers PeddlerRateProducers 
			 PeddlerRateSpotsNearAlices SellGoodsPeddlerRules TakeTurnPeddlerRules)
		    (INSTANCES FindStoppingPlacePeddlerRules GoToStoppingPlacePeddlerRules 
			       PeddlerMaxPurchase PeddlerRateConsumers PeddlerRateProducers 
			       PeddlerRateSpotsNearAlices SellGoodsPeddlerRules TakeTurnPeddlerRules))
)
(DEFCLASSES Peddler)
[DEFCLASS Peddler
   (MetaClass PlayerMeta doc 

          (* Peddler is an automated Truckin player that prioritizes its choices for destinations and stoppingPlaces.
	  It is the first Truckin player to use RuleSets to filter and rate choices for RoadStops. Peddler was written for the
	  second Loops Course in February 1983)


	      Edited:                                        (* sm: "19-MAY-83 17:04"))
   (Supers Traveler)
   (InstanceVariables (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.)
			      )
		      (sitCount 0 doc                        (* Number of turns sitting at Alices Restaurant during 
							     an EndGame.))
		      (goal NIL doc                          (* Peddle, SitTight, GetClose, or GoToAlices.)
			    )
		      (cashReserve 1000 doc                  (* Minimum cash to keep on hand.)))]

[METH Peddler  FindStoppingPlace NIL
      (* RuleSet FindStoppingPlacePeddlerRules is installed as the selector FindStoppingPlace of the 
	 class Peddler)
      (method Peddler.FindStoppingPlace RuleSet FindStoppingPlacePeddlerRules)]


[METH Peddler  GoToStoppingPlace NIL
      (* RuleSet GoToStoppingPlacePeddlerRules is installed as the selector GoToStoppingPlace of the 
	 class Peddler)
      (method Peddler.GoToStoppingPlace RuleSet GoToStoppingPlacePeddlerRules)]


[METH Peddler  MaxPurchase (roadStop)
      NIL (method Peddler.MaxPurchase RuleSet PeddlerMaxPurchase)]


[METH Peddler  RateConsumers (roadStop)
      (* RuleSet PeddlerRateConsumers is installed as the selector RateConsumers of the class Peddler)
      (method Peddler.RateConsumers RuleSet PeddlerRateConsumers)]


[METH Peddler  RateProducers (roadStop)
      NIL (method Peddler.RateProducers RuleSet PeddlerRateProducers)]


[METH Peddler  RateSpotsNearAlices (roadStop)
      NIL (method Peddler.RateSpotsNearAlices RuleSet PeddlerRateSpotsNearAlices)]


[METH Peddler  SellGoods NIL
      (* RuleSet SellGoodsPeddlerRules is installed as the selector SellGoods of the class Peddler)
      (method Peddler.SellGoods RuleSet SellGoodsPeddlerRules)]


[METH Peddler  TakeTurn NIL
      (* RuleSet TakeTurnPeddlerRules is installed as the selector TakeTurn of the class Peddler)
      (method Peddler.TakeTurn RuleSet TakeTurnPeddlerRules)]


(DEFINEQ

(Peddler.FindStoppingPlace
  (Method ((Peddler FindStoppingPlace)
	   self)
	  (FindStoppingPlacePeddlerRules self)))

(Peddler.GoToStoppingPlace
  (Method ((Peddler GoToStoppingPlace)
	   self)
	  (GoToStoppingPlacePeddlerRules self)))

(Peddler.MaxPurchase
  (Method ((Peddler MaxPurchase)
	   self roadStop)
	  (PeddlerMaxPurchase self roadStop)))

(Peddler.RateConsumers
  (Method ((Peddler RateConsumers)
	   self roadStop)
	  (PeddlerRateConsumers self roadStop)))

(Peddler.RateProducers
  (Method ((Peddler RateProducers)
	   self roadStop)
	  (PeddlerRateProducers self roadStop)))

(Peddler.RateSpotsNearAlices
  (Method ((Peddler RateSpotsNearAlices)
	   self roadStop)
	  (PeddlerRateSpotsNearAlices self roadStop)))

(Peddler.SellGoods
  (Method ((Peddler SellGoods)
	   self)
	  (SellGoodsPeddlerRules self)))

(Peddler.TakeTurn
  (Method ((Peddler TakeTurn)
	   self)
	  (TakeTurnPeddlerRules self)))
)
(DEFINEQ

(FindStoppingPlacePeddlerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value wStation gasStation)
          [COND
	    [(EQ (GetValue (GetValue self (QUOTE truck))
			   (QUOTE fuel))
		 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 "LVS.0.0.136.66429.9")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (AnyRoadStop ($ UnionHall))
					       ↑auditRecord]
	    [[AND (NEQ (GetValue self (QUOTE goal))
		       (QUOTE SitTight))
		  [LESSP (GetValue (GetValue self (QUOTE truck))
				   (QUOTE fuel))
			 (TIMES .25 (GetClassValue (GetValue self (QUOTE truck))
						   (QUOTE MaxFuel]
		  (GREATERP (GetValue (GetValue self (QUOTE truck))
				      (QUOTE cashBox))
			    0)
		  (SETQ gasStation (NearestRoadStop (RoadStops ($ GasStation)
							       (← self Range1)
							       NIL
							       (QUOTE Room]
	      (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 "LVS.0.0.136.66429.10")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       gasStation ↑auditRecord]
	    [[AND [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 "LVS.0.0.136.66429.11")))
				  (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 "LVS.0.0.136.66429.12")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (GetValue self (QUOTE destination))
					       ↑auditRecord]
	    [(AND [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 "LVS.0.0.136.66429.13")))
				  (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 "LVS.0.0.136.66429.14")))
				   (PutAuditRec self (QUOTE stoppingPlace)
						(NthRoadStop (GetValue self (QUOTE maxMove))
							     (GetValue self (QUOTE direction))
							     NIL
							     (QUOTE Room))
						↑auditRecord]
      QUIT(RETURN ↑value])

(GoToStoppingPlacePeddlerRules
  [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 "LVS.0.0.136.66429.8")))
			      (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 (← PlayerInterface Move self (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))
					    " Didnt reach stoppingPlace"]
          [COND
	    ((ISA realLocation ($ GasStation))
	      (SETQ ↑value (← self BuyGas]
          [COND
	    ((AND (ISA realLocation ($ Producer))
		  (NOT (ISA realLocation ($ GasStation)))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle))
		  (EQ realLocation (GetValue self (QUOTE destination)))
		  (SETQ numBuy (← self MaxPurchase realLocation))
		  (GEQ numBuy 1))
	      (SETQ ↑value (← PlayerInterface Buy self numBuy]
          [COND
	    ((AND (ISA realLocation ($ Consumer))
		  (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo)))
	      (SETQ ↑value (← self SellGoods]
      QUIT(RETURN ↑value])

(PeddlerMaxPurchase
  [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])

(PeddlerRateConsumers
  [LAMBDA (self roadStop)
    (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 roadStop ($ 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 roadStop (QUOTE Commodity]
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((NOT (RoomToParkP roadStop))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((LESSP (GetValue roadStop (QUOTE qty))
		    1)
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [SETQ ↑value (SETQ rating (PLUS rating (TIMES 100 (GetValue roadStop (QUOTE pr]
          [SETQ ↑value (SETQ rating (DIFFERENCE rating (TIMES (GetClassValue (GetValue self
										       (QUOTE truck))
									     (QUOTE Gpm))
							      (Distance roadStop
									(GetValue
									  (GetValue self
										    (QUOTE truck))
									  (QUOTE location]
      QUIT(RETURN ↑value])

(PeddlerRateProducers
  [LAMBDA (self roadStop)
    (PROG (↑value rating maxBuy)
          (SETQ ↑value (SETQ rating 0))
          [COND
	    ((NOT (RoomToParkP roadStop))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((SUBCLASS (GetClassValue roadStop (QUOTE Commodity))
		       ($ PerishableCommodity))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((ISA roadStop ($ GasStation))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((LESSP (GetValue roadStop (QUOTE qty))
		    1)
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((SUBCLASS (GetClassValue roadStop (QUOTE Commodity))
		       ($ FragileCommodity))
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating (TIMES 500 (GetClassValue
								    (GetClassValue roadStop
										   (QUOTE Commodity))
								    (QUOTE FragilityLevel]
          [COND
	    ((AND (SETQ maxBuy (← self MaxPurchase roadStop))
		  (LESSP maxBuy 1))
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 10000]
          [COND
	    ((SUBCLASS (GetClassValue roadStop (QUOTE Commodity))
		       ($ LuxuryGoods))
	      (SETQ ↑value (SETQ rating (PLUS rating 200]
          [SETQ ↑value (SETQ rating (PLUS rating (TIMES 10 maxBuy]
          [SETQ ↑value (SETQ rating (PLUS rating (TIMES 100 (DIFFERENCE 2 (GetValue roadStop
										    (QUOTE pr]
          [SETQ ↑value (SETQ rating (DIFFERENCE rating (TIMES (GetClassValue (GetValue self
										       (QUOTE truck))
									     (QUOTE Gpm))
							      (Distance roadStop
									(GetValue
									  (GetValue self
										    (QUOTE truck))
									  (QUOTE location]
      QUIT(RETURN ↑value])

(PeddlerRateSpotsNearAlices
  [LAMBDA (self roadStop)
    (PROG (↑value rating cargo)
          [SETQ ↑value (SETQ cargo (CAR (GetValue (GetValue self (QUOTE truck))
						  (QUOTE cargo]
          [COND
	    ((NOT (RoomToParkP roadStop))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((ISA roadStop ($ UnionHall))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [COND
	    ((ISA roadStop ($ AlicesRestaurant))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL)
				  (GO QUIT]
          [SETQ ↑value (SETQ rating (DIFFERENCE 100 (TIMES 4 (Distance roadStop (GetValue
									 self
									 (QUOTE alices]
          [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])

(SellGoodsPeddlerRules
  [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]
				  (← PlayerInterface Sell self cargo sellQty)
				  (PROGN                     (* ↑value set by RuleSetStop)
					 (RuleSetStop T (QUOTE Sold)
						      (QUOTE AtCityDump))
					 (GO QUIT]
          [COND
	    ((AND (LESSP (GetValue (GetValue (GetValue self (QUOTE truck))
					     (QUOTE location))
				   (QUOTE pr))
			 1.1)
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle)))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL (QUOTE NoSale)
					       (QUOTE AvoidCheapSkates))
				  (GO QUIT]
          [COND
	    ((LESSP (GetValue (GetValue (GetValue self (QUOTE truck))
					(QUOTE location))
			      (QUOTE pr))
		    0)
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL (QUOTE NoSale)
					       (QUOTE NeverSellAtLoss))
				  (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 (← PlayerInterface Sell self cargo sellQty]
      QUIT(RETURN ↑value])

(TakeTurnPeddlerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value possibleStops)
          [COND
	    ((NOT (GetValue self (QUOTE goal)))
	      (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 "LVS.0.0.136.66429.1")))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Peddle)
					       ↑auditRecord]
          [COND
	    ([AND (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle))
		  (SETQ possibleStops (RoadStops ($ Consumer]
	      (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 "LVS.0.0.136.66429.2")))
				  (PutAuditRec self (QUOTE destination)
					       (PickHiObj self (QUOTE RateConsumers)
							  possibleStops)
					       ↑auditRecord]
          [COND
	    ([AND (NOT (GetValue (GetValue self (QUOTE truck))
				 (QUOTE cargo)))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Peddle))
		  (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 "LVS.0.0.136.66429.3")))
				  (PutAuditRec self (QUOTE destination)
					       (PickHiObj self (QUOTE RateProducers)
							  possibleStops)
					       ↑auditRecord]
          [COND
	    ([AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE GoToAlices))
		  (EQ (GetValue (GetValue self (QUOTE truck))
				(QUOTE location))
		      (GetValue self (QUOTE alices]
	      (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 "LVS.0.0.136.66429.4")))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE SitTight)
					       ↑auditRecord]
          [COND
	    ((AND (EQ (GetValue (GetValue self (QUOTE truck))
				(QUOTE location))
		      (GetValue self (QUOTE alices)))
		  (GREATERP (← self TimeAtStop)
			    25)
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE SitTight)))
	      (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 "LVS.0.0.136.66429.5")))
				  (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 Simulator (QUOTE timeLeft))
			 50)
		  (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 "LVS.0.0.136.66429.6")))
				  (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 Simulator (QUOTE timeLeft))
			 30)
		  (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 "LVS.0.0.136.66429.7")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (RoadStops ($ AlicesRestaurant)))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE GoToAlices)
					       ↑auditRecord]
          [COND
	    ([NOT (OR (EQ (GetValue self (QUOTE goal))
			  (QUOTE SitTight))
		      (AND (EQ (GetValue self (QUOTE goal))
			       (QUOTE GetClose))
			   (LEQ (Distance (GetValue (GetValue self (QUOTE truck))
						    (QUOTE location))
					  (GetValue self (QUOTE alices)))
				3]
	      (SETQ ↑value (← self GoToStoppingPlace]
      QUIT(RETURN ↑value])
)
[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "FRSC@$Oz")
	  (perspectiveNode #&(RuleSetNode "FRSC@$PF") myViewName RuleSet)
	  (name #(FindStoppingPlacePeddlerRules NIL RememberName))
	  (compiledRules FindStoppingPlacePeddlerRules)
	  (workSpace Peddler)
	  (tempVars (wStation gasStation))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 6)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)
	  (arguments)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "FRSC@$PA")
	  (perspectiveNode #&(RuleSetNode "FRSC@$PG") myViewName RuleSet)
	  (name #(GoToStoppingPlacePeddlerRules NIL RememberName))
	  (compiledRules GoToStoppingPlacePeddlerRules)
	  (workSpace Peddler)
	  (tempVars (realLocation numBuy))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 7)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)
	  (arguments)]


[METH NIL  NIL (roadStop)
      NIL (method ? methodClass RuleSet UID "FRSC@$TR")
	  (perspectiveNode #&(RuleSetNode "FRSC@$T←") myViewName RuleSet)
	  (name #(PeddlerMaxPurchase NIL RememberName))
	  (compiledRules PeddlerMaxPurchase)
	  (workSpace Peddler)
	  (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)]


[METH NIL  NIL (roadStop)
      NIL (method ? methodClass RuleSet UID "FRSC@$RX")
	  (perspectiveNode #&(RuleSetNode "FRSC@$Re") myViewName RuleSet)
	  (name #(PeddlerRateConsumers NIL RememberName))
	  (compiledRules PeddlerRateConsumers)
	  (workSpace Peddler)
	  (tempVars (rating cargo))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 8)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)
	  (arguments)]


[METH NIL  NIL (roadStop)
      NIL (method ? methodClass RuleSet UID "FRSC@$Qy")
	  (perspectiveNode #&(RuleSetNode "FRSC@$Rf") myViewName RuleSet)
	  (name #(PeddlerRateProducers NIL RememberName))
	  (compiledRules PeddlerRateProducers)
	  (workSpace Peddler)
	  (tempVars (rating maxBuy))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 11)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)
	  (arguments)]


[METH NIL  NIL (roadStop)
      NIL (method ? methodClass RuleSet UID "FRSC@$PR")
	  (perspectiveNode #&(RuleSetNode "FRSC@$PY"))
	  (name #(PeddlerRateSpotsNearAlices NIL RememberName))
	  (compiledRules PeddlerRateSpotsNearAlices)
	  (workSpace Peddler)
	  (tempVars (rating cargo))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 6)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)
	  (arguments)]


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


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "YQSC@<?t")
	  (perspectiveNode #&(RuleSetNode "YQSC@<@I") myViewName RuleSet)
	  (name #(TakeTurnPeddlerRules NIL RememberName))
	  (compiledRules TakeTurnPeddlerRules)
	  (workSpace Peddler)
	  (tempVars (possibleStops))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 8)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)
	  (arguments)]


[DEFINST RuleSetNode ("FRSC@$PF")
         (perspectives ? RuleSet #&(RuleSet "FRSC@$Oz") Source #&(RuleSetSource "FRSC@$PK"))]


[DEFINST RuleSetNode ("FRSC@$PG")
         (perspectives ? RuleSet #&(RuleSet "FRSC@$PA") Source #&(RuleSetSource "FRSC@$PL"))]


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


[DEFINST RuleSetNode ("FRSC@$Re")
         (perspectives ? RuleSet #&(RuleSet "FRSC@$RX") Source #&(RuleSetSource "FRSC@$Ro"))]


[DEFINST RuleSetNode ("FRSC@$Rf")
         (perspectives ? RuleSet #&(RuleSet "FRSC@$Qy") Source #&(RuleSetSource "FRSC@$Rp"))]


[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 ("YQSC@<@I")
         (perspectives ? RuleSet #&(RuleSet "YQSC@<?t") Source #&(RuleSetSource "YQSC@<@J"))]


[DEFINST RuleSetSource ("FRSC@$PK")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.9"))
		       (#&(Rule "LVS.0.0.136.66429.10"))
		       (#&(Rule "LVS.0.0.136.66429.11"))
		       (#&(Rule "LVS.0.0.136.66429.12"))
		       (#&(Rule "LVS.0.0.136.66429.13"))
		       (#&(Rule "LVS.0.0.136.66429.14"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$PF") myViewName Source)
	 (created " 1-FEB-83 14:25:23")
	 (creator LOOPSCOURSE)
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("FRSC@$PL")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.8"))
		       (#&(Rule "LVS.0.0.136.66429.15"))
		       (#&(Rule "LVS.0.0.136.66429.16"))
		       (#&(Rule "LVS.0.0.136.66429.17"))
		       (#&(Rule "LVS.0.0.136.66429.18"))
		       (#&(Rule "LVS.0.0.136.66429.19"))
		       (#&(Rule "LVS.0.0.136.66429.20"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$PG") myViewName Source)
	 (created " 1-FEB-83 14:25:34")
	 (creator LOOPSCOURSE)
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("FRSC@$T`")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.21"))
		       (#&(Rule "LVS.0.0.136.66429.22"))
		       (#&(Rule "LVS.0.0.136.66429.23"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$T←") myViewName Source)
	 (created " 1-FEB-83 14:25:11")
	 (creator LOOPSCOURSE)
	 (edited "22-JUL-83 18:35:43")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("FRSC@$Ro")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.24"))
		       (#&(Rule "LVS.0.0.136.66429.25"))
		       (#&(Rule "LVS.0.0.136.66429.26"))
		       (#&(Rule "LVS.0.0.136.66429.27"))
		       (#&(Rule "LVS.0.0.136.66429.28"))
		       (#&(Rule "LVS.0.0.136.66429.29"))
		       (#&(Rule "LVS.0.0.136.66429.30"))
		       (#&(Rule "LVS.0.0.136.66429.31"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$Re") myViewName Source)
	 (created "18-FEB-83 22:45:14")
	 (creator STEFIK)
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("FRSC@$Rp")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.32"))
		       (#&(Rule "LVS.0.0.136.66429.33"))
		       (#&(Rule "LVS.0.0.136.66429.34"))
		       (#&(Rule "LVS.0.0.136.66429.35"))
		       (#&(Rule "LVS.0.0.136.66429.36"))
		       (#&(Rule "LVS.0.0.136.66429.37"))
		       (#&(Rule "LVS.0.0.136.66429.38"))
		       (#&(Rule "LVS.0.0.136.66429.39"))
		       (#&(Rule "LVS.0.0.136.66429.40"))
		       (#&(Rule "LVS.0.0.136.66429.41"))
		       (#&(Rule "LVS.0.0.136.66429.42"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$Rf") myViewName Source)
	 (created "18-FEB-83 22:45:14")
	 (creator STEFIK)
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("FRSC@$P[")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.43"))
		       (#&(Rule "LVS.0.0.136.66429.44"))
		       (#&(Rule "LVS.0.0.136.66429.45"))
		       (#&(Rule "LVS.0.0.136.66429.46"))
		       (#&(Rule "LVS.0.0.136.66429.47"))
		       (#&(Rule "LVS.0.0.136.66429.48"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$PY"))
	 (created "18-FEB-83 20:41:23")
	 (creator STEFIK)
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("FRSC@$PM")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.228"))
		       (#&(Rule "LZS.0.5349.129.33698.229"))
		       (#&(Rule "LZS.0.5349.129.33698.230"))
		       (#&(Rule "LZS.0.5349.129.33698.231"))
		       (#&(Rule "LZS.0.5349.129.33698.232"))
		       (#&(Rule "LZS.0.5349.129.33698.233"))))
	 (perspectiveNode #&(RuleSetNode "FRSC@$PH") myViewName Source)
	 (created " 1-FEB-83 14:25:40")
	 (creator LOOPSCOURSE)
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("YQSC@<@J")
         (indexedVars ((#&(Rule "LVS.0.0.136.66429.1"))
		       (#&(Rule "LVS.0.0.136.66429.2"))
		       (#&(Rule "LVS.0.0.136.66429.3"))
		       (#&(Rule "LVS.0.0.136.66429.4"))
		       (#&(Rule "LVS.0.0.136.66429.5"))
		       (#&(Rule "LVS.0.0.136.66429.6"))
		       (#&(Rule "LVS.0.0.136.66429.7"))
		       (#&(Rule "LVS.0.0.136.66429.55"))))
	 (perspectiveNode #&(RuleSetNode "YQSC@<@I") myViewName Source)
	 (created " 1-FEB-83 14:25:51")
	 (creator LOOPSCOURSE)
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)]


[DEFINST Rule ("LVS.0.0.136.66429.9")
         (source 
"(* Returns a stopping place en route to a destination.)

IF truck:fuel=0
THEN stoppingPlace←(AnyRoadStop $UnionHall);")
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$Oz"))]


[DEFINST Rule ("LVS.0.0.136.66429.10")
         (source 
"(* Dont run out of gas.)
IF goal~='SitTight 
   truck:fuel < .25 * truck::MaxFuel
   truck:cashBox>0
   gasStation←(NearestRoadStop (RoadStops $GasStation .Range1 NIL 'Room))
THEN stoppingPlace←gasStation;")
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$Oz"))]


[DEFINST Rule ("LVS.0.0.136.66429.11")
         (source 
"(* Obey the law - stop at WeighStations.)
IF wStation←(NearestRoadStop (RoadStops $WeighStation .Range1 direction 'Room))
   (Distance wStation)<(Distance destination) 
THEN stoppingPlace←wStation;")
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$Oz"))]


[DEFINST Rule ("LVS.0.0.136.66429.12")
         (source 
   "IF (Distance destination)<=.Range1 (RoomToParkP destination)
THEN stoppingPlace←destination;")
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$Oz"))]


[DEFINST Rule ("LVS.0.0.136.66429.13")
         (source 
"IF gasStation←(FurthestRoadStop (RoadStops $GasStation .Range1 direction 'Room))
   gasStation:qty>0
THEN stoppingPlace←gasStation;")
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$Oz"))]


[DEFINST Rule ("LVS.0.0.136.66429.14")
         (source "THEN stoppingPlace←(NthRoadStop  maxMove direction NIL 'Room);")
	 (edited "22-JUL-83 18:36:42")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$Oz"))]


[DEFINST Rule ("LVS.0.0.136.66429.8")
         (source "	-> direction←(DirectionOf destination);")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.15")
         (source "        -> realLocation←truck:location;")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.16")
         (source 
"	IF .FindStoppingPlace stoppingPlace~=truck:location
          ~stoppingPlace.BanditP
	THEN (← \PlayerInterface Move self stoppingPlace)
               realLocation←truck:location;")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.17")
         (source 
"        IF realLocation~=stoppingPlace 
	THEN (WriteGameStatus %"Oh!! %" driver %" Didnt reach stoppingPlace%");")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.18")
         (source "	IF (ISA realLocation $GasStation)
	THEN .BuyGas;")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.19")
         (source 
"	IF (ISA realLocation $Producer) ~(ISA realLocation $GasStation)
           goal='Peddle
	   realLocation=destination 
           numBuy←(← self MaxPurchase realLocation)
           numBuy>=1  
	THEN (← \PlayerInterface Buy self numBuy);")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.20")
         (source "	IF (ISA realLocation $Consumer) truck:cargo
	THEN .SellGoods;")
	 (edited "22-JUL-83 18:36:07")
	 (editor STEFIK)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "FRSC@$PA"))]


[DEFINST Rule ("LVS.0.0.136.66429.21")
         (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 "22-JUL-83 18:35:43")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$TR"))]


[DEFINST Rule ("LVS.0.0.136.66429.22")
         (source 
"   
-> volumeLimit ← volumeCapacity / roadStop::Commodity::VolPerQty
   weightLimit ← weightCapacity / roadStop::Commodity::WtPerQty
   cashLimit ← cashCapacity / (PricePerUnit roadStop)
   producerLimit ← roadStop:qty;")
	 (edited "22-JUL-83 18:35:43")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$TR"))]


[DEFINST Rule ("LVS.0.0.136.66429.23")
         (source "-> numBuy ← (MIN volumeLimit weightLimit cashLimit producerLimit);")
	 (edited "22-JUL-83 18:35:43")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$TR"))]


[DEFINST Rule ("LVS.0.0.136.66429.24")
         (source 
      "	(* Rate the suitability of a proposed Consumer.)

-> cargo ← (CAR truck:cargo) rating←0;")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.25")
         (source 
"(* if spoiled go to CityDump)
IF ~cargo:status (ISA roadStop $CityDump) 
THEN (STOP 5000 'CityDump 'LookNoMore);")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.26")
         (source "IF ~cargo:status
THEN (STOP NIL 'SpoiltGoods 'CannotSell);")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.27")
         (source 
  "(* Consumer must want current cargo.)
 IF ~(ISA cargo roadStop::Commodity)
  THEN (STOP NIL);")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.28")
         (source "(* Need to be able to park)
 IF ~(RoomToParkP roadStop)
  THEN (STOP NIL);")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.29")
         (source 
	"(* Exclude consumers that have full inventory.)
 IF roadStop:qty < 1
  THEN (STOP NIL);")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.30")
         (source "(* Favor high price ratios.)
  -> rating ← rating + 100 * roadStop:pr ;")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.31")
         (source 
"(* Favor close places.)
  -> rating ← rating - [truck::Gpm *(Distance roadStop truck:location)];")
	 (edited "22-JUL-83 18:35:14")
	 (editor STEFIK)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "FRSC@$RX"))]


[DEFINST Rule ("LVS.0.0.136.66429.32")
         (source "	(* Rate the suitability of a proposed Producer.)
-> rating ← 0;")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.33")
         (source "(* Need to be able to park)
IF ~(RoomToParkP roadStop)
 THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.34")
         (source 
"(* Exclude perishables.)
 IF (SUBCLASS roadStop::Commodity $PerishableCommodity)
  THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.35")
         (source "(* Exclude gas stations.)
 IF (ISA roadStop $GasStation)
  THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.36")
         (source "(* Exclude producers that are sold out.)
 IF roadStop:qty < 1
  THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.37")
         (source 
"(* Exclude excessively fragile goods.)
 IF (SUBCLASS roadStop::Commodity $FragileCommodity)  
  THEN rating ← rating - [500 * roadStop::Commodity::FragilityLevel];")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.38")
         (source 
"(* Penalize producers for which can buy < 2 items.)
 IF maxBuy←(← self MaxPurchase roadStop) maxBuy < 1
  THEN rating ← rating - 10000;")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.39")
         (source 
"(* favor LuxuryGoods)
IF (SUBCLASS roadStop::Commodity $LuxuryGoods)
THEN rating ← rating + 200;")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.40")
         (source "(* favor higher qty)
 -> rating ← rating + 10 * maxBuy;")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 9)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.41")
         (source "(* Favor low price ratios.)
  -> rating ← rating + 100 * [2 - roadStop:pr];")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 10)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.42")
         (source 
"(* Favor close places.)
  -> rating ← rating - [truck::Gpm * (Distance roadStop truck:location)];")
	 (edited "22-JUL-83 18:34:50")
	 (editor STEFIK)
	 (ruleNumber 11)
	 (ruleSet #&(RuleSet "FRSC@$Qy"))]


[DEFINST Rule ("LVS.0.0.136.66429.43")
         (source 
"(* Rating RuleSet for spots near Alices.  Returns a number for spots.)

-> cargo ← (CAR truck:cargo);")
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$PR"))]


[DEFINST Rule ("LVS.0.0.136.66429.44")
         (source "IF ~(RoomToParkP roadStop)
 THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$PR"))]


[DEFINST Rule ("LVS.0.0.136.66429.45")
         (source "IF (ISA roadStop $UnionHall)
 THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$PR"))]


[DEFINST Rule ("LVS.0.0.136.66429.46")
         (source "IF (ISA roadStop $AlicesRestaurant)
 THEN (STOP NIL);")
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$PR"))]


[DEFINST Rule ("LVS.0.0.136.66429.47")
         (source 
	"   (* Favor places closer to Alices.)
-> rating ← 100 - 4 * (Distance roadStop alices);")
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$PR"))]


[DEFINST Rule ("LVS.0.0.136.66429.48")
         (source 
"IF cargo (ISA roadStop $Consumer) (ISA cargo roadStop::Commodity)
   roadStop:qty>0 roadStop:pr>1
 THEN rating ← rating + 20;")
	 (edited "22-JUL-83 18:34:21")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$PR"))]


[DEFINST Rule ("LZS.0.5349.129.33698.228")
         (source "	-> cargo←(CAR truck:cargo);")
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "FRSC@$PC"))]


[DEFINST Rule ("LZS.0.5349.129.33698.229")
         (source 
	 "	IF ~(ISA cargo truck:location::Commodity)
	THEN (STOP NIL 'NoSale 'WrongKindOfBuyer);")
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "FRSC@$PC"))]


[DEFINST Rule ("LZS.0.5349.129.33698.230")
         (source 
"        (* Make sale as limited by cargo and consumer.)

        IF ~cargo:status (ISA truck:location $CityDump)
        THEN sellQty←(MIN truck:location:qty cargo:qty) 
             (← \PlayerInterface Sell self cargo sellQty)
             (STOP T 'Sold 'AtCityDump);")
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "FRSC@$PC"))]


[DEFINST Rule ("LZS.0.5349.129.33698.231")
         (source 
	  "	IF truck:location:pr < 1.1 goal='Peddle 
	THEN (STOP NIL 'NoSale 'AvoidCheapSkates);")
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "FRSC@$PC"))]


[DEFINST Rule ("LZS.0.5349.129.33698.232")
         (source "	IF truck:location:pr < 0 
	THEN (STOP NIL 'NoSale 'NeverSellAtLoss);")
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "FRSC@$PC"))]


[DEFINST Rule ("LZS.0.5349.129.33698.233")
         (source 
"	IF cargo:status sellQty←(MIN truck:location:qty cargo:qty) sellQty>=1 
	THEN (← \PlayerInterface Sell self cargo sellQty);")
	 (edited "26-JUL-83 16:03:53")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "FRSC@$PC"))]


[DEFINST Rule ("LVS.0.0.136.66429.1")
         (source 
"   (* Top-Level RuleSet for taking turns.  Sets goal and destination.)

 IF ~goal
  THEN goal←'Peddle;")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.2")
         (source 
" IF truck:cargo goal='Peddle possibleStops←(RoadStops $Consumer)
  THEN destination←(PickHiObj self 'RateConsumers possibleStops);")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.3")
         (source 
" IF ~truck:cargo goal='Peddle possibleStops←(RoadStops $Producer)
  THEN destination←(PickHiObj self 'RateProducers possibleStops);")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.4")
         (source 
"(* Don't move away from Alices during endgame.)
 IF goal='GoToAlices truck:location=alices
  THEN goal←'SitTight;")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.5")
         (source 
"(* Except dont overstay at Alices.)
IF truck:location=alices  .TimeAtStop > 25 goal='SitTight
 THEN alices←(NearestRoadStop (RoadStops $AlicesRestaurant))
       destination← (PickHiObj self 'RateSpotsNearAlices (RoadStops))
       goal←'GetClose;")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.6")
         (source 
"(* Get near to Alices when time gets close)		
 IF \Simulator:timeLeft < 50 ~[goal<<'(SitTight GetClose GoToAlices)]  
  THEN alices←(NearestRoadStop (RoadStops $AlicesRestaurant))
       destination← (PickHiObj self 'RateSpotsNearAlices (RoadStops))
       goal←'GetClose;")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.7")
         (source 
"(* Go to Alices now that it is time)
 IF \Simulator:timeLeft < 30 
    ~(ISA truck:location $AlicesRestaurant)   
  THEN destination← (NearestRoadStop (RoadStops $AlicesRestaurant))
       goal←'GoToAlices ;")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


[DEFINST Rule ("LVS.0.0.136.66429.55")
         (source 
"IF ~(OR goal='SitTight 
       (AND goal='GetClose (Distance truck:location alices)<=3))
 THEN .GoToStoppingPlace;")
	 (edited "22-JUL-83 18:33:13")
	 (editor STEFIK)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "YQSC@<?t"))]


(DECLARE: DONTCOPY
  (FILEMAP (NIL (3970 4961 (Peddler.FindStoppingPlace 3980 . 4105) (Peddler.GoToStoppingPlace 4107 . 
4232) (Peddler.MaxPurchase 4234 . 4354) (Peddler.RateConsumers 4356 . 4482) (Peddler.RateProducers 
4484 . 4610) (Peddler.RateSpotsNearAlices 4612 . 4756) (Peddler.SellGoods 4758 . 4859) (
Peddler.TakeTurn 4861 . 4959)) (4962 24406 (FindStoppingPlacePeddlerRules 4972 . 8791) (
GoToStoppingPlacePeddlerRules 8793 . 10710) (PeddlerMaxPurchase 10712 . 12088) (PeddlerRateConsumers 
12090 . 13823) (PeddlerRateProducers 13825 . 15831) (PeddlerRateSpotsNearAlices 15833 . 17007) (
SellGoodsPeddlerRules 17009 . 19105) (TakeTurnPeddlerRules 19107 . 24404)))))
STOP