(FILECREATED "16-NOV-83 21:46:52" ("compiled on " {INDIGO}TRUCKIN>MULTI>TRAVELER.;6) "12-OCT-83 13:52:28" recompiled exprs: BuyGasTravelerRules FindStoppingPlaceTravelerRules GoToStoppingPlaceTravelerRules in LOOPSDEMO.SYSOUT dated "16-NOV-83 11:44:49") (FILECREATED "16-NOV-83 21:44:11" {INDIGO}TRUCKIN>MULTI>TRAVELER.;6 16102 changes to: (FNS BuyGasTravelerRules FindStoppingPlaceTravelerRules GoToStoppingPlaceTravelerRules) (VARS TRAVELERCOMS) previous date: "13-NOV-83 18:36:14" {INDIGO}TRUCKIN>MULTI>TRAVELER.;5) BuyGasTravelerRules D1 (P 4 qty P 3 fuelAvailable P 2 fuelAffordable P 1 spaceInTank P 0 ^value I 0 self F 7 PlayerInterface) tp@g g @g g Õ¹@g g g »@g g @g g ׺IJK \Xjó²W^g ½N@LlMH(146Q FetchMethodOrHelp 127Q MIN 117Q PricePerUnit 114Q GetValue 106Q GetValue 77Q GetValue 71Q GetValue 61Q GetValue 53Q GetValue 45Q GetValue 34Q GetValue 26Q GetValue 17Q GetClassValue 11Q GetValue) (143Q Buy 111Q location 103Q truck 74Q cashBox 66Q truck 56Q qty 50Q location 42Q truck 31Q fuel 23Q truck 14Q MaxFuel 6 truck) NIL FindStoppingPlaceTravelerRules D1 (P 2 gasStation P 1 wStation P 0 ^value I 0 self) Àð@@g g jð²1ghk ¿o \g »LkK¿@gg g @^g ½NkM@g g Yµ‚±Ðg @_g _¿OkO@g g Zµe@g @_g _¿OkOó’±Â@g ¢±´ghl ¿o _ g _¿O kO¿@g@g  @g ýó²Žghl ¿o _g _¿OkO¿@gJ  @g ýó¢±ÿ#ghl ¿o _g _¿OkO¿@gI ghl ¿o _$g _"¿O$kO"¿@g@g @g hg (675Q PutValue 672Q NthRoadStop 663Q GetValue 654Q GetValue 626Q FetchMethodOrHelp 616Q GetObjFromUID 606Q TraceRHS 574Q PutValue 551Q FetchMethodOrHelp 541Q GetObjFromUID 531Q TraceRHS 512Q Distance 507Q GetValue 500Q Distance 474Q PutValue 451Q FetchMethodOrHelp 441Q GetObjFromUID 431Q TraceRHS 414Q Distance 411Q GetValue 402Q Distance 376Q PutValue 373Q GetValue 345Q FetchMethodOrHelp 335Q GetObjFromUID 325Q TraceRHS 310Q RoomToParkP 305Q GetValue 257Q FetchMethodOrHelp 246Q Distance 243Q GetValue 231Q FurthestRoadStop 226Q RoadStops 220Q GetValue 177Q FetchMethodOrHelp 166Q GetObjectRec 151Q NearestRoadStop 146Q RoadStops 140Q GetValue 123Q FetchMethodOrHelp 113Q GetObjectRec 104Q PutValue 101Q AnyRoadStop 76Q GetObjectRec 55Q FetchMethodOrHelp 46Q GetObjFromUID 36Q TraceRHS 22Q GetValue 14Q GetValue) (667Q Room 660Q direction 651Q maxMove 645Q stoppingPlace 623Q Print 600Q FindStoppingPlaceTravelerRules 570Q stoppingPlace 546Q Print 523Q FindStoppingPlaceTravelerRules 504Q destination 470Q stoppingPlace 446Q Print 423Q FindStoppingPlaceTravelerRules 406Q destination 370Q destination 364Q stoppingPlace 342Q Print 317Q FindStoppingPlaceTravelerRules 302Q destination 254Q Range1 240Q destination 223Q Room 215Q direction 174Q Range1 163Q GasStation 143Q Room 135Q direction 120Q Range1 110Q WeighStation 73Q UnionHall 70Q stoppingPlace 52Q Print 31Q FindStoppingPlaceTravelerRules 17Q fuel 11Q truck) (613Q "NPS0.lVC1.<7;.13" 536Q "NPS0.lVC1.<7;.10" 436Q "NPS0.lVC1.<7;.11" 332Q "NPS0.lVC1.<7;.12" 43Q "NPS0.lVC1.<7;.9") GoToStoppingPlaceTravelerRules D1 (P 0 ^value I 0 self F 7 PlayerInterface) Tp@Zg ¹JkI¿W\g »L@dg lK¸@g g g ž@^g ½NkMH(111Q FetchMethodOrHelp 100Q ISA 75Q GetObjectRec 67Q GetValue 61Q GetValue 44Q GetValue 32Q FetchMethodOrHelp 12Q FetchMethodOrHelp) (106Q BuyGas 72Q GasStation 64Q location 56Q truck 41Q stoppingPlace 27Q Move 7 FindStoppingPlace) NIL TakeTurnTravelerRules D1 (P 0 ^value I 0 self) ¶p@g ³@gg ¿@gg ¸@g g Zg ¹Jg lI²@gg ¿@gg ¸@g g \g »Lg lK²@gg ¿@gg ¸@^g ½NkM(255Q FetchMethodOrHelp 244Q PutValue 231Q PutValue 226Q AnyRoadStop 223Q GetObjectRec 202Q GetObjectRec 172Q FetchMethodOrHelp 163Q GetValue 155Q GetValue 145Q PutValue 132Q PutValue 127Q AnyRoadStop 124Q GetObjectRec 103Q GetObjectRec 73Q FetchMethodOrHelp 64Q GetValue 56Q GetValue 46Q PutValue 33Q PutValue 30Q AnyRoadStop 25Q GetObjectRec 11Q GetValue) (252Q GoToStoppingPlace 241Q Backward 236Q direction 220Q UnionHall 215Q destination 177Q AlicesRestaurant 167Q InstOf 160Q location 152Q truck 142Q Forward 137Q direction 121Q AlicesRestaurant 116Q destination 100Q UnionHall 70Q InstOf 61Q location 53Q truck 43Q Forward 40Q direction 22Q AlicesRestaurant 17Q destination 6 destination) NIL (PRETTYCOMPRINT TRAVELERCOMS) (RPAQQ TRAVELERCOMS ((* Copyright (c) 1983 by Xerox Corporation.) (* * File for a Traveler. -- A very simple automatic player for TRUCKIN.) (* TRUCKIN is a mini-expert system for teaching knowledge representation techniques in the Loops programming system. Truckin provides a simple simulation environment for novice Loops users in which small bodies of knowledge can be created and tested interactively. Knowledge in Truckin is in the form of rules for controlling a game piece to "maximize profit.") (CLASSES * TRAVELERCLASSES) (METHODS Traveler.TakeTurn Traveler.BuyGas Traveler.FindStoppingPlace Traveler.GoToStoppingPlace) (FNS BuyGasTravelerRules FindStoppingPlaceTravelerRules GoToStoppingPlaceTravelerRules TakeTurnTravelerRules) (INSTANCES BuyGasTravelerRules FindStoppingPlaceTravelerRules GoToStoppingPlaceTravelerRules TakeTurnTravelerRules))) (RPAQQ TRAVELERCLASSES (Traveler)) (DEFCLASSES Traveler) (DEFCLASS Traveler (MetaClass PlayerMeta doc (* * A Traveler is a player who tours back and forth between UnionHall and AlicesRestaurant, buying gasoline and getting weighed as needed. Example of a very simple automated playerthat does not compete very knowledgeably to win.) Edited: (* mjs: "18-FEB-83 10:53")) (Supers Player) (ClassVariables) (InstanceVariables (destination NIL doc (* Current destination. Either AlicesRestaurant or the UnionHall.)) (direction NIL doc (* Forward or Backward direction of travel on the highway.)) (stoppingPlace NIL doc (* Place to stop enroute to destination.)))) (METH Traveler TakeTurn NIL NIL (method TakeTurnTravelerRules RuleSet TakeTurnTravelerRules)) (METH Traveler BuyGas NIL (* RuleSet BuyGasTravelerRules is installed as the selector BuyGas of the class Traveler) (method BuyGasTravelerRules RuleSet BuyGasTravelerRules)) (METH Traveler FindStoppingPlace NIL (* RuleSet FindStoppingPlaceTravelerRules is installed as the selector FindStoppingPlace of the class Traveler) (method FindStoppingPlaceTravelerRules RuleSet FindStoppingPlaceTravelerRules)) (METH Traveler GoToStoppingPlace NIL (* RuleSet GoToStoppingPlaceTravelerRules is installed as the selector GoToStoppingPlace of the class Traveler) (method GoToStoppingPlaceTravelerRules RuleSet GoToStoppingPlaceTravelerRules)) (DEFINST RuleSet (BuyGasTravelerRules "JZS@@A>N>") (perspectiveNode #&(RuleSetNode "JZS@@A>N@")) (name #(BuyGasTravelerRules NIL RememberName)) (compiledRules BuyGasTravelerRules) (workSpace Traveler) ( args NIL) (tempVars (spaceInTank fuelAffordable fuelAvailable qty)) (taskVars NIL) (debugVars NIL) ( numRules 2) (controlStructure DOALL) (whileCondition NIL) (compilerOptions NIL) (auditClass NIL) ( metaAssignments NIL) (ruleClass NIL) (taskClass) (arguments)) (DEFINST RuleSet (FindStoppingPlaceTravelerRules "JZS@@A>N?") (perspectiveNode #&(RuleSetNode "JZS@@A>NA")) (name #(FindStoppingPlaceTravelerRules NIL RememberName)) (compiledRules FindStoppingPlaceTravelerRules) (workSpace Traveler) (args NIL) (tempVars (wStation gasStation)) ( taskVars NIL) (debugVars NIL) (numRules 5) (controlStructure DO1) (whileCondition NIL) ( compilerOptions (T)) (auditClass NIL) (metaAssignments NIL) (ruleClass NIL) (taskClass) (arguments)) (DEFINST RuleSet (GoToStoppingPlaceTravelerRules "JZS@@A>M|") (perspectiveNode #&(RuleSetNode "JZS@@A>NB")) (name #(GoToStoppingPlaceTravelerRules NIL RememberName)) (compiledRules GoToStoppingPlaceTravelerRules) (workSpace Traveler) (args NIL) (tempVars NIL) (taskVars NIL) ( debugVars NIL) (numRules 2) (controlStructure DOALL) (whileCondition NIL) (compilerOptions NIL) ( auditClass NIL) (metaAssignments NIL) (ruleClass NIL) (taskClass) (arguments)) (DEFINST RuleSet (TakeTurnTravelerRules "JZS@@A>M{") (perspectiveNode #&(RuleSetNode "JZS@@A>NC")) ( name #(TakeTurnTravelerRules NIL RememberName)) (compiledRules TakeTurnTravelerRules) (workSpace Traveler) (args NIL) (tempVars NIL) (taskVars NIL) (debugVars NIL) (numRules 4) (controlStructure DOALL) (whileCondition NIL) (compilerOptions NIL) (auditClass NIL) (metaAssignments NIL) (ruleClass NIL) (taskClass) (arguments)) (DEFINST RuleSetNode ("JZS@@A>N@") (perspectives ? RuleSet #&(RuleSet "JZS@@A>N>") Source #&( RuleSetSource "JZS@@A>ND"))) (DEFINST RuleSetNode ("JZS@@A>NA") (perspectives ? RuleSet #&(RuleSet "JZS@@A>N?") Source #&( RuleSetSource "JZS@@A>NE"))) (DEFINST RuleSetNode ("JZS@@A>NB") (perspectives ? RuleSet #&(RuleSet "JZS@@A>M|") Source #&( RuleSetSource "JZS@@A>NF"))) (DEFINST RuleSetNode ("JZS@@A>NC") (perspectives ? RuleSet #&(RuleSet "JZS@@A>M{") Source #&( RuleSetSource "JZS@@A>NG"))) (DEFINST RuleSetSource ("JZS@@A>ND") (indexedVars ((#&(Rule "NPS0.lVC1.IeB.2")) (#&(Rule "NPS0.lVC1.IeB.3")))) (perspectiveNode #&(RuleSetNode "JZS@@A>N@")) (created "27-JAN-83 00:31:21") ( creator STEFIK) (edited "16-NOV-83 14:57:18") (editor BOBROW)) (DEFINST RuleSetSource ("JZS@@A>NE") (indexedVars ((#&(Rule "NPS0.lVC1.<7;.9")) (#&(Rule "NPS0.lVC1.<7;.10")) (#&(Rule "NPS0.lVC1.<7;.11")) (#&(Rule "NPS0.lVC1.<7;.12")) (#&(Rule "NPS0.lVC1.<7;.13")))) (perspectiveNode #&(RuleSetNode "JZS@@A>NA")) (created "27-JAN-83 00:34:46") ( creator STEFIK) (edited "16-NOV-83 15:11:37") (editor BOBROW)) (DEFINST RuleSetSource ("JZS@@A>NF") (indexedVars ((#&(Rule "NPS0.lVC1.IeB.4")) (#&(Rule "NPS0.lVC1.IeB.5")))) (perspectiveNode #&(RuleSetNode "JZS@@A>NB")) (created "27-JAN-83 00:02:00") ( creator STEFIK) (edited "16-NOV-83 14:57:51") (editor BOBROW)) (DEFINST RuleSetSource ("JZS@@A>NG") (indexedVars ((#&(Rule "LYS.0.5349.124.36446.244")) (#&(Rule "LYS.0.5349.124.36446.245")) (#&(Rule "LYS.0.5349.124.36446.246")) (#&(Rule "LYS.0.5349.124.36446.247" )))) (perspectiveNode #&(RuleSetNode "JZS@@A>NC")) (created "26-JAN-83 23:15:35") (creator STEFIK) ( edited "25-JUL-83 10:28:04") (editor STEFIK)) (DEFINST Rule ("NPS0.lVC1.IeB.2") (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 "16-NOV-83 14:57:18") (editor BOBROW) (ruleNumber 1) (ruleSet #&(RuleSet "JZS@@A>N>"))) (DEFINST Rule ("NPS0.lVC1.IeB.3") (source "(* Now appropriate quantity has been computed) IF qty>0 THEN (_ \PlayerInterface Buy self qty );") (edited "16-NOV-83 14:57:18") (editor BOBROW) ( ruleNumber 2) (ruleSet #&(RuleSet "JZS@@A>N>"))) (DEFINST Rule ("NPS0.lVC1.<7;.9") (source "(* Return as a value the next place to stop enroute to destination.) IF truck:fuel=0 THEN stoppingPlace_(AnyRoadStop $UnionHall);") (edited "16-NOV-83 15:11:37") (editor BOBROW) ( ruleNumber 1) (ruleSet #&(RuleSet "JZS@@A>N?"))) (DEFINST Rule ("NPS0.lVC1.<7;.10") (source "IF wStation_(NearestRoadStop (RoadStops $WeighStation .Range1 direction 'Room)) (Distance wStation)<(Distance destination) THEN stoppingPlace_wStation;") (edited "16-NOV-83 15:11:37") (editor BOBROW) (ruleNumber 2) (ruleSet #&(RuleSet "JZS@@A>N?"))) (DEFINST Rule ("NPS0.lVC1.<7;.11") (source " IF gasStation_(FurthestRoadStop (RoadStops $GasStation .Range1 direction 'Room)) (Distance gasStation)<(Distance destination) THEN stoppingPlace_gasStation;") (edited "16-NOV-83 15:11:37") (editor BOBROW) (ruleNumber 3) (ruleSet #&(RuleSet "JZS@@A>N?"))) (DEFINST Rule ("NPS0.lVC1.<7;.12") (source "IF (Distance destination)<=.Range1 (RoomToParkP destination) THEN stoppingPlace_destination;") (edited "16-NOV-83 15:11:37") (editor BOBROW) (ruleNumber 4) ( ruleSet #&(RuleSet "JZS@@A>N?"))) (DEFINST Rule ("NPS0.lVC1.<7;.13") (source "-> stoppingPlace_(NthRoadStop maxMove direction NIL 'Room);") (edited "16-NOV-83 15:11:37") (editor BOBROW) (ruleNumber 5) (ruleSet #&(RuleSet "JZS@@A>N?"))) (DEFINST Rule ("NPS0.lVC1.IeB.4") (source "(* Ask to go to a stopping place returned by FindStoppingPlace) -> .FindStoppingPlace (_ \PlayerInterface Move self stoppingPlace);") (edited "16-NOV-83 14:57:51") ( editor BOBROW) (ruleNumber 1) (ruleSet #&(RuleSet "JZS@@A>M|"))) (DEFINST Rule ("NPS0.lVC1.IeB.5") (source " (* Check if real truck location is a gas station. Don't use stoppingPlace, since chosen it may not have been reached because of cops or robbers) IF (ISA truck:location $GasStation) THEN .BuyGas;") (edited "16-NOV-83 14:57:51") (editor BOBROW) (ruleNumber 2) (ruleSet #&(RuleSet "JZS@@A>M|"))) (DEFINST Rule ("LYS.0.5349.124.36446.244") (source "(* Top Level RuleSet for Traveler. Travel between UnionHall a randomly chosen AlicesRestaurant) IF ~destination THEN destination_(AnyRoadStop $AlicesRestaurant) direction_'Forward;") (edited "25-JUL-83 10:28:04") (editor STEFIK) (ruleNumber 1) (ruleSet #&( RuleSet "JZS@@A>M{"))) (DEFINST Rule ("LYS.0.5349.124.36446.245") (source " (* No destination if at start) IF (_ truck:location InstOf $UnionHall) THEN destination_(AnyRoadStop $AlicesRestaurant) direction_'Forward;") (edited "25-JUL-83 10:28:04") (editor STEFIK) (ruleNumber 2) (ruleSet #&( RuleSet "JZS@@A>M{"))) (DEFINST Rule ("LYS.0.5349.124.36446.246") (source " (* Choose an Alices to go to.) IF (_ truck:location InstOf $AlicesRestaurant) THEN destination_(AnyRoadStop $UnionHall) direction_'Backward;") (edited "25-JUL-83 10:28:04") (editor STEFIK) (ruleNumber 3) (ruleSet #&( RuleSet "JZS@@A>M{"))) (DEFINST Rule ("LYS.0.5349.124.36446.247") (source " (* Set destination to UnionHall) THEN .GoToStoppingPlace;") (edited "25-JUL-83 10:28:04") (editor STEFIK) (ruleNumber 4) (ruleSet #&( RuleSet "JZS@@A>M{"))) NIL