(FILECREATED "26-Mar-85 19:51:10" {INDIGO}<LOOPS>SOURCES>TRUCKIN>PLANNER.;2 53192  

      changes to:  (METHODS Planner.AtCurrentStop Planner.Buy Planner.BuyGas Planner.CarryOutGoal 
			    Planner.FindStoppingPlace Planner.GetClose Planner.GoToAlice 
			    Planner.GoToStoppingPlace Planner.LeaveAlice Planner.PurchaseGas 
			    Planner.RateDumps Planner.RateGasStations Planner.Sell Planner.SellGoods 
			    Planner.SetGoal Planner.SitTight Planner.TakeTurn)
		   (FNS Planner.AtCurrentStop Planner.Buy Planner.BuyGas Planner.CarryOutGoal 
			Planner.FindStoppingPlace Planner.GetClose Planner.GoToAlice 
			Planner.GoToStoppingPlace Planner.LeaveAlice Planner.PurchaseGas 
			Planner.RateDumps Planner.RateGasStations Planner.Sell Planner.SellGoods 
			Planner.SetGoal Planner.SitTight Planner.TakeTurn)

      previous date: "13-NOV-83 18:32:54" {INDIGO}<LOOPS>SOURCES>TRUCKIN>PLANNER.;1)


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

(PRETTYCOMPRINT PLANNERCOMS)

(RPAQQ PLANNERCOMS ((CLASSES Planner)
	(METHODS Planner.AtCurrentStop Planner.Buy Planner.BuyGas Planner.CarryOutGoal 
		 Planner.FindStoppingPlace Planner.GetClose Planner.GoToAlice 
		 Planner.GoToStoppingPlace Planner.LeaveAlice Planner.PurchaseGas Planner.RateDumps 
		 Planner.RateGasStations Planner.Sell Planner.SellGoods Planner.SetGoal 
		 Planner.SitTight Planner.TakeTurn)
	(FNS AtCurrentStopPlanner BuyGasPlanner BuyPlanner CarryOutGoalPlanner 
	     FindStoppingPlacePlannerRules GetClosePlanner GoToAlicePlanner 
	     GoToStoppingPlacePlannerRules LeaveAlicePlanner PurchaseGasPlanner RateDumpsPlanner 
	     RateGasStationsPlannerRules SellGoodsPlannerRules SellPlanner SetGoalPlanner 
	     SitTightPlanner TakeTurnPlannerRules)
	(INSTANCES AtCurrentStopPlanner BuyGasPlanner BuyPlanner CarryOutGoalPlanner 
		   FindStoppingPlacePlannerRules GetClosePlanner GoToAlicePlanner 
		   GoToStoppingPlacePlannerRules LeaveAlicePlanner PurchaseGasPlanner 
		   RateDumpsPlanner RateGasStationsPlannerRules SellGoodsPlannerRules SellPlanner 
		   SetGoalPlanner SitTightPlanner TakeTurnPlannerRules)))
(DEFCLASSES Planner)
[DEFCLASS Planner
   (MetaClass PlayerMeta Edited:                             (* sm: "23-JUN-83 12:40"))
   (Supers Peddler)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))
   (InstanceVariables (goal Buy)
		      (higherGoal Buy doc                    (* main goal if temporarily overridden))
		      (prevGoal NIL)
		      (sellers NIL))]

[METH Planner  AtCurrentStop NIL
      NIL (method Planner.AtCurrentStop RuleSet AtCurrentStopPlanner)]


[METH Planner  Buy NIL
      NIL (method Planner.Buy RuleSet BuyPlanner)]


[METH Planner  BuyGas NIL
      NIL (method Planner.BuyGas RuleSet BuyGasPlanner)]


[METH Planner  CarryOutGoal NIL
      NIL (method Planner.CarryOutGoal RuleSet CarryOutGoalPlanner)]


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


[METH Planner  GetClose NIL
      NIL (method Planner.GetClose RuleSet GetClosePlanner)]


[METH Planner  GoToAlice NIL
      NIL (method Planner.GoToAlice RuleSet GoToAlicePlanner)]


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


[METH Planner  LeaveAlice NIL
      NIL (method Planner.LeaveAlice RuleSet LeaveAlicePlanner)]


[METH Planner  PurchaseGas NIL
      NIL (method Planner.PurchaseGas RuleSet PurchaseGasPlanner)]


[METH Planner  RateDumps (roadStop)
      NIL (method Planner.RateDumps RuleSet RateDumpsPlanner)]


[METH Planner  RateGasStations (rs)
      NIL (method Planner.RateGasStations RuleSet RateGasStationsPlannerRules)]


[METH Planner  Sell NIL
      NIL (method Planner.Sell RuleSet SellPlanner)]


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


[METH Planner  SetGoal NIL
      NIL (method Planner.SetGoal RuleSet SetGoalPlanner)]


[METH Planner  SitTight NIL
      NIL (method Planner.SitTight RuleSet SitTightPlanner)]


[METH Planner  TakeTurn NIL
      NIL (method Planner.TakeTurn RuleSet TakeTurnPlannerRules)]


(DEFINEQ

(Planner.AtCurrentStop
  (Method ((Planner AtCurrentStop)
	   self)
	  (AtCurrentStopPlanner self)))

(Planner.Buy
  (Method ((Planner Buy)
	   self)
	  (BuyPlanner self)))

(Planner.BuyGas
  (Method ((Planner BuyGas)
	   self)
	  (BuyGasPlanner self)))

(Planner.CarryOutGoal
  (Method ((Planner CarryOutGoal)
	   self)
	  (CarryOutGoalPlanner self)))

(Planner.FindStoppingPlace
  (Method ((Planner FindStoppingPlace)
	   self)
	  (FindStoppingPlacePlannerRules self)))

(Planner.GetClose
  (Method ((Planner GetClose)
	   self)
	  (GetClosePlanner self)))

(Planner.GoToAlice
  (Method ((Planner GoToAlice)
	   self)
	  (GoToAlicePlanner self)))

(Planner.GoToStoppingPlace
  (Method ((Planner GoToStoppingPlace)
	   self)
	  (GoToStoppingPlacePlannerRules self)))

(Planner.LeaveAlice
  (Method ((Planner LeaveAlice)
	   self)
	  (LeaveAlicePlanner self)))

(Planner.PurchaseGas
  (Method ((Planner PurchaseGas)
	   self)
	  (PurchaseGasPlanner self)))

(Planner.RateDumps
  (Method ((Planner RateDumps)
	   self roadStop)
	  (RateDumpsPlanner self roadStop)))

(Planner.RateGasStations
  (Method ((Planner RateGasStations)
	   self rs)
	  (RateGasStationsPlannerRules self rs)))

(Planner.Sell
  (Method ((Planner Sell)
	   self)
	  (SellPlanner self)))

(Planner.SellGoods
  (Method ((Planner SellGoods)
	   self)
	  (SellGoodsPlannerRules self)))

(Planner.SetGoal
  (Method ((Planner SetGoal)
	   self)
	  (SetGoalPlanner self)))

(Planner.SitTight
  (Method ((Planner SitTight)
	   self)
	  (SitTightPlanner self)))

(Planner.TakeTurn
  (Method ((Planner TakeTurn)
	   self)
	  (TakeTurnPlannerRules self)))
)
(DEFINEQ

(AtCurrentStopPlanner
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value realLocation numBuy)
          [SETQ ↑value (SETQ realLocation (GetValue (GetValue self (QUOTE truck))
						    (QUOTE location]
          [COND
	    ([AND (GetValue self (QUOTE stoppingPlace))
		  (NEQ realLocation (GetValue self (QUOTE stoppingPlace]
	      (SETQ ↑value (WriteGameStatus "Oh! " (GetValue self (QUOTE driver))
					    " didnt reach stoppingPlace"]
          [COND
	    ((ISA realLocation ($ GasStation))
	      (SETQ ↑value (← self PurchaseGas]
          [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 "LZS.0.5349.129.33698.191")))
				  (← self CarryOutGoal)
				  (PutAuditRec self (QUOTE destination)
					       NIL ↑auditRecord]
      QUIT(RETURN ↑value])

(BuyGasPlanner
  [LAMBDA (self)
    (PROG (↑value tdest)
          [COND
	    [[SETQ tdest (PickHiObj self (QUOTE RateGasStations)
				    (RoadStops ($ GasStation)
					       (← self Range]
	      (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					    tdest)
				  (PutValue self (QUOTE direction)
					    (DirectionOf (GetValue self (QUOTE destination]
	    [(OR (GREATERP (GetValue (GetValue self (QUOTE truck))
				     (QUOTE cashBox))
			   400000)
		 (LESSP (GetValue Simulator (QUOTE timeLeft))
			240))
	      (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					    (GetValue (GetValue self (QUOTE truck))
						      (QUOTE location)))
				  (PutValue self (QUOTE direction)
					    (DirectionOf (GetValue self (QUOTE destination]
	    (T (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					     (AnyRoadStop ($ UnionHall)))
				   (PutValue self (QUOTE direction)
					     (DirectionOf (GetValue self (QUOTE destination]
      QUIT(RETURN ↑value])

(BuyPlanner
  [LAMBDA (self)
    (PROG (↑value tdest)
          [COND
	    ([AND (PutValue self (QUOTE sellers)
			    (Sellers ($ Commodity)))
		  (SETQ tdest (PickHiObj self (QUOTE RateProducers)
					 (GetValue self (QUOTE sellers]
	      (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					    tdest)
				  (PutValue self (QUOTE direction)
					    (DirectionOf (GetValue self (QUOTE destination]
      QUIT(RETURN ↑value])

(CarryOutGoalPlanner
  [LAMBDA (self)
    (PROG (↑value numBuy)
          [COND
	    ((FMEMB (GetValue self (QUOTE goal))
		    (QUOTE (LeaveAlice SitTight GetClose GoToAlice)))
	      (SETQ ↑value (PROGN)))
	    ((EQ (GetValue self (QUOTE goal))
		 (QUOTE BuyGas))
	      (SETQ ↑value (PutValue self (QUOTE goal)
				     NIL)))
	    ((AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE Buy))
		  [SETQ numBuy (← self MaxPurchase (GetValue (GetValue self (QUOTE truck))
							     (QUOTE location]
		  (GEQ numBuy 1))
	      (SETQ ↑value (← PlayerInterface Buy self numBuy)))
	    ((AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE Sell))
		  (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo)))
	      (SETQ ↑value (← self SellGoods]
      QUIT(RETURN ↑value])

(FindStoppingPlacePlannerRules
  [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 "LYS.0.5349.124.36446.184")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (AnyRoadStop ($ UnionHall))
					       ↑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 "LYS.0.5349.124.36446.185")))
				  (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 "LYS.0.5349.124.36446.186")))
				  (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 "LYS.0.5349.124.36446.187")))
				  (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 "LYS.0.5349.124.36446.188")))
				   (PutAuditRec self (QUOTE stoppingPlace)
						(NthRoadStop (GetValue self (QUOTE maxMove))
							     (GetValue self (QUOTE direction))
							     NIL
							     (QUOTE Room))
						↑auditRecord]
      QUIT(RETURN ↑value])

(GetClosePlanner
  [LAMBDA (self)
    (PROG (↑value)
          [COND
	    (T (SETQ ↑value (PROGN [PutValue self (QUOTE alices)
					     (NearestRoadStop (RoadStops ($ AlicesRestaurant]
				   (PutValue self (QUOTE destination)
					     (PickHiObj self (QUOTE RateSpotsNearAlices)
							(RoadStops)))
				   (PutValue self (QUOTE direction)
					     (DirectionOf (GetValue self (QUOTE destination]
      QUIT(RETURN ↑value])

(GoToAlicePlanner
  [LAMBDA (self)
    (PROG (↑value tdest)
          [COND
	    ((SETQ tdest (NearestRoadStop (RoadStops ($ AlicesRestaurant)
						     NIL NIL T)))
	      (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					    tdest)
				  (PutValue self (QUOTE direction)
					    (DirectionOf (GetValue self (QUOTE destination]
      QUIT(RETURN ↑value])

(GoToStoppingPlacePlannerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value)
          [COND
	    ((EQ (GetValue self (QUOTE stoppingPlace))
		 (GetValue (GetValue self (QUOTE truck))
			   (QUOTE location)))
	      (SETQ ↑value (WriteGameStatus "Hm! " (GetValue self (QUOTE driver))
					    " already there")))
	    ((← (GetValue self (QUOTE stoppingPlace))
		BanditP)
	      (SETQ ↑value (WriteGameStatus (GetValue self (QUOTE driver))
					    " Not moving because of bandits")))
	    (T (SETQ ↑value (← PlayerInterface Move self (GetValue self (QUOTE stoppingPlace]
      QUIT(RETURN ↑value])

(LeaveAlicePlanner
  [LAMBDA (self)
    (PROG (↑value)
          [COND
	    (T (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					     (NearestRoadStop (RoadStops ($ RoadStop)
									 NIL NIL T)))
				   (PutValue self (QUOTE direction)
					     (DirectionOf (GetValue self (QUOTE destination]
      QUIT(RETURN ↑value])

(PurchaseGasPlanner
  [LAMBDA (self)
    (PROG (↑value spaceInTank fuelAffordable fuelAvailable qty)
          [SETQ ↑value (PROGN [SETQ spaceInTank (DIFFERENCE (GetClassValue (GetValue self
										     (QUOTE truck))
									   (QUOTE MaxFuel))
							    (GetValue (GetValue self (QUOTE truck))
								      (QUOTE fuel]
			      (SETQ fuelAvailable (GetValue (GetValue (GetValue self (QUOTE truck))
								      (QUOTE location))
							    (QUOTE qty)))
			      [SETQ fuelAffordable (QUOTIENT (GetValue (GetValue self (QUOTE truck))
								       (QUOTE cashBox))
							     (PricePerUnit
							       (GetValue (GetValue self (QUOTE truck))
									 (QUOTE location]
			      (SETQ qty (MIN spaceInTank fuelAffordable fuelAvailable]
          [COND
	    ((GREATERP qty 0)
	      (SETQ ↑value (← PlayerInterface Buy self qty]
      QUIT(RETURN ↑value])

(RateDumpsPlanner
  [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
	    ((NOT (RoomToParkP roadStop))
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 500]
          [COND
	    ((LESSP (GetValue roadStop (QUOTE qty))
		    1)
	      (SETQ ↑value (SETQ rating (DIFFERENCE rating 1000]
          [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])

(RateGasStationsPlannerRules
  [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]
      QUIT(RETURN ↑value])

(SellGoodsPlannerRules
  [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 Sell)))
	      (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 NeverAtLoss))
				  (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])

(SellPlanner
  [LAMBDA (self)
    (PROG (↑value tdest has)
          [COND
	    [[AND [SETQ has (CAR (GetValue (GetValue self (QUOTE truck))
					   (QUOTE cargo]
		  (NOT (GetValue has (QUOTE status)))
		  (SETQ tdest (PickHiObj self (QUOTE RateDumps)
					 (RoadStops ($ CityDump]
	      (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					    tdest)
				  (PutValue self (QUOTE direction)
					    (DirectionOf (GetValue self (QUOTE destination]
	    ([AND has (SETQ tdest (PickHiObj self (QUOTE RateConsumers)
					     (Buyers has]
	      (SETQ ↑value (PROGN (PutValue self (QUOTE destination)
					    tdest)
				  (PutValue self (QUOTE direction)
					    (DirectionOf (GetValue self (QUOTE destination]
      QUIT(RETURN ↑value])

(SetGoalPlanner
  [LAMBDA (self)
    (PROG (↑value)
          [COND
	    [(AND (ISA (GetValue (GetValue self (QUOTE truck))
				 (QUOTE location))
		       ($ AlicesRestaurant))
		  (GEQ (← self TimeAtStop)
		       25))
	      (SETQ ↑value (PutValue self (QUOTE goal)
				     (QUOTE LeaveAlice]
	    ((FMEMB (GetValue self (QUOTE goal))
		    (QUOTE (SitTight BuyGas)))
	      (SETQ ↑value (PROGN)))
	    [(AND (EQ (GetValue self (QUOTE goal))
		      (QUOTE GoToAlice))
		  (ISA (GetValue (GetValue self (QUOTE truck))
				 (QUOTE location))
		       ($ AlicesRestaurant)))
	      (SETQ ↑value (PutValue self (QUOTE goal)
				     (QUOTE SitTight]
	    [(LESSP (GetValue Simulator (QUOTE timeLeft))
		    30)
	      (SETQ ↑value (PROGN (PutValue self (QUOTE goal)
					    (QUOTE GoToAlice))
				  (PutValue self (QUOTE higherGoal)
					    (QUOTE GoToAlice]
	    [(AND [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 ↑value (PROGN (PutValue self (QUOTE higherGoal)
					    (GetValue self (QUOTE goal)))
				  (PutValue self (QUOTE goal)
					    (QUOTE BuyGas]
	    [(LESSP (GetValue Simulator (QUOTE timeLeft))
		    60)
	      (SETQ ↑value (PROGN (PutValue self (QUOTE goal)
					    (QUOTE GetClose))
				  (PutValue self (QUOTE higherGoal)
					    (QUOTE GoToAlice]
	    [(GetValue (GetValue self (QUOTE truck))
		       (QUOTE cargo))
	      (SETQ ↑value (PutValue self (QUOTE goal)
				     (QUOTE Sell]
	    (T (SETQ ↑value (PutValue self (QUOTE goal)
				      (QUOTE Buy]
      QUIT(RETURN ↑value])

(SitTightPlanner
  [LAMBDA (self)
    (PROG (↑value)
          [COND
	    (T (SETQ ↑value (PutValue self (QUOTE destination)
				      NIL]
      QUIT(RETURN ↑value])

(TakeTurnPlannerRules
  [LAMBDA (self)
    (PROG (↑auditRecord ↑value possibleStops)
          (SETQ ↑value (← self SetGoal))
          [COND
	    ((GetValue self (QUOTE goal))
	      (SETQ ↑value (DoMethod self (GetValue self (QUOTE goal))
				     NIL]
          [COND
	    ((GetValue self (QUOTE destination))
	      (SETQ ↑value (← self FindStoppingPlace]
          [COND
	    ((AND (GetValue self (QUOTE destination))
		  (GetValue self (QUOTE stoppingPlace)))
	      (SETQ ↑value (PROGN (← self GoToStoppingPlace)
				  (← self AtCurrentStop]
      QUIT(RETURN ↑value])
)
[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@EN@")
	  (perspectiveNode #&(RuleSetNode "UVSC@ENF") myViewName RuleSet)
	  (name #(AtCurrentStopPlanner NIL RememberName))
	  (compiledRules AtCurrentStopPlanner)
	  (workSpace Planner)
	  (tempVars (realLocation numBuy))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 4)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELu")
	  (perspectiveNode #&(RuleSetNode "UVSC@EM>"))
	  (name #(BuyGasPlanner NIL RememberName))
	  (compiledRules BuyGasPlanner)
	  (workSpace Planner)
	  (tempVars (tdest))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 3)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELv")
	  (perspectiveNode #&(RuleSetNode "UVSC@EM?"))
	  (name #(BuyPlanner NIL RememberName))
	  (compiledRules BuyPlanner)
	  (workSpace Planner)
	  (tempVars (tdest))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 1)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ENA")
	  (perspectiveNode #&(RuleSetNode "UVSC@ENG"))
	  (name #(CarryOutGoalPlanner NIL RememberName))
	  (compiledRules CarryOutGoalPlanner)
	  (workSpace Planner)
	  (tempVars (numBuy))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 4)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@EMq")
	  (perspectiveNode #&(RuleSetNode "UVSC@ENH") myViewName RuleSet)
	  (name #(FindStoppingPlacePlannerRules NIL RememberName))
	  (compiledRules FindStoppingPlacePlannerRules)
	  (workSpace Planner)
	  (tempVars (wStation gasStation))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 5)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELr")
	  (perspectiveNode #&(RuleSetNode "UVSC@EM@"))
	  (name #(GetClosePlanner NIL RememberName))
	  (compiledRules GetClosePlanner)
	  (workSpace Planner)
	  (tempVars NIL)
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 1)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELs")
	  (perspectiveNode #&(RuleSetNode "UVSC@EMA"))
	  (name #(GoToAlicePlanner NIL RememberName))
	  (compiledRules GoToAlicePlanner)
	  (workSpace Planner)
	  (tempVars (tdest))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 1)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@EN=")
	  (perspectiveNode #&(RuleSetNode "UVSC@ENI") myViewName RuleSet)
	  (name #(GoToStoppingPlacePlannerRules NIL RememberName))
	  (compiledRules GoToStoppingPlacePlannerRules)
	  (workSpace Planner)
	  (tempVars NIL)
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 3)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELq")
	  (perspectiveNode #&(RuleSetNode "UVSC@EMB"))
	  (name #(LeaveAlicePlanner NIL RememberName))
	  (compiledRules LeaveAlicePlanner)
	  (workSpace Planner)
	  (tempVars NIL)
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 1)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ENx")
	  (perspectiveNode #&(RuleSetNode "UVSC@EO?") myViewName RuleSet)
	  (name #(PurchaseGasPlanner NIL RememberName))
	  (compiledRules PurchaseGasPlanner)
	  (workSpace Planner)
	  (tempVars (spaceInTank fuelAffordable fuelAvailable qty))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 2)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL (roadStop)
      NIL (method ? methodClass RuleSet UID "UVSC@EL|")
	  (perspectiveNode #&(RuleSetNode "UVSC@EMC") myViewName RuleSet)
	  (name #(RateDumpsPlanner NIL RememberName))
	  (compiledRules RateDumpsPlanner)
	  (workSpace Planner)
	  (tempVars (rating cargo))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 5)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL (rs)
      NIL (method ? methodClass RuleSet UID "UVSC@ENC")
	  (perspectiveNode #&(RuleSetNode "UVSC@ENJ") myViewName RuleSet)
	  (name #(RateGasStationsPlannerRules NIL RememberName))
	  (compiledRules RateGasStationsPlannerRules)
	  (workSpace Planner)
	  (tempVars (rating))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 3)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "LZS.0.5349.129.33698.187")
	  (perspectiveNode #&(RuleSetNode "LZS.0.5349.129.33698.210") myViewName RuleSet)
	  (name #(SellGoodsPlannerRules NIL RememberName))
	  (compiledRules SellGoodsPlannerRules)
	  (workSpace Planner)
	  (tempVars (cargo sellQty))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 6)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELx")
	  (perspectiveNode #&(RuleSetNode "UVSC@EMD"))
	  (name #(SellPlanner NIL RememberName))
	  (compiledRules SellPlanner)
	  (workSpace Planner)
	  (tempVars (tdest has))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 2)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELo")
	  (perspectiveNode #&(RuleSetNode "UVSC@EME") myViewName RuleSet)
	  (name #(SetGoalPlanner NIL RememberName))
	  (compiledRules SetGoalPlanner)
	  (workSpace Planner)
	  (tempVars NIL)
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 8)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELp")
	  (perspectiveNode #&(RuleSetNode "UVSC@EMF"))
	  (name #(SitTightPlanner NIL RememberName))
	  (compiledRules SitTightPlanner)
	  (workSpace Planner)
	  (tempVars NIL)
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 1)
	  (controlStructure DO1)
	  (whileCondition NIL)
	  (compilerOptions NIL)
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[METH NIL  NIL NIL
      NIL (method ? methodClass RuleSet UID "UVSC@ELg")
	  (perspectiveNode #&(RuleSetNode "UVSC@EMG") myViewName RuleSet)
	  (name #(TakeTurnPlannerRules NIL RememberName))
	  (compiledRules TakeTurnPlannerRules)
	  (workSpace Planner)
	  (tempVars (possibleStops))
	  (taskVars NIL)
	  (debugVars NIL)
	  (numRules 4)
	  (controlStructure DOALL)
	  (whileCondition NIL)
	  (compilerOptions (A))
	  (auditClass NIL)
	  (metaAssignments NIL)
	  (ruleClass NIL)
	  (taskClass)]


[DEFINST RuleSetNode ("UVSC@ENF")
         (perspectives ? RuleSet #&(RuleSet "UVSC@EN@") Source #&(RuleSetSource "UVSC@ENK"))]


[DEFINST RuleSetNode ("UVSC@EM>")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELu") Source #&(RuleSetSource "UVSC@EMH"))]


[DEFINST RuleSetNode ("UVSC@EM?")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELv") Source #&(RuleSetSource "UVSC@EMI"))]


[DEFINST RuleSetNode ("UVSC@ENG")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ENA") Source #&(RuleSetSource "UVSC@ENL"))]


[DEFINST RuleSetNode ("UVSC@ENH")
         (perspectives ? RuleSet #&(RuleSet "UVSC@EMq") Source #&(RuleSetSource "UVSC@ENM"))]


[DEFINST RuleSetNode ("UVSC@EM@")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELr") Source #&(RuleSetSource "UVSC@EMJ"))]


[DEFINST RuleSetNode ("UVSC@EMA")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELs") Source #&(RuleSetSource "UVSC@EMK"))]


[DEFINST RuleSetNode ("UVSC@ENI")
         (perspectives ? RuleSet #&(RuleSet "UVSC@EN=") Source #&(RuleSetSource "UVSC@ENN"))]


[DEFINST RuleSetNode ("UVSC@EMB")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELq") Source #&(RuleSetSource "UVSC@EML"))]


[DEFINST RuleSetNode ("UVSC@EO?")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ENx") Source #&(RuleSetSource "UVSC@EO@"))]


[DEFINST RuleSetNode ("UVSC@EMC")
         (perspectives ? RuleSet #&(RuleSet "UVSC@EL|") Source #&(RuleSetSource "UVSC@EMM"))]


[DEFINST RuleSetNode ("UVSC@ENJ")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ENC") Source #&(RuleSetSource "UVSC@ENO"))]


[DEFINST RuleSetNode ("LZS.0.5349.129.33698.210")
         (perspectives ? RuleSet #&(RuleSet "LZS.0.5349.129.33698.187") Source 
		       #&(RuleSetSource "LZS.0.5349.129.33698.211"))]


[DEFINST RuleSetNode ("UVSC@EMD")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELx") Source #&(RuleSetSource "UVSC@EMN"))]


[DEFINST RuleSetNode ("UVSC@EME")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELo") Source #&(RuleSetSource "UVSC@EMO"))]


[DEFINST RuleSetNode ("UVSC@EMF")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELp") Source #&(RuleSetSource "UVSC@EMP"))]


[DEFINST RuleSetNode ("UVSC@EMG")
         (perspectives ? RuleSet #&(RuleSet "UVSC@ELg") Source #&(RuleSetSource "UVSC@EMQ"))]


[DEFINST RuleSetSource ("UVSC@ENK")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.212"))
		       (#&(Rule "LZS.0.5349.129.33698.213"))
		       (#&(Rule "LZS.0.5349.129.33698.214"))
		       (#&(Rule "LZS.0.5349.129.33698.191"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENF") myViewName Source)
	 (created " 1-FEB-83 14:25:34")
	 (creator LOOPSCOURSE)
	 (edited "26-JUL-83 16:22:13")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMH")
         (indexedVars ((#&(Rule "SAS.0.5349.120.55117.1"))
		       (#&(Rule "SAS.0.5349.120.55117.2"))
		       (#&(Rule "SAS.0.5349.120.55117.3"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EM>"))
	 (created "22-JUN-83 17:07:59")
	 (creator MITTAL)
	 (edited " 1-SEP-83 16:13:34")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMI")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.155"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EM?"))
	 (created "22-JUN-83 17:15:22")
	 (creator MITTAL)
	 (edited "26-JUL-83 12:39:19")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@ENL")
         (indexedVars ((#&(Rule "LYS.0.5349.124.36446.197"))
		       (#&(Rule "LYS.0.5349.124.36446.198"))
		       (#&(Rule "LYS.0.5349.124.36446.199"))
		       (#&(Rule "LYS.0.5349.124.36446.200"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENG"))
	 (created "23-JUN-83 10:16:54")
	 (creator MITTAL)
	 (edited "25-JUL-83 10:20:15")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("UVSC@ENM")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.156"))
		       (#&(Rule "LZS.0.5349.129.33698.157"))
		       (#&(Rule "LZS.0.5349.129.33698.158"))
		       (#&(Rule "LZS.0.5349.129.33698.159"))
		       (#&(Rule "LZS.0.5349.129.33698.160"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENH") myViewName Source)
	 (created " 1-FEB-83 14:25:23")
	 (creator LOOPSCOURSE)
	 (edited "26-JUL-83 13:27:18")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMJ")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.161"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EM@"))
	 (created "22-JUN-83 16:47:34")
	 (creator MITTAL)
	 (edited "26-JUL-83 12:42:45")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMK")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.162"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EMA"))
	 (created "22-JUN-83 16:49:44")
	 (creator MITTAL)
	 (edited "26-JUL-83 12:43:07")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@ENN")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.215"))
		       (#&(Rule "LZS.0.5349.129.33698.216"))
		       (#&(Rule "LZS.0.5349.129.33698.217"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENI") myViewName Source)
	 (created " 1-FEB-83 14:25:34")
	 (creator LOOPSCOURSE)
	 (edited "26-JUL-83 16:43:55")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EML")
         (indexedVars ((#&(Rule "LYS.0.5349.124.36446.208"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EMB"))
	 (created "22-JUN-83 16:41:38")
	 (creator MITTAL)
	 (edited "25-JUL-83 10:21:03")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("UVSC@EO@")
         (indexedVars ((#&(Rule "LYS.0.5349.124.36446.209"))
		       (#&(Rule "LYS.0.5349.124.36446.210"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EO?") myViewName Source)
	 (created "27-JAN-83 00:31:21")
	 (creator STEFIK)
	 (edited "25-JUL-83 10:21:12")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("UVSC@EMM")
         (indexedVars ((#&(Rule "LYS.0.5349.124.36446.211"))
		       (#&(Rule "LYS.0.5349.124.36446.212"))
		       (#&(Rule "LYS.0.5349.124.36446.213"))
		       (#&(Rule "LYS.0.5349.124.36446.214"))
		       (#&(Rule "LYS.0.5349.124.36446.215"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EMC") myViewName Source)
	 (created "18-FEB-83 22:45:14")
	 (creator STEFIK)
	 (edited "25-JUL-83 10:21:31")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("UVSC@ENO")
         (indexedVars ((#&(Rule "LYS.0.5349.124.36446.216"))
		       (#&(Rule "LYS.0.5349.124.36446.217"))
		       (#&(Rule "LYS.0.5349.124.36446.218"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@ENJ") myViewName Source)
	 (created "19-MAY-83 17:26:44")
	 (creator MITTAL)
	 (edited "25-JUL-83 10:21:40")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("LZS.0.5349.129.33698.211")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.218"))
		       (#&(Rule "LZS.0.5349.129.33698.219"))
		       (#&(Rule "LZS.0.5349.129.33698.220"))
		       (#&(Rule "LZS.0.5349.129.33698.221"))
		       (#&(Rule "LZS.0.5349.129.33698.222"))
		       (#&(Rule "LZS.0.5349.129.33698.223"))))
	 (perspectiveNode #&(RuleSetNode "LZS.0.5349.129.33698.210") myViewName Source)
	 (created " 1-FEB-83 14:25:40")
	 (creator LOOPSCOURSE)
	 (edited "26-JUL-83 16:05:44")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMN")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.163"))
		       (#&(Rule "LZS.0.5349.129.33698.164"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EMD"))
	 (created "22-JUN-83 17:30:30")
	 (creator MITTAL)
	 (edited "26-JUL-83 12:48:04")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMO")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.165"))
		       (#&(Rule "LZS.0.5349.129.33698.166"))
		       (#&(Rule "LZS.0.5349.129.33698.167"))
		       (#&(Rule "LZS.0.5349.129.33698.168"))
		       (#&(Rule "LZS.0.5349.129.33698.169"))
		       (#&(Rule "LZS.0.5349.129.33698.170"))
		       (#&(Rule "LZS.0.5349.129.33698.171"))
		       (#&(Rule "LZS.0.5349.129.33698.172"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EME") myViewName Source)
	 (created "22-JUN-83 15:37:14")
	 (creator MITTAL)
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)]


[DEFINST RuleSetSource ("UVSC@EMP")
         (indexedVars ((#&(Rule "LYS.0.5349.124.36446.230"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EMF"))
	 (created "22-JUN-83 16:39:26")
	 (creator MITTAL)
	 (edited "25-JUL-83 10:22:13")
	 (editor STEFIK)]


[DEFINST RuleSetSource ("UVSC@EMQ")
         (indexedVars ((#&(Rule "LZS.0.5349.129.33698.224"))
		       (#&(Rule "LZS.0.5349.129.33698.225"))
		       (#&(Rule "LZS.0.5349.129.33698.226"))
		       (#&(Rule "LZS.0.5349.129.33698.227"))))
	 (perspectiveNode #&(RuleSetNode "UVSC@EMG") myViewName Source)
	 (created " 1-FEB-83 14:25:51")
	 (creator LOOPSCOURSE)
	 (edited "26-JUL-83 16:34:06")
	 (editor MITTAL)]


[DEFINST Rule ("LZS.0.5349.129.33698.212")
         (source "(* Take action at current stop)

-> realLocation←truck:location;")
	 (edited "26-JUL-83 16:22:13")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@EN@"))]


[DEFINST Rule ("LZS.0.5349.129.33698.213")
         (source 
"IF stoppingPlace realLocation~=stoppingPlace 
 THEN (WriteGameStatus %"Oh! %" driver %" didnt reach stoppingPlace%");")
	 (edited "26-JUL-83 16:22:13")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@EN@"))]


[DEFINST Rule ("LZS.0.5349.129.33698.214")
         (source "IF (ISA realLocation $GasStation)
 THEN .PurchaseGas;")
	 (edited "26-JUL-83 16:22:13")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@EN@"))]


[DEFINST Rule ("LZS.0.5349.129.33698.191")
         (source "IF realLocation=destination 
 THEN .CarryOutGoal  destination←NIL;")
	 (edited "26-JUL-83 16:22:13")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "UVSC@EN@"))]


[DEFINST Rule ("SAS.0.5349.120.55117.1")
         (source 
"IF tdest←(PickHiObj self 'RateGasStations (RoadStops $GasStation .Range))
 THEN destination←tdest  direction←(DirectionOf destination);")
	 (edited " 1-SEP-83 16:13:34")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELu"))]


[DEFINST Rule ("SAS.0.5349.120.55117.2")
         (source 
"IF (OR truck:cashBox > 400000 \Simulator:timeLeft < 240)
 THEN destination←truck:location direction←(DirectionOf destination);")
	 (edited " 1-SEP-83 16:13:34")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ELu"))]


[DEFINST Rule ("SAS.0.5349.120.55117.3")
         (source "THEN destination←(AnyRoadStop $UnionHall) direction←(DirectionOf destination);")
	 (edited " 1-SEP-83 16:13:34")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@ELu"))]


[DEFINST Rule ("LZS.0.5349.129.33698.155")
         (source 
"IF sellers←(Sellers $Commodity)
  tdest←(PickHiObj self 'RateProducers sellers)
 THEN destination←tdest
        direction←(DirectionOf destination);")
	 (edited "26-JUL-83 12:39:19")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELv"))]


[DEFINST Rule ("LYS.0.5349.124.36446.197")
         (source 
"(* Carry out goal, revising them if needed)
IF goal << '(LeaveAlice SitTight GetClose GoToAlice) 
 THEN ;")
	 (edited "25-JUL-83 10:20:15")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ENA"))]


[DEFINST Rule ("LYS.0.5349.124.36446.198")
         (source "IF goal='BuyGas THEN goal←NIL;")
	 (edited "25-JUL-83 10:20:15")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ENA"))]


[DEFINST Rule ("LYS.0.5349.124.36446.199")
         (source 
"IF goal='Buy numBuy←(← self MaxPurchase truck:location)
   numBuy>= 1
 THEN (← \PlayerInterface Buy self numBuy);")
	 (edited "25-JUL-83 10:20:15")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@ENA"))]


[DEFINST Rule ("LYS.0.5349.124.36446.200")
         (source "IF goal='Sell truck:cargo
 THEN .SellGoods;")
	 (edited "25-JUL-83 10:20:15")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "UVSC@ENA"))]


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

IF truck:fuel=0
THEN stoppingPlace←(AnyRoadStop $UnionHall);")
	 (edited "26-JUL-83 13:27:18")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@EMq"))]


[DEFINST Rule ("LZS.0.5349.129.33698.157")
         (source 
"(* Obey the law - stop at WeighStations.)
IF wStation←(NearestRoadStop (RoadStops $WeighStation .Range1 direction 'Room))
   (Distance wStation)<(Distance destination) 
THEN stoppingPlace←wStation;")
	 (edited "26-JUL-83 13:27:18")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@EMq"))]


[DEFINST Rule ("LZS.0.5349.129.33698.158")
         (source 
   "IF (Distance destination)<=.Range1 (RoomToParkP destination)
THEN stoppingPlace←destination;")
	 (edited "26-JUL-83 13:27:18")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@EMq"))]


[DEFINST Rule ("LZS.0.5349.129.33698.159")
         (source 
"IF gasStation←(FurthestRoadStop (RoadStops $GasStation .Range1 direction 'Room))
   gasStation:qty>0
THEN stoppingPlace←gasStation;")
	 (edited "26-JUL-83 13:27:18")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "UVSC@EMq"))]


[DEFINST Rule ("LZS.0.5349.129.33698.160")
         (source "THEN stoppingPlace←(NthRoadStop  maxMove direction NIL 'Room);")
	 (edited "26-JUL-83 13:27:18")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "UVSC@EMq"))]


[DEFINST Rule ("LZS.0.5349.129.33698.161")
         (source 
"-> alices←(NearestRoadStop(RoadStops $AlicesRestaurant ))
   destination←(PickHiObj self 'RateSpotsNearAlices (RoadStops))
   direction← (DirectionOf destination);")
	 (edited "26-JUL-83 12:42:45")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELr"))]


[DEFINST Rule ("LZS.0.5349.129.33698.162")
         (source 
"IF  tdest← (NearestRoadStop(RoadStops $AlicesRestaurant NIL NIL T))
 THEN   destination←tdest
          direction ← (DirectionOf destination);")
	 (edited "26-JUL-83 12:43:07")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELs"))]


[DEFINST Rule ("LZS.0.5349.129.33698.215")
         (source 
"(* Go to the stoppingPlace)
IF stoppingPlace=truck:location
 THEN (WriteGameStatus %"Hm! %" driver %" already there%");")
	 (edited "26-JUL-83 16:43:55")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@EN="))]


[DEFINST Rule ("LZS.0.5349.129.33698.216")
         (source 
   "IF stoppingPlace.BanditP
 THEN (WriteGameStatus  driver %" Not moving because of bandits%");")
	 (edited "26-JUL-83 16:43:55")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@EN="))]


[DEFINST Rule ("LZS.0.5349.129.33698.217")
         (source "-> (← \PlayerInterface Move self stoppingPlace);")
	 (edited "26-JUL-83 16:43:55")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@EN="))]


[DEFINST Rule ("LYS.0.5349.124.36446.208")
         (source 
"-> destination← (NearestRoadStop (RoadStops $RoadStop NIL NIL T))
   direction← (DirectionOf destination);")
	 (edited "25-JUL-83 10:21:03")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELq"))]


[DEFINST Rule ("LYS.0.5349.124.36446.209")
         (source 
"(* Buy gasoline as limited by various constraints.)

     THEN spaceInTank←truck::MaxFuel-truck:fuel
	
          fuelAvailable←truck:location:qty

          fuelAffordable←truck:cashBox/(PricePerUnit truck:location)

          qty←(MIN spaceInTank fuelAffordable fuelAvailable);")
	 (edited "25-JUL-83 10:21:12")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ENx"))]


[DEFINST Rule ("LYS.0.5349.124.36446.210")
         (source 
"(* Now appropriate quantity has been computed)

    IF qty>0
     THEN  (← \PlayerInterface Buy self qty );")
	 (edited "25-JUL-83 10:21:12")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ENx"))]


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

-> cargo ← (CAR truck:cargo) rating←0;")
	 (edited "25-JUL-83 10:21:31")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@EL|"))]


[DEFINST Rule ("LYS.0.5349.124.36446.212")
         (source 
	  "(* Need to be able to park)
 IF ~(RoomToParkP roadStop)
  THEN rating ← rating - 500;")
	 (edited "25-JUL-83 10:21:31")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@EL|"))]


[DEFINST Rule ("LYS.0.5349.124.36446.213")
         (source 
"(* Exclude consumers that have full inventory.)
 IF roadStop:qty < 1
  THEN rating ← rating - 1000;")
	 (edited "25-JUL-83 10:21:31")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@EL|"))]


[DEFINST Rule ("LYS.0.5349.124.36446.214")
         (source "(* Favor high price ratios.)
  -> rating ← rating + 100 * roadStop:pr ;")
	 (edited "25-JUL-83 10:21:31")
	 (editor STEFIK)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "UVSC@EL|"))]


[DEFINST Rule ("LYS.0.5349.124.36446.215")
         (source 
"(* Favor close places.)
  -> rating ← rating - [truck::Gpm *(Distance roadStop truck:location)];")
	 (edited "25-JUL-83 10:21:31")
	 (editor STEFIK)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "UVSC@EL|"))]


[DEFINST Rule ("LYS.0.5349.124.36446.216")
         (source "(* rate gas stations within range)
 THEN rating ← 0;")
	 (edited "25-JUL-83 10:21:40")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ENC"))]


[DEFINST Rule ("LYS.0.5349.124.36446.217")
         (source "IF rs:qty=0 
 THEN rating ← -2000;")
	 (edited "25-JUL-83 10:21:40")
	 (editor STEFIK)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ENC"))]


[DEFINST Rule ("LYS.0.5349.124.36446.218")
         (source "IF ~(RoomToParkP rs)
 THEN rating ← rating - 200;")
	 (edited "25-JUL-83 10:21:40")
	 (editor STEFIK)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@ENC"))]


[DEFINST Rule ("LZS.0.5349.129.33698.218")
         (source "	-> cargo←(CAR truck:cargo);")
	 (edited "26-JUL-83 16:05:44")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "LZS.0.5349.129.33698.187"))]


[DEFINST Rule ("LZS.0.5349.129.33698.219")
         (source 
	 "	IF ~(ISA cargo truck:location::Commodity)
	THEN (STOP NIL 'NoSale 'WrongKindOfBuyer);")
	 (edited "26-JUL-83 16:05:44")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "LZS.0.5349.129.33698.187"))]


[DEFINST Rule ("LZS.0.5349.129.33698.220")
         (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:05:44")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "LZS.0.5349.129.33698.187"))]


[DEFINST Rule ("LZS.0.5349.129.33698.221")
         (source 
	    "	IF truck:location:pr < 1.1 goal='Sell 
	THEN (STOP NIL 'NoSale 'AvoidCheapSkates);")
	 (edited "26-JUL-83 16:05:44")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "LZS.0.5349.129.33698.187"))]


[DEFINST Rule ("LZS.0.5349.129.33698.222")
         (source "        IF truck:location:pr < 0
        THEN (STOP NIL 'NoSale 'NeverAtLoss);")
	 (edited "26-JUL-83 16:05:44")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "LZS.0.5349.129.33698.187"))]


[DEFINST Rule ("LZS.0.5349.129.33698.223")
         (source 
"	IF cargo:status sellQty←(MIN truck:location:qty cargo:qty) sellQty>=1 
	THEN (← \PlayerInterface Sell self cargo sellQty);")
	 (edited "26-JUL-83 16:05:44")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "LZS.0.5349.129.33698.187"))]


[DEFINST Rule ("LZS.0.5349.129.33698.163")
         (source 
"IF has←(CAR truck:cargo) ~has:status tdest←(PickHiObj self 'RateDumps (RoadStops $CityDump))
 THEN destination←tdest direction←(DirectionOf destination);")
	 (edited "26-JUL-83 12:48:04")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELx"))]


[DEFINST Rule ("LZS.0.5349.129.33698.164")
         (source 
"IF has tdest←(PickHiObj self 'RateConsumers (Buyers has))
 THEN destination←tdest  direction←(DirectionOf destination);")
	 (edited "26-JUL-83 12:48:04")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ELx"))]


[DEFINST Rule ("LZS.0.5349.129.33698.165")
         (source 
"(* Sets the goal)

IF (ISA truck:location $AlicesRestaurant) .TimeAtStop>=25
 THEN goal←'LeaveAlice;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.166")
         (source "IF goal << '(SitTight BuyGas) THEN ;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.167")
         (source "IF goal='GoToAlice (ISA truck:location $AlicesRestaurant) 
 THEN goal←'SitTight;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.168")
         (source "IF \Simulator:timeLeft <30
 THEN goal←'GoToAlice higherGoal←'GoToAlice;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.169")
         (source 
    "IF truck:fuel < .25 * truck::MaxFuel  truck:cashBox > 0
 THEN higherGoal←goal goal←'BuyGas;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 5)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.170")
         (source "IF \Simulator:timeLeft < 60 
 THEN goal←'GetClose higherGoal←'GoToAlice;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 6)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.171")
         (source "IF truck:cargo
 THEN goal←'Sell;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 7)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LZS.0.5349.129.33698.172")
         (source "-> goal←'Buy;")
	 (edited "26-JUL-83 14:07:39")
	 (editor MITTAL)
	 (ruleNumber 8)
	 (ruleSet #&(RuleSet "UVSC@ELo"))]


[DEFINST Rule ("LYS.0.5349.124.36446.230")
         (source "-> destination←NIL;")
	 (edited "25-JUL-83 10:22:13")
	 (editor STEFIK)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELp"))]


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

 
 ->  .SetGoal;")
	 (edited "26-JUL-83 16:34:06")
	 (editor MITTAL)
	 (ruleNumber 1)
	 (ruleSet #&(RuleSet "UVSC@ELg"))]


[DEFINST Rule ("LZS.0.5349.129.33698.225")
         (source "IF goal THEN (←! self goal);")
	 (edited "26-JUL-83 16:34:06")
	 (editor MITTAL)
	 (ruleNumber 2)
	 (ruleSet #&(RuleSet "UVSC@ELg"))]


[DEFINST Rule ("LZS.0.5349.129.33698.226")
         (source "IF destination THEN .FindStoppingPlace;")
	 (edited "26-JUL-83 16:34:06")
	 (editor MITTAL)
	 (ruleNumber 3)
	 (ruleSet #&(RuleSet "UVSC@ELg"))]


[DEFINST Rule ("LZS.0.5349.129.33698.227")
         (source "IF destination stoppingPlace 
 THEN .GoToStoppingPlace
      .AtCurrentStop;")
	 (edited "26-JUL-83 16:34:06")
	 (editor MITTAL)
	 (ruleNumber 4)
	 (ruleSet #&(RuleSet "UVSC@ELg"))]


(DECLARE: DONTCOPY
  (FILEMAP (NIL (4542 6306 (Planner.AtCurrentStop 4552 . 4660) (Planner.Buy 4662 . 4740) (Planner.BuyGas
 4742 . 4829) (Planner.CarryOutGoal 4831 . 4936) (Planner.FindStoppingPlace 4938 . 5063) (
Planner.GetClose 5065 . 5158) (Planner.GoToAlice 5160 . 5256) (Planner.GoToStoppingPlace 5258 . 5383) 
(Planner.LeaveAlice 5385 . 5484) (Planner.PurchaseGas 5486 . 5588) (Planner.RateDumps 5590 . 5704) (
Planner.RateGasStations 5706 . 5831) (Planner.Sell 5833 . 5914) (Planner.SellGoods 5916 . 6017) (
Planner.SetGoal 6019 . 6109) (Planner.SitTight 6111 . 6204) (Planner.TakeTurn 6206 . 6304)) (6307 
21785 (AtCurrentStopPlanner 6317 . 7372) (BuyGasPlanner 7374 . 8365) (BuyPlanner 8367 . 8806) (
CarryOutGoalPlanner 8808 . 9589) (FindStoppingPlacePlannerRules 9591 . 12581) (GetClosePlanner 12583
 . 13014) (GoToAlicePlanner 13016 . 13387) (GoToStoppingPlacePlannerRules 13389 . 13993) (
LeaveAlicePlanner 13995 . 14331) (PurchaseGasPlanner 14333 . 15204) (RateDumpsPlanner 15206 . 16072) (
RateGasStationsPlannerRules 16074 . 16438) (SellGoodsPlannerRules 16440 . 18530) (SellPlanner 18532 . 
19301) (SetGoalPlanner 19303 . 21030) (SitTightPlanner 21032 . 21202) (TakeTurnPlannerRules 21204 . 
21783)))))
STOP