(FILECREATED " 2-JUN-83 14:47:45" {INDIGO}<LOOPS>TRUCKIN>HIGHROLLER.;1 45165  

      previous date: "23-MAY-83 12:19:51" {INDIGO}<KBVLSI>TRUCKIN>PLAYERS>HIGHROLLER.;12)


(PRETTYCOMPRINT HIGHROLLERCOMS)

(RPAQQ HIGHROLLERCOMS ((INSTANCES BuyGoodsHighRollerRules FindStoppingPlaceHighRollerRules 
				  GoToStoppingPlaceHighRollerRules SellGoodsHighRollerRules 
				  TakeTurnHighRollerRules)
		       (CLASSES HighRoller)
		       (FNS BuyGoodsHighRollerRules FindStoppingPlaceHighRollerRules 
			    GoToStoppingPlaceHighRollerRules HighRoller.BuyGoods 
			    HighRoller.FindStoppingPlace HighRoller.GoToStoppingPlace 
			    HighRoller.SellGoods HighRoller.TakeTurn SellGoodsHighRollerRules 
			    TakeTurnHighRollerRules)))
(DEFINST RuleSet (BuyGoodsHighRollerRules "FQSC@$AI")
	 (perspectiveNode #&(RuleSetNode "FQSC@$AN") myViewName RuleSet)
	 (name #(BuyGoodsHighRollerRules NIL RememberName))
	 (compiledRules BuyGoodsHighRollerRules)
	 (workSpace HighRoller)
	 (arguments)
	 (tempVars (commodity volumeCapacity weightCapacity volumeLimit weightLimit cashLimit 
			      producerLimit numBuy))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 4)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL))



(DEFINST RuleSet (FindStoppingPlaceHighRollerRules "FQSC@$AJ")
	 (perspectiveNode #&(RuleSetNode "FQSC@$AO") myViewName RuleSet)
	 (name #(FindStoppingPlaceHighRollerRules NIL RememberName))
	 (compiledRules FindStoppingPlaceHighRollerRules)
	 (workSpace HighRoller)
	 (arguments)
	 (tempVars (wStation gasStation))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DO1)
	 (whileCondition NIL)
	 (compilerOptions (PR A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL))



(DEFINST RuleSet (GoToStoppingPlaceHighRollerRules "FQSC@$AK")
	 (perspectiveNode #&(RuleSetNode "FQSC@$AP") myViewName RuleSet)
	 (name #(GoToStoppingPlaceHighRollerRules NIL RememberName))
	 (compiledRules GoToStoppingPlaceHighRollerRules)
	 (workSpace HighRoller)
	 (arguments)
	 (tempVars (realLocation))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (PR A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL))



(DEFINST RuleSet (SellGoodsHighRollerRules "FQSC@$AL")
	 (perspectiveNode #&(RuleSetNode "FQSC@$AQ") myViewName RuleSet)
	 (name #(SellGoodsHighRollerRules NIL RememberName))
	 (compiledRules SellGoodsHighRollerRules)
	 (workSpace HighRoller)
	 (arguments)
	 (tempVars (cargo sellQty))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 4)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL))



(DEFINST RuleSet (TakeTurnHighRollerRules "FQSC@$AM")
	 (perspectiveNode #&(RuleSetNode "FQSC@$AR") myViewName RuleSet)
	 (name #(TakeTurnHighRollerRules NIL RememberName))
	 (compiledRules TakeTurnHighRollerRules)
	 (workSpace HighRoller)
	 (arguments)
	 (tempVars (alice))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 7)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions (A))
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL))



(DEFINST RuleSetNode ("FQSC@$AN")
	 (perspectives ? RuleSet #&(RuleSet "FQSC@$AI") Source #&(RuleSetSource "FQSC@$AS")))



(DEFINST RuleSetNode ("FQSC@$AO")
	 (perspectives ? RuleSet #&(RuleSet "FQSC@$AJ") Source #&(RuleSetSource "FQSC@$AT")))



(DEFINST RuleSetNode ("FQSC@$AP")
	 (perspectives ? RuleSet #&(RuleSet "FQSC@$AK") Source #&(RuleSetSource "FQSC@$AU")))



(DEFINST RuleSetNode ("FQSC@$AQ")
	 (perspectives ? RuleSet #&(RuleSet "FQSC@$AL") Source #&(RuleSetSource "FQSC@$AV")))



(DEFINST RuleSetNode ("FQSC@$AR")
	 (perspectives ? RuleSet #&(RuleSet "FQSC@$AM") Source #&(RuleSetSource "FQSC@$AW")))



(DEFINST RuleSetSource ("FQSC@$AS")
	 (indexedVars ((#&(Rule "MKSC@A←y"))
		       (#&(Rule "MKSC@A←z"))
		       (#&(Rule "MKSC@A←{"))
		       (#&(Rule "MKSC@A←\"))
		       (#&(Rule "FBS@@A?V"))))
	 (perspectiveNode #&(RuleSetNode "FQSC@$AN") myViewName Source)
	 (created " 1-FEB-83 14:25:11")
	 (creator LOOPSCOURSE)
	 (edited "11-MAR-83 17:13:00")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FQSC@$AT")
	 (indexedVars ((#&(Rule "MKSC@A←]"))
		       (#&(Rule "MKSC@A←↑"))
		       (#&(Rule "MKSC@A←←"))
		       (#&(Rule "MKSC@A←`"))
		       (#&(Rule "MKSC@A←a"))
		       (#&(Rule "MKSC@A←b"))
		       (#&(Rule "FAS@@&Lp"))))
	 (perspectiveNode #&(RuleSetNode "FQSC@$AO") myViewName Source)
	 (created " 1-FEB-83 14:25:23")
	 (creator LOOPSCOURSE)
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FQSC@$AU")
	 (indexedVars ((#&(Rule "MKSC@A←c"))
		       (#&(Rule "MKSC@A←|"))
		       (#&(Rule "MKSC@A`="))
		       (#&(Rule "MKSC@A`>"))
		       (#&(Rule "MKSC@A`?"))
		       (#&(Rule "MKSC@A`@"))
		       (#&(Rule "FPSC@$MC"))))
	 (perspectiveNode #&(RuleSetNode "FQSC@$AP") myViewName Source)
	 (created " 1-FEB-83 14:25:34")
	 (creator LOOPSCOURSE)
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FQSC@$AV")
	 (indexedVars ((#&(Rule "MKSC@A←d"))
		       (#&(Rule "MKSC@A`A"))
		       (#&(Rule "MKSC@A`B"))
		       (#&(Rule "MKSC@A←e"))
		       (#&(Rule "FBS@@A?`"))
		       (#&(Rule "FBS@@A?a"))
		       (#&(Rule "FBS@@A?b"))
		       (#&(Rule "FBS@@A?c"))))
	 (perspectiveNode #&(RuleSetNode "FQSC@$AQ") myViewName Source)
	 (created " 1-FEB-83 14:25:40")
	 (creator LOOPSCOURSE)
	 (edited "11-MAR-83 17:13:51")
	 (editor STEFIK))



(DEFINST RuleSetSource ("FQSC@$AW")
	 (indexedVars ((#&(Rule "YWSC@8?r"))
		       (#&(Rule "YWSC@8?s"))
		       (#&(Rule "YWSC@8?t"))
		       (#&(Rule "YWSC@8?u"))
		       (#&(Rule "YWSC@8?v"))
		       (#&(Rule "YWSC@8?w"))
		       (#&(Rule "YWSC@8@\"))))
	 (perspectiveNode #&(RuleSetNode "FQSC@$AR") myViewName Source)
	 (created " 1-FEB-83 14:25:51")
	 (creator LOOPSCOURSE)
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL))



(DEFINST Rule ("MKSC@A←y")
	 (source 
   "	(* Rules for deciding what and how much to buy.)

-> commodity ←	truck:location::Commodity;")
	 (edited "11-MAR-83 17:13:00")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AI")))



(DEFINST Rule ("MKSC@A←z")
	 (source "IF ~(SUBCLASS commodity $LuxuryGoods)
THEN (STOP NIL 'NoBuy 'NotLuxury);")
	 (edited "11-MAR-83 17:13:00")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AI")))



(DEFINST Rule ("MKSC@A←{")
	 (source 

"(* Sale can be limited by volume, weight, cash, or availability.)
-> volumeCapacity ← truck::MaxVolume-truck:volume
   weightCapacity ← truck::MaxWeight-truck:weight   
   volumeLimit ← volumeCapacity / commodity::VolPerQty
   weightLimit ← weightCapacity / commodity::WtPerQty
   cashLimit ← truck:cashBox / (PricePerUnit truck:location)
   producerLimit ← truck:location:qty
   numBuy ← (MIN volumeLimit weightLimit cashLimit producerLimit);")
	 (edited "11-MAR-83 17:13:00")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AI")))



(DEFINST Rule ("MKSC@A←\")
	 (source 

"(* Buy as much as possible, then decide to sell it.)
IF numBuy>=1
THEN (← gameMaster Buy numBuy)
     goal←'Sell
     destination←(NearestRoadStop (Buyers commodity));")
	 (edited "11-MAR-83 17:13:00")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AI")))



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



(DEFINST Rule ("MKSC@A←]")
	 (source 

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

IF truck:fuel=0
THEN stoppingPlace←(AnyRoadStop $UnionHall);")
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AJ")))



(DEFINST Rule ("MKSC@A←↑")
	 (source 

"(* Dont run out if gas.)
IF truck:fuel < .25 * truck::MaxFuel
   truck:cashBox>0
   gasStation←(NearestRoadStop (RoadStops $GasStation .Range1 NIL 'Room))
THEN stoppingPlace←gasStation;")
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AJ")))



(DEFINST Rule ("MKSC@A←←")
	 (source 

"(* Obey the law - stop at WeighStations.)
IF wStation←(NearestRoadStop (RoadStops $WeighStation .Range1 direction 'Room))
   (Distance wStation)<(Distance destination)
THEN stoppingPlace←wStation;")
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AJ")))



(DEFINST Rule ("MKSC@A←`")
	 (source 
   "IF (Distance destination)<=.Range1 (RoomToParkP destination)
THEN stoppingPlace←destination;")
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AJ")))



(DEFINST Rule ("MKSC@A←a")
	 (source 

"IF gasStation←(FurthestRoadStop (RoadStops $GasStation .Range1 direction 'Room))
THEN stoppingPlace←gasStation;")
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AJ")))



(DEFINST Rule ("MKSC@A←b")
	 (source "THEN stoppingPlace←(NthRoadStop  maxMove direction NIL 'Room);")
	 (edited "11-MAR-83 17:13:15")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AJ")))



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



(DEFINST Rule ("MKSC@A←c")
	 (source "	-> direction←(DirectionOf destination);")
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AK")))



(DEFINST Rule ("MKSC@A←|")
	 (source 
"	THEN .FindStoppingPlace
	(← gameMaster Move stoppingPlace)
        realLocation←truck:location;")
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AK")))



(DEFINST Rule ("MKSC@A`=")
	 (source 
       "	IF realLocation~=stoppingPlace 
	THEN (WriteGameStatus NIL %"I've been intercepted!%");")
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AK")))



(DEFINST Rule ("MKSC@A`>")
	 (source "	IF (ISA realLocation $GasStation)
	THEN .BuyGas;")
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AK")))



(DEFINST Rule ("MKSC@A`?")
	 (source 

"	IF (ISA realLocation $Producer)
	   (SUBCLASS  realLocation::Commodity $LuxuryGoods)
	   goal='Buy 
	THEN .BuyGoods;")
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AK")))



(DEFINST Rule ("MKSC@A`@")
	 (source "	IF (ISA realLocation $Consumer) truck:cargo
	   goal='Sell 
	THEN .SellGoods;")
	 (edited "11-MAR-83 17:13:31")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AK")))



(DEFINST Rule ("FPSC@$MC")
	 (source "	IF (ISA realLocation $Consumer)
	   goal='Sell 
	THEN .SellGoods;")
	 (edited "16-FEB-83 14:29:04")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



(DEFINST Rule ("MKSC@A←d")
	 (source 

"(* Abort sale if cargo has disappeared.)
	IF ~truck:cargo
	THEN destination←NIL
	(WriteGameStatus %"Yipes! My cargo is gone!%")
	(STOP NIL 'NoSale 'NoCargo);")
	 (edited "11-MAR-83 17:13:51")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AL")))



(DEFINST Rule ("MKSC@A`A")
	 (source "        -> cargo←(CAR truck:cargo);")
	 (edited "11-MAR-83 17:13:51")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AL")))



(DEFINST Rule ("MKSC@A`B")
	 (source 

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

	IF sellQty←(MIN truck:location:qty cargo:qty) sellQty>0 
	THEN (← gameMaster Sell cargo sellQty);")
	 (edited "11-MAR-83 17:13:51")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AL")))



(DEFINST Rule ("MKSC@A←e")
	 (source 

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

	IF cargo←(CAR truck:cargo) cargo:qty>0
	THEN destination←(NearestRoadStop (Buyers cargo))
	     direction←(DirectionOf destination)
	     (STOP NIL 'NoSale 'CantSell);")
	 (edited "11-MAR-83 17:13:51")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AL")))



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



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



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



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



(DEFINST Rule ("YWSC@8?r")
	 (source 
" 

   (* Top Level RuleSet.  Sets goal and destination.)

	IF ~goal ~destination
	THEN goal←'Buy;")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



(DEFINST Rule ("YWSC@8?s")
	 (source 

"   (* Fix up destination in case it sold out.)
	IF goal='Buy
	THEN destination←(NearestRoadStop (Sellers $LuxuryGoods ));")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



(DEFINST Rule ("YWSC@8?t")
	 (source 

"   (* Initialization for beginning of game or restarting from Union Hall.)
	IF (OR ~destination (ISA truck:location  $UnionHall))
	THEN destination←(NearestRoadStop (Sellers $LuxuryGoods))
	     goal←'Buy;")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



(DEFINST Rule ("YWSC@8?u")
	 (source 

"   (* Just get close if Luxury goods are running low.)
	IF ~destination ~(Sellers $LuxuryGoods) goal='Buy
	THEN goal←'GetClose
	      alice← (NearestRoadStop (RoadStops $AlicesRestaurant))
	      destination← alice:prev;")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



(DEFINST Rule ("YWSC@8?v")
	 (source 

"   (* Get near to Alices when time gets close)		
	IF gameMaster:timeRemaining < 50 goal~='SitTight goal~='GoToAlices  
	THEN  alice← (NearestRoadStop (RoadStops $AlicesRestaurant))
	      destination← alice:prev
	      goal←'GetClose;")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



(DEFINST Rule ("YWSC@8?w")
	 (source 

"   (* Go right to Alice's now that it is time)
        IF gameMaster:timeRemaining < 20 
           ~(ISA truck:location $AlicesRestaurant)   
	THEN destination← (NearestRoadStop (RoadStops $AlicesRestaurant))
             goal←'GoToAlices ;")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



(DEFINST Rule ("YWSC@8@\")
	 (source "	-> .GoToStoppingPlace;")
	 (edited "23-MAY-83 10:53:27")
	 (editor MITTAL)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FQSC@$AM")))



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



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



(DEFINST RuleSet (GoToStoppingPlaceToyotaRules "FAS@@&Lq")
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mi") myViewName RuleSet)
	 (name #(GoToStoppingPlaceToyotaRules NIL RememberName))
	 (compiledRules GoToStoppingPlaceToyotaRules)
	 (workSpace Toyota)
	 (arguments)
	 (tempVars (stoppingPlace realLocation))
	 (taskVars NIL)
	 (debugVars NIL)
	 (numRules 6)
	 (controlStructure DOALL)
	 (whileCondition NIL)
	 (compilerOptions NIL)
	 (auditClass NIL)
	 (metaAssignments NIL)
	 (ruleClass NIL))



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



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



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



(DEFINST RuleSetNode ("FAS@@&Mi")
	 (perspectives ? RuleSet #&(RuleSet "FAS@@&Lq") Source #&(RuleSetSource "FAS@@&Mo")))



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



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



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



(DEFINST RuleSetSource ("FAS@@&Mo")
	 (indexedVars ((#&(Rule "FPSC@$M="))
		       (#&(Rule "FPSC@$M>"))
		       (#&(Rule "FPSC@$M?"))
		       (#&(Rule "FPSC@$M@"))
		       (#&(Rule "FPSC@$MA"))
		       (#&(Rule "FPSC@$MB"))
		       (#&(Rule "FPSC@$MC"))))
	 (perspectiveNode #&(RuleSetNode "FAS@@&Mi") myViewName Source)
	 (created " 1-FEB-83 14:25:34")
	 (creator LOOPSCOURSE)
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK))



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



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

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



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



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

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



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

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



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

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

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



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

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



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

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



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



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



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



(DEFINST Rule ("FPSC@$M=")
	 (source "	-> direction←(DirectionOf destination);")
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



(DEFINST Rule ("FPSC@$M>")
	 (source 

"	THEN stoppingPlace←.FindStoppingPlace
	(← gameMaster Move stoppingPlace)
        realLocation←truck:location;")
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



(DEFINST Rule ("FPSC@$M?")
	 (source 
       "	IF realLocation~=stoppingPlace 
	THEN (WriteGameStatus NIL %"I've been intercepted!%");")
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



(DEFINST Rule ("FPSC@$M@")
	 (source "	IF (ISA realLocation $GasStation)
	THEN .BuyGas;")
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



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

"	IF (ISA realLocation $Producer)
	   (ISA  realLocation::Commodity 'LuxuryGoods)
	   goal='Buy 
	THEN .BuyGoods;")
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



(DEFINST Rule ("FPSC@$MB")
	 (source "	IF (ISA realLocation $Consumer)
	   goal='Sell 
	THEN .SellGoods;")
	 (edited "16-FEB-83 14:32:45")
	 (editor STEFIK)
	 (ruleNumber)
	 (ruleSet #&(RuleSet "FAS@@&Lq")))



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



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

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



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

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

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



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

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

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



(DEFCLASSES HighRoller)
[DEFCLASS HighRoller
   (MetaClass PlayerMeta doc 

          (* * HighRoller is a player who specializes in LuxuryGoods. It has a simple endgame strategy which usually works.
	  This is a slightly modified version of the winner of the knowledge competition in the first Loops course in 
	  January 1983 (Toyota by Dick Lyon))


	      Edited:                                        (* mjs: "18-FEB-83 19:54")
	      )
   (Supers Traveler)
   (ClassVariables)
   (InstanceVariables (destination NIL doc                   (* Current destination.))
		      (direction NIL doc                     (* Forward or Backward direction of travel on the 
							     highway.))
		      (sitCount 0 doc                        (* Number of turns sitting at Alices Restaurant during 
							     an EndGame.))
		      (goal NIL doc                          (* Buy, Sell, SitTight, or GoToAlices.)))
   (Methods (BuyGoods HighRoller.BuyGoods doc 

          (* * RuleSet BuyGoodsHighRollerRules is installed as the selector BuyGoods of the class HighRoller)


		      RuleSet BuyGoodsHighRollerRules)
	    (FindStoppingPlace HighRoller.FindStoppingPlace doc 

          (* * RuleSet FindStoppingPlaceHighRollerRules is installed as the selector FindStoppingPlace of the class 
	  HighRoller)


			       RuleSet FindStoppingPlaceHighRollerRules)
	    (GoToStoppingPlace HighRoller.GoToStoppingPlace doc 

          (* * RuleSet GoToStoppingPlaceHighRollerRules is installed as the selector GoToStoppingPlace of the class 
	  HighRoller)


			       RuleSet GoToStoppingPlaceHighRollerRules)
	    (SellGoods HighRoller.SellGoods doc 

          (* * RuleSet SellGoodsHighRollerRules is installed as the selector SellGoods of the class HighRoller)


		       RuleSet SellGoodsHighRollerRules)
	    (TakeTurn HighRoller.TakeTurn doc 

          (* * RuleSet TakeTurnHighRollerRules is installed as the selector TakeTurn of the class HighRoller)


		      RuleSet TakeTurnHighRollerRules))]

(DEFINEQ

(BuyGoodsHighRollerRules
  [LAMBDA (self ↑rs ↑caller ↑task)
    (PROG (↑auditRecord ↑value commodity volumeCapacity weightCapacity volumeLimit weightLimit 
			cashLimit producerLimit numBuy)
          [SETQ ↑value (SETQ commodity (GetClassValue (GetValue (GetValue self (QUOTE truck))
								(QUOTE location))
						      (QUOTE Commodity]
          [COND
	    ((NOT (SUBCLASS commodity (%$ LuxuryGoods)))
	      (SETQ ↑value (PROGN                            (* ↑value set by RuleSetStop)
				  (RuleSetStop NIL (QUOTE NoBuy)
					       (QUOTE NotLuxury))
				  (GO QUIT]
          [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 volumeLimit (QUOTIENT volumeCapacity (GetClassValue commodity
											(QUOTE 
											VolPerQty]
			      [SETQ weightLimit (QUOTIENT weightCapacity (GetClassValue commodity
											(QUOTE 
											 WtPerQty]
			      [SETQ cashLimit (QUOTIENT (GetValue (GetValue self (QUOTE truck))
								  (QUOTE cashBox))
							(PricePerUnit (GetValue (GetValue
										  self
										  (QUOTE truck))
										(QUOTE location]
			      (SETQ producerLimit (GetValue (GetValue (GetValue self (QUOTE truck))
								      (QUOTE location))
							    (QUOTE qty)))
			      (SETQ numBuy (MIN volumeLimit weightLimit cashLimit producerLimit]
          [COND
	    ((GEQ numBuy 1)
	      (SETQ ↑value (PROGN (PROGN                     (* Make an audit record for this rule and set its audit 
							     values.)
					 (SETQ ↑auditRecord (← (%$ StandardAuditRecord)
							       NewTemp))
					 (PutValue ↑auditRecord (QUOTE rule)
						   (GetObjFromUID "MKSC@A←\")))
				  (← gameMaster Buy numBuy)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Sell)
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Buyers commodity))
					       ↑auditRecord]
      QUIT(RETURN ↑value])

(FindStoppingPlaceHighRollerRules
  [LAMBDA (self ↑rs ↑caller ↑task)
    (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 "MKSC@A←]")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (AnyRoadStop (%$ UnionHall))
					       ↑auditRecord]
	    [[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 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 "MKSC@A←↑")))
				  (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 "MKSC@A←←")))
				  (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 "MKSC@A←`")))
				  (PutAuditRec self (QUOTE stoppingPlace)
					       (GetValue self (QUOTE destination))
					       ↑auditRecord]
	    [[SETQ gasStation (FurthestRoadStop (RoadStops (%$ GasStation)
							   (← self Range1)
							   (GetValue self (QUOTE direction))
							   (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 "MKSC@A←a")))
				  (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 "MKSC@A←b")))
				   (PutAuditRec self (QUOTE stoppingPlace)
						(NthRoadStop maxMove (GetValue self (QUOTE direction))
							     NIL
							     (QUOTE Room))
						↑auditRecord]
      QUIT(RETURN ↑value])

(GoToStoppingPlaceHighRollerRules
  [LAMBDA (self ↑rs ↑caller ↑task)
    (PROG (↑auditRecord ↑value realLocation)
          (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 "MKSC@A←c")))
			      (PutAuditRec self (QUOTE direction)
					   (DirectionOf (GetValue self (QUOTE destination)))
					   ↑auditRecord)))
          [SETQ ↑value (PROGN (← self FindStoppingPlace)
			      (← gameMaster Move (GetValue self (QUOTE stoppingPlace)))
			      (SETQ realLocation (GetValue (GetValue self (QUOTE truck))
							   (QUOTE location]
          [COND
	    ((NEQ realLocation (GetValue self (QUOTE stoppingPlace)))
	      (SETQ ↑value (WriteGameStatus NIL "I've been intercepted!"]
          [COND
	    ((ISA realLocation (%$ GasStation))
	      (SETQ ↑value (← self BuyGas]
          [COND
	    ((AND (ISA realLocation (%$ Producer))
		  (SUBCLASS (GetClassValue realLocation (QUOTE Commodity))
			    (%$ LuxuryGoods))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Buy)))
	      (SETQ ↑value (← self BuyGoods]
          [COND
	    ((AND (ISA realLocation (%$ Consumer))
		  (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Sell)))
	      (SETQ ↑value (← self SellGoods]
      QUIT(RETURN ↑value])

(HighRoller.BuyGoods
  [LAMBDA (self)

          (* * RuleSet BuyGoodsHighRollerRules is installed as the selector BuyGoods of the class HighRoller)


    (← (GetObjectRec (QUOTE BuyGoodsHighRollerRules))
       Run self])

(HighRoller.FindStoppingPlace
  [LAMBDA (self)

          (* * RuleSet FindStoppingPlaceHighRollerRules is installed as the selector FindStoppingPlace of the class 
	  HighRoller)


    (← (GetObjectRec (QUOTE FindStoppingPlaceHighRollerRules))
       Run self])

(HighRoller.GoToStoppingPlace
  [LAMBDA (self)

          (* * RuleSet GoToStoppingPlaceHighRollerRules is installed as the selector GoToStoppingPlace of the class 
	  HighRoller)


    (← (GetObjectRec (QUOTE GoToStoppingPlaceHighRollerRules))
       Run self])

(HighRoller.SellGoods
  [LAMBDA (self)

          (* * RuleSet SellGoodsHighRollerRules is installed as the selector SellGoods of the class HighRoller)


    (← (GetObjectRec (QUOTE SellGoodsHighRollerRules))
       Run self])

(HighRoller.TakeTurn
  [LAMBDA (self)

          (* * RuleSet TakeTurnHighRollerRules is installed as the selector TakeTurn of the class HighRoller)


    (← (GetObjectRec (QUOTE TakeTurnHighRollerRules))
       Run self])

(SellGoodsHighRollerRules
  [LAMBDA (self ↑rs ↑caller ↑task)
    (PROG (↑auditRecord ↑value cargo sellQty)
          [COND
	    ((NOT (GetValue (GetValue self (QUOTE truck))
			    (QUOTE cargo)))
	      (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 "MKSC@A←d")))
				  (PutAuditRec self (QUOTE destination)
					       NIL ↑auditRecord)
				  (WriteGameStatus "Yipes! My cargo is gone!")
				  (PROGN                     (* ↑value set by RuleSetStop)
					 (RuleSetStop NIL (QUOTE NoSale)
						      (QUOTE NoCargo))
					 (GO QUIT]
          [SETQ ↑value (SETQ cargo (CAR (GetValue (GetValue self (QUOTE truck))
						  (QUOTE cargo]
          [COND
	    ((AND [SETQ sellQty (MIN (GetValue (GetValue (GetValue self (QUOTE truck))
							 (QUOTE location))
					       (QUOTE qty))
				     (GetValue cargo (QUOTE qty]
		  (GREATERP sellQty 0))
	      (SETQ ↑value (← gameMaster Sell cargo sellQty]
          [COND
	    ((AND [SETQ cargo (CAR (GetValue (GetValue self (QUOTE truck))
					     (QUOTE cargo]
		  (GREATERP (GetValue cargo (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 "MKSC@A←e")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Buyers cargo))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE direction)
					       (DirectionOf (GetValue self (QUOTE destination)))
					       ↑auditRecord)
				  (PROGN                     (* ↑value set by RuleSetStop)
					 (RuleSetStop NIL (QUOTE NoSale)
						      (QUOTE CantSell))
					 (GO QUIT]
      QUIT(RETURN ↑value])

(TakeTurnHighRollerRules
  [LAMBDA (self ↑rs ↑caller ↑task)
    (PROG (↑auditRecord ↑value alice)
          [COND
	    ([AND (NOT (GetValue self (QUOTE goal)))
		  (NOT (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 "YWSC@8?r")))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Buy)
					       ↑auditRecord]
          [COND
	    ((EQ (GetValue self (QUOTE goal))
		 (QUOTE Buy))
	      (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 "YWSC@8?s")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Sellers (%$ LuxuryGoods)))
					       ↑auditRecord]
          [COND
	    ((OR (NOT (GetValue self (QUOTE destination)))
		 (ISA (GetValue (GetValue self (QUOTE truck))
				(QUOTE location))
		      (%$ UnionHall)))
	      (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 "YWSC@8?t")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (Sellers (%$ LuxuryGoods)))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE Buy)
					       ↑auditRecord]
          [COND
	    ((AND (NOT (GetValue self (QUOTE destination)))
		  (NOT (Sellers (%$ LuxuryGoods)))
		  (EQ (GetValue self (QUOTE goal))
		      (QUOTE Buy)))
	      (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 "YWSC@8?u")))
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE GetClose)
					       ↑auditRecord)
				  [SETQ alice (NearestRoadStop (RoadStops (%$ AlicesRestaurant]
				  (PutAuditRec self (QUOTE destination)
					       (GetValue alice (QUOTE prev))
					       ↑auditRecord]
          [COND
	    ((AND (LESSP (GetValue gameMaster (QUOTE timeRemaining))
			 50)
		  (NEQ (GetValue self (QUOTE goal))
		       (QUOTE SitTight))
		  (NEQ (GetValue self (QUOTE goal))
		       (QUOTE 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 "YWSC@8?v")))
				  [SETQ alice (NearestRoadStop (RoadStops (%$ AlicesRestaurant]
				  (PutAuditRec self (QUOTE destination)
					       (GetValue alice (QUOTE prev))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE GetClose)
					       ↑auditRecord]
          [COND
	    ([AND (LESSP (GetValue gameMaster (QUOTE timeRemaining))
			 20)
		  (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 "YWSC@8?w")))
				  (PutAuditRec self (QUOTE destination)
					       (NearestRoadStop (RoadStops (%$ AlicesRestaurant)))
					       ↑auditRecord)
				  (PutAuditRec self (QUOTE goal)
					       (QUOTE GoToAlices)
					       ↑auditRecord]
          (SETQ ↑value (← self GoToStoppingPlace))
      QUIT(RETURN ↑value])
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (30356 45143 (BuyGoodsHighRollerRules 30366 . 32653) (FindStoppingPlaceHighRollerRules 
32655 . 36275) (GoToStoppingPlaceHighRollerRules 36277 . 37783) (HighRoller.BuyGoods 37785 . 38015) (
HighRoller.FindStoppingPlace 38017 . 38291) (HighRoller.GoToStoppingPlace 38293 . 38567) (
HighRoller.SellGoods 38569 . 38803) (HighRoller.TakeTurn 38805 . 39035) (SellGoodsHighRollerRules 
39037 . 41057) (TakeTurnHighRollerRules 41059 . 45141)))))
STOP