(FILECREATED "14-Jan-85 17:06:54" {INDIGO}<LOOPS>TRUCKIN>MULTI>TRUCKINM.;63 224355 

      changes to:  (METHODS BWTruckin.InitializeGameWindow ColorTruckin.CreateGameBoard 
			    ColorTruckin.InitializeGameWindow ColorTruckin.MakeDriveBitMaps 
			    DisplayTruckinS.NewGame DisplayTruckinS.ReUseGame 
			    GameCommInterface.NewInstance GameDecisionMaker.NewInstance 
			    GamePlayerInterface.ChangeGameParameters GamePlayerInterface.NewInstance 
			    GameSimulator.NewInstance MainCommInterface.AddBandit 
			    MainCommInterface.AddPlayer MainCommInterface.AddPlayerRequest 
			    MainCommInterface.BeginGameRequest MainCommInterface.BreakCargo 
			    MainCommInterface.BuyMade MainCommInterface.BuyRequest 
			    MainCommInterface.GameOver MainCommInterface.GasFill 
			    MainCommInterface.MaxMove MainCommInterface.MoveMade 
			    MainCommInterface.MoveRequest MainCommInterface.NewGame 
			    MainCommInterface.NewGameRequest MainCommInterface.ParkedAtAlice 
			    MainCommInterface.ReUseGame MainCommInterface.ReUseGameRequest 
			    MainCommInterface.RemovePlayer MainCommInterface.RemovePlayerRequest 
			    MainCommInterface.SellMade MainCommInterface.SellRequest 
			    MainCommInterface.SetInitialParameters MainCommInterface.SetUp 
			    MainCommInterface.SpoilCargo MainCommInterface.StartGame 
			    MainCommInterface.WorldProcess MoveTruckinDM.InitializeGameParameters 
			    MoveTruckinDM.MoveBandits MoveTruckinPI.RunGame 
			    NoDisplayTruckinS.AttachBoard NoDisplayTruckinS.DrivePlayer 
			    NoDisplayTruckinS.UpdateRS RemoteMasterComm.AddBandit 
			    RemoteMasterComm.AddPlayer RemoteMasterComm.AddPlayerRequest 
			    RemoteMasterComm.BeginGameRequest RemoteMasterComm.BreakCargo 
			    RemoteMasterComm.BuyMade RemoteMasterComm.BuyRequest 
			    RemoteMasterComm.GameOver RemoteMasterComm.GasFill 
			    RemoteMasterComm.InterimWorldProcess RemoteMasterComm.MaxMove 
			    RemoteMasterComm.MoveMade RemoteMasterComm.MoveRequest 
			    RemoteMasterComm.NewGame RemoteMasterComm.NewGameRequest 
			    RemoteMasterComm.ParkedAtAlice RemoteMasterComm.ReUseGame 
			    RemoteMasterComm.ReUseGameRequest RemoteMasterComm.RemovePlayer 
			    RemoteMasterComm.RemovePlayerRequest RemoteMasterComm.SellMade 
			    RemoteMasterComm.SellRequest RemoteMasterComm.SetInitialParameters 
			    RemoteMasterComm.SetUp RemoteMasterComm.SpoilCargo 
			    RemoteMasterComm.StartGame RemoteMasterComm.StartInterimWorldProcess 
			    RemoteMasterComm.WorldProcess RemoteSlaveComm.AddBandit 
			    RemoteSlaveComm.AddPlayer RemoteSlaveComm.AddPlayerRequest 
			    RemoteSlaveComm.BeginGameRequest RemoteSlaveComm.BreakCargo 
			    RemoteSlaveComm.BuyMade RemoteSlaveComm.BuyRequest 
			    RemoteSlaveComm.GameOver RemoteSlaveComm.GasFill 
			    RemoteSlaveComm.InterimWorldProcess RemoteSlaveComm.MaxMove 
			    RemoteSlaveComm.MoveMade RemoteSlaveComm.MoveRequest 
			    RemoteSlaveComm.NewGame RemoteSlaveComm.NewGameRequest 
			    RemoteSlaveComm.ParkedAtAlice RemoteSlaveComm.ReUseGame 
			    RemoteSlaveComm.ReUseGameRequest RemoteSlaveComm.RemovePlayer 
			    RemoteSlaveComm.RemovePlayerRequest RemoteSlaveComm.SellMade 
			    RemoteSlaveComm.SellRequest RemoteSlaveComm.SetInitialParameters 
			    RemoteSlaveComm.SetUp RemoteSlaveComm.SpoilCargo 
			    RemoteSlaveComm.StartGame RemoteSlaveComm.StartInterimWorldProcess 
			    RemoteSlaveComm.WorldProcess TimeTruckinDM.ChargeTime 
			    TimeTruckinDM.CheckAlice TimeTruckinDM.InitializeGameParameters 
			    TimeTruckinDM.MoveBandits TimeTruckinDM.RedoGameParameters 
			    TimeTruckinDM.ReplenishQty TimeTruckinPI.RunGame 
			    TruckinBoard.AssignRoadStops TruckinBoard.AttachToGame 
			    TruckinBoard.CreateGameBoard TruckinBoard.DisplayGameBoard 
			    TruckinBoard.InitializeRoadStops TruckinBoard.MakeDriveBitMaps 
			    TruckinBoard.NewBoard TruckinBoard.PlaceRoadStops 
			    TruckinBoard.ReInitializeRoadStops TruckinBoard.ReUseBoard 
			    TruckinBoard.RemovePlayer TruckinCommInterface.CleanGameWorld 
			    TruckinCommInterface.CreateDecisionMaker 
			    TruckinCommInterface.CreateGateWay 
			    TruckinCommInterface.CreatePlayerInterface 
			    TruckinCommInterface.CreateSimulator 
			    TruckinCommInterface.SetInitialParameters 
			    TruckinCommInterface.StartWorldProcess TruckinCommInterface.TellMe 
			    TruckinDecisionMaker.AddBandit TruckinDecisionMaker.AddPlayer 
			    TruckinDecisionMaker.AddPlayerRequest 
			    TruckinDecisionMaker.AttachSimulator 
			    TruckinDecisionMaker.BeginGameRequest TruckinDecisionMaker.BuyMade 
			    TruckinDecisionMaker.BuyRequest TruckinDecisionMaker.ChangeGameParameters 
			    TruckinDecisionMaker.CheckAlice TruckinDecisionMaker.ForcedMove 
			    TruckinDecisionMaker.GameOver TruckinDecisionMaker.GiveAliceBonus 
			    TruckinDecisionMaker.InitializeGameParameters 
			    TruckinDecisionMaker.MonitorGame TruckinDecisionMaker.MonitorProcess 
			    TruckinDecisionMaker.MoveBandits TruckinDecisionMaker.MoveCheckingHazards 
			    TruckinDecisionMaker.MoveMade TruckinDecisionMaker.MoveRequest 
			    TruckinDecisionMaker.MoveTruck TruckinDecisionMaker.NewGameRequest 
			    TruckinDecisionMaker.ReUseGameRequest 
			    TruckinDecisionMaker.RedoGameParameters TruckinDecisionMaker.RemovePlayer 
			    TruckinDecisionMaker.RemovePlayerRequest 
			    TruckinDecisionMaker.ReplenishQty TruckinDecisionMaker.SellMade 
			    TruckinDecisionMaker.SellRequest TruckinDecisionMaker.StartGame 
			    TruckinDecisionMaker.StartMonitorProcess TruckinDecisionMaker.UpdateAlice 
			    TruckinPlayerInterface.AddPlayer TruckinPlayerInterface.AddPlayerRequest 
			    TruckinPlayerInterface.BeginGame TruckinPlayerInterface.Buy 
			    TruckinPlayerInterface.BuyMade TruckinPlayerInterface.ChargeTime 
			    TruckinPlayerInterface.CheckLocalPlayers 
			    TruckinPlayerInterface.ContinueGame 
			    TruckinPlayerInterface.CreatePlayerProcess 
			    TruckinPlayerInterface.DeletePlayerProcesses TruckinPlayerInterface.Move 
			    TruckinPlayerInterface.MoveMade TruckinPlayerInterface.NewGame 
			    TruckinPlayerInterface.NewGameRequest 
			    TruckinPlayerInterface.PlayerRequestComplete 
			    TruckinPlayerInterface.ReUseGame TruckinPlayerInterface.RemovePlayer 
			    TruckinPlayerInterface.RemovePlayerRequest 
			    TruckinPlayerInterface.RunNextPlayer 
			    TruckinPlayerInterface.ScheduleNextPlayer 
			    TruckinPlayerInterface.SelectPlayers TruckinPlayerInterface.Sell 
			    TruckinPlayerInterface.SellMade TruckinPlayerInterface.StartGame 
			    TruckinPlayerInterface.StartPlayerProcesses 
			    TruckinPlayerInterface.SuspendPlayer TruckinPlayerInterface.WakePlayer 
			    TruckinSimulator.AddBandit TruckinSimulator.AddPlayer 
			    TruckinSimulator.AttachBoard TruckinSimulator.BreakCargo 
			    TruckinSimulator.BuyMade TruckinSimulator.ClockProcess 
			    TruckinSimulator.DrivePlayer TruckinSimulator.GameOver 
			    TruckinSimulator.GasFill TruckinSimulator.GiveAliceBonus 
			    TruckinSimulator.Initialize TruckinSimulator.MaxMove 
			    TruckinSimulator.MoveMade TruckinSimulator.NewGame 
			    TruckinSimulator.ParkedAtAlice TruckinSimulator.ReUseGame 
			    TruckinSimulator.RedoGameParameters TruckinSimulator.RemovePlayer 
			    TruckinSimulator.SellMade TruckinSimulator.SetUpGauges 
			    TruckinSimulator.SpoilCargo TruckinSimulator.StartClockProcess 
			    TruckinSimulator.StartGame TruckinSimulator.UnattachBoard 
			    TruckinSimulator.UpdateRS TruckinSimulator.WhoWon)
		   (FNS BWTruckin.InitializeGameWindow ColorTruckin.CreateGameBoard 
			ColorTruckin.InitializeGameWindow ColorTruckin.MakeDriveBitMaps 
			DisplayTruckinS.NewGame DisplayTruckinS.ReUseGame 
			GameCommInterface.NewInstance GameDecisionMaker.NewInstance 
			GamePlayerInterface.ChangeGameParameters GamePlayerInterface.NewInstance 
			GameSimulator.NewInstance MainCommInterface.AddBandit 
			MainCommInterface.AddPlayer MainCommInterface.AddPlayerRequest 
			MainCommInterface.BeginGameRequest MainCommInterface.BreakCargo 
			MainCommInterface.BuyMade MainCommInterface.BuyRequest 
			MainCommInterface.GameOver MainCommInterface.GasFill 
			MainCommInterface.MaxMove MainCommInterface.MoveMade 
			MainCommInterface.MoveRequest MainCommInterface.NewGame 
			MainCommInterface.NewGameRequest MainCommInterface.ParkedAtAlice 
			MainCommInterface.ReUseGame MainCommInterface.ReUseGameRequest 
			MainCommInterface.RemovePlayer MainCommInterface.RemovePlayerRequest 
			MainCommInterface.SellMade MainCommInterface.SellRequest 
			MainCommInterface.SetInitialParameters MainCommInterface.SetUp 
			MainCommInterface.SpoilCargo MainCommInterface.StartGame 
			MainCommInterface.WorldProcess MoveTruckinDM.InitializeGameParameters 
			MoveTruckinDM.MoveBandits MoveTruckinPI.RunGame NoDisplayTruckinS.AttachBoard 
			NoDisplayTruckinS.DrivePlayer NoDisplayTruckinS.UpdateRS 
			RemoteMasterComm.AddBandit RemoteMasterComm.AddPlayer 
			RemoteMasterComm.AddPlayerRequest RemoteMasterComm.BeginGameRequest 
			RemoteMasterComm.BreakCargo RemoteMasterComm.BuyMade 
			RemoteMasterComm.BuyRequest RemoteMasterComm.GameOver 
			RemoteMasterComm.GasFill RemoteMasterComm.InterimWorldProcess 
			RemoteMasterComm.MaxMove RemoteMasterComm.MoveMade 
			RemoteMasterComm.MoveRequest RemoteMasterComm.NewGame 
			RemoteMasterComm.NewGameRequest RemoteMasterComm.ParkedAtAlice 
			RemoteMasterComm.ReUseGame RemoteMasterComm.ReUseGameRequest 
			RemoteMasterComm.RemovePlayer RemoteMasterComm.RemovePlayerRequest 
			RemoteMasterComm.SellMade RemoteMasterComm.SellRequest 
			RemoteMasterComm.SetInitialParameters RemoteMasterComm.SetUp 
			RemoteMasterComm.SpoilCargo RemoteMasterComm.StartGame 
			RemoteMasterComm.StartInterimWorldProcess RemoteMasterComm.WorldProcess 
			RemoteSlaveComm.AddBandit RemoteSlaveComm.AddPlayer 
			RemoteSlaveComm.AddPlayerRequest RemoteSlaveComm.BeginGameRequest 
			RemoteSlaveComm.BreakCargo RemoteSlaveComm.BuyMade RemoteSlaveComm.BuyRequest 
			RemoteSlaveComm.GameOver RemoteSlaveComm.GasFill 
			RemoteSlaveComm.InterimWorldProcess RemoteSlaveComm.MaxMove 
			RemoteSlaveComm.MoveMade RemoteSlaveComm.MoveRequest RemoteSlaveComm.NewGame 
			RemoteSlaveComm.NewGameRequest RemoteSlaveComm.ParkedAtAlice 
			RemoteSlaveComm.ReUseGame RemoteSlaveComm.ReUseGameRequest 
			RemoteSlaveComm.RemovePlayer RemoteSlaveComm.RemovePlayerRequest 
			RemoteSlaveComm.SellMade RemoteSlaveComm.SellRequest 
			RemoteSlaveComm.SetInitialParameters RemoteSlaveComm.SetUp 
			RemoteSlaveComm.SpoilCargo RemoteSlaveComm.StartGame 
			RemoteSlaveComm.StartInterimWorldProcess RemoteSlaveComm.WorldProcess 
			TimeTruckinDM.ChargeTime TimeTruckinDM.CheckAlice 
			TimeTruckinDM.InitializeGameParameters TimeTruckinDM.MoveBandits 
			TimeTruckinDM.RedoGameParameters TimeTruckinDM.ReplenishQty 
			TimeTruckinPI.RunGame TruckinBoard.AssignRoadStops TruckinBoard.AttachToGame 
			TruckinBoard.CreateGameBoard TruckinBoard.DisplayGameBoard 
			TruckinBoard.InitializeRoadStops TruckinBoard.MakeDriveBitMaps 
			TruckinBoard.NewBoard TruckinBoard.PlaceRoadStops 
			TruckinBoard.ReInitializeRoadStops TruckinBoard.ReUseBoard 
			TruckinBoard.RemovePlayer TruckinCommInterface.CleanGameWorld 
			TruckinCommInterface.CreateDecisionMaker TruckinCommInterface.CreateGateWay 
			TruckinCommInterface.CreatePlayerInterface 
			TruckinCommInterface.CreateSimulator 
			TruckinCommInterface.SetInitialParameters 
			TruckinCommInterface.StartWorldProcess TruckinCommInterface.TellMe 
			TruckinDecisionMaker.AddBandit TruckinDecisionMaker.AddPlayer 
			TruckinDecisionMaker.AddPlayerRequest TruckinDecisionMaker.AttachSimulator 
			TruckinDecisionMaker.BeginGameRequest TruckinDecisionMaker.BuyMade 
			TruckinDecisionMaker.BuyRequest TruckinDecisionMaker.ChangeGameParameters 
			TruckinDecisionMaker.CheckAlice TruckinDecisionMaker.ForcedMove 
			TruckinDecisionMaker.GameOver TruckinDecisionMaker.GiveAliceBonus 
			TruckinDecisionMaker.InitializeGameParameters 
			TruckinDecisionMaker.MonitorGame TruckinDecisionMaker.MonitorProcess 
			TruckinDecisionMaker.MoveBandits TruckinDecisionMaker.MoveCheckingHazards 
			TruckinDecisionMaker.MoveMade TruckinDecisionMaker.MoveRequest 
			TruckinDecisionMaker.MoveTruck TruckinDecisionMaker.NewGameRequest 
			TruckinDecisionMaker.ReUseGameRequest TruckinDecisionMaker.RedoGameParameters 
			TruckinDecisionMaker.RemovePlayer TruckinDecisionMaker.RemovePlayerRequest 
			TruckinDecisionMaker.ReplenishQty TruckinDecisionMaker.SellMade 
			TruckinDecisionMaker.SellRequest TruckinDecisionMaker.StartGame 
			TruckinDecisionMaker.StartMonitorProcess TruckinDecisionMaker.UpdateAlice 
			TruckinPlayerInterface.AddPlayer TruckinPlayerInterface.AddPlayerRequest 
			TruckinPlayerInterface.BeginGame TruckinPlayerInterface.Buy 
			TruckinPlayerInterface.BuyMade TruckinPlayerInterface.ChargeTime 
			TruckinPlayerInterface.CheckLocalPlayers TruckinPlayerInterface.ContinueGame 
			TruckinPlayerInterface.CreatePlayerProcess 
			TruckinPlayerInterface.DeletePlayerProcesses TruckinPlayerInterface.Move 
			TruckinPlayerInterface.MoveMade TruckinPlayerInterface.NewGame 
			TruckinPlayerInterface.NewGameRequest 
			TruckinPlayerInterface.PlayerRequestComplete TruckinPlayerInterface.ReUseGame 
			TruckinPlayerInterface.RemovePlayer 
			TruckinPlayerInterface.RemovePlayerRequest 
			TruckinPlayerInterface.RunNextPlayer 
			TruckinPlayerInterface.ScheduleNextPlayer 
			TruckinPlayerInterface.SelectPlayers TruckinPlayerInterface.Sell 
			TruckinPlayerInterface.SellMade TruckinPlayerInterface.StartGame 
			TruckinPlayerInterface.StartPlayerProcesses 
			TruckinPlayerInterface.SuspendPlayer TruckinPlayerInterface.WakePlayer 
			TruckinSimulator.AddBandit TruckinSimulator.AddPlayer 
			TruckinSimulator.AttachBoard TruckinSimulator.BreakCargo 
			TruckinSimulator.BuyMade TruckinSimulator.ClockProcess 
			TruckinSimulator.DrivePlayer TruckinSimulator.GameOver 
			TruckinSimulator.GasFill TruckinSimulator.GiveAliceBonus 
			TruckinSimulator.Initialize TruckinSimulator.MaxMove 
			TruckinSimulator.MoveMade TruckinSimulator.NewGame 
			TruckinSimulator.ParkedAtAlice TruckinSimulator.ReUseGame 
			TruckinSimulator.RedoGameParameters TruckinSimulator.RemovePlayer 
			TruckinSimulator.SellMade TruckinSimulator.SetUpGauges 
			TruckinSimulator.SpoilCargo TruckinSimulator.StartClockProcess 
			TruckinSimulator.StartGame TruckinSimulator.UnattachBoard 
			TruckinSimulator.UpdateRS TruckinSimulator.WhoWon)

      previous date: "13-NOV-83 18:40:27" {INDIGO}<LOOPS>TRUCKIN>MULTI>TRUCKINM.;62)


(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT TRUCKINMCOMS)

(RPAQQ TRUCKINMCOMS ((* Copyright (c)
			1983 Xerox Corporation)
	(* Classes for MultiMachineTruckin Knowledge System)
	(* Programmed by LoopsDesignTeam in June 1983.0 Maintained by Sanjay Mittal)
	(* This version of Truckin supersedes the older versions)
	(CLASSES BWTruckin ColorTruckin DisplayTruckinS GameCommInterface GameDecisionMaker 
		 GamePlayerInterface GameSimulator MainCommInterface MasterTruckin MoveTruckinDM 
		 MoveTruckinPI NoDisplayTruckinS RemoteMasterComm RemoteSlaveComm SlaveTruckin 
		 TimeTruckinDM TimeTruckinPI Truckin TruckinBoard TruckinCommInterface 
		 TruckinDecisionMaker TruckinPlayerInterface TruckinSimulator)
	(FNS MoveTruckinPI.BeginGame RemoteMasterComm.StartWorldProcess 
	     RemoteSlaveComm.StartWorldProcess SlaveTruckin TimeTruckinPI.BeginGame 
	     TruckinCommInterface.NewInstance)
	(VARS GameBrowse (GameProcRestFlg T)
	      (PlayerProcRestFlg (QUOTE HARDRESET)))
	(METHODS BWTruckin.InitializeGameWindow ColorTruckin.CreateGameBoard 
		 ColorTruckin.InitializeGameWindow ColorTruckin.MakeDriveBitMaps 
		 DisplayTruckinS.NewGame DisplayTruckinS.ReUseGame GameCommInterface.NewInstance 
		 GameDecisionMaker.NewInstance GamePlayerInterface.ChangeGameParameters 
		 GamePlayerInterface.NewInstance GameSimulator.NewInstance 
		 MainCommInterface.AddBandit MainCommInterface.AddPlayer 
		 MainCommInterface.AddPlayerRequest MainCommInterface.BeginGameRequest 
		 MainCommInterface.BreakCargo MainCommInterface.BuyMade MainCommInterface.BuyRequest 
		 MainCommInterface.GameOver MainCommInterface.GasFill MainCommInterface.MaxMove 
		 MainCommInterface.MoveMade MainCommInterface.MoveRequest MainCommInterface.NewGame 
		 MainCommInterface.NewGameRequest MainCommInterface.ParkedAtAlice 
		 MainCommInterface.ReUseGame MainCommInterface.ReUseGameRequest 
		 MainCommInterface.RemovePlayer MainCommInterface.RemovePlayerRequest 
		 MainCommInterface.SellMade MainCommInterface.SellRequest 
		 MainCommInterface.SetInitialParameters MainCommInterface.SetUp 
		 MainCommInterface.SpoilCargo MainCommInterface.StartGame 
		 MainCommInterface.WorldProcess MoveTruckinDM.InitializeGameParameters 
		 MoveTruckinDM.MoveBandits MoveTruckinPI.RunGame NoDisplayTruckinS.AttachBoard 
		 NoDisplayTruckinS.DrivePlayer NoDisplayTruckinS.UpdateRS RemoteMasterComm.AddBandit 
		 RemoteMasterComm.AddPlayer RemoteMasterComm.AddPlayerRequest 
		 RemoteMasterComm.BeginGameRequest RemoteMasterComm.BreakCargo 
		 RemoteMasterComm.BuyMade RemoteMasterComm.BuyRequest RemoteMasterComm.GameOver 
		 RemoteMasterComm.GasFill RemoteMasterComm.InterimWorldProcess 
		 RemoteMasterComm.MaxMove RemoteMasterComm.MoveMade RemoteMasterComm.MoveRequest 
		 RemoteMasterComm.NewGame RemoteMasterComm.NewGameRequest 
		 RemoteMasterComm.ParkedAtAlice RemoteMasterComm.ReUseGame 
		 RemoteMasterComm.ReUseGameRequest RemoteMasterComm.RemovePlayer 
		 RemoteMasterComm.RemovePlayerRequest RemoteMasterComm.SellMade 
		 RemoteMasterComm.SellRequest RemoteMasterComm.SetInitialParameters 
		 RemoteMasterComm.SetUp RemoteMasterComm.SpoilCargo RemoteMasterComm.StartGame 
		 RemoteMasterComm.StartInterimWorldProcess RemoteMasterComm.WorldProcess 
		 RemoteSlaveComm.AddBandit RemoteSlaveComm.AddPlayer RemoteSlaveComm.AddPlayerRequest 
		 RemoteSlaveComm.BeginGameRequest RemoteSlaveComm.BreakCargo RemoteSlaveComm.BuyMade 
		 RemoteSlaveComm.BuyRequest RemoteSlaveComm.GameOver RemoteSlaveComm.GasFill 
		 RemoteSlaveComm.InterimWorldProcess RemoteSlaveComm.MaxMove RemoteSlaveComm.MoveMade 
		 RemoteSlaveComm.MoveRequest RemoteSlaveComm.NewGame RemoteSlaveComm.NewGameRequest 
		 RemoteSlaveComm.ParkedAtAlice RemoteSlaveComm.ReUseGame 
		 RemoteSlaveComm.ReUseGameRequest RemoteSlaveComm.RemovePlayer 
		 RemoteSlaveComm.RemovePlayerRequest RemoteSlaveComm.SellMade 
		 RemoteSlaveComm.SellRequest RemoteSlaveComm.SetInitialParameters 
		 RemoteSlaveComm.SetUp RemoteSlaveComm.SpoilCargo RemoteSlaveComm.StartGame 
		 RemoteSlaveComm.StartInterimWorldProcess RemoteSlaveComm.WorldProcess 
		 TimeTruckinDM.ChargeTime TimeTruckinDM.CheckAlice 
		 TimeTruckinDM.InitializeGameParameters TimeTruckinDM.MoveBandits 
		 TimeTruckinDM.RedoGameParameters TimeTruckinDM.ReplenishQty TimeTruckinPI.RunGame 
		 TruckinBoard.AssignRoadStops TruckinBoard.AttachToGame TruckinBoard.CreateGameBoard 
		 TruckinBoard.DisplayGameBoard TruckinBoard.DrawRoadMarks 
		 TruckinBoard.InitializeRoadStops TruckinBoard.MakeDriveBitMaps TruckinBoard.NewBoard 
		 TruckinBoard.PlaceRoadStops TruckinBoard.ReInitializeRoadStops 
		 TruckinBoard.ReUseBoard TruckinBoard.RemovePlayer 
		 TruckinCommInterface.CleanGameWorld TruckinCommInterface.CreateDecisionMaker 
		 TruckinCommInterface.CreateGateWay TruckinCommInterface.CreatePlayerInterface 
		 TruckinCommInterface.CreateSimulator TruckinCommInterface.SetInitialParameters 
		 TruckinCommInterface.StartWorldProcess TruckinCommInterface.TellMe 
		 TruckinDecisionMaker.AddBandit TruckinDecisionMaker.AddPlayer 
		 TruckinDecisionMaker.AddPlayerRequest TruckinDecisionMaker.AttachSimulator 
		 TruckinDecisionMaker.BeginGameRequest TruckinDecisionMaker.BuyMade 
		 TruckinDecisionMaker.BuyRequest TruckinDecisionMaker.ChangeGameParameters 
		 TruckinDecisionMaker.CheckAlice TruckinDecisionMaker.ForcedMove 
		 TruckinDecisionMaker.GameOver TruckinDecisionMaker.GiveAliceBonus 
		 TruckinDecisionMaker.InitializeGameParameters TruckinDecisionMaker.MonitorGame 
		 TruckinDecisionMaker.MonitorProcess TruckinDecisionMaker.MoveBandits 
		 TruckinDecisionMaker.MoveCheckingHazards TruckinDecisionMaker.MoveMade 
		 TruckinDecisionMaker.MoveRequest TruckinDecisionMaker.MoveTruck 
		 TruckinDecisionMaker.NewGameRequest TruckinDecisionMaker.ReUseGameRequest 
		 TruckinDecisionMaker.RedoGameParameters TruckinDecisionMaker.RemovePlayer 
		 TruckinDecisionMaker.RemovePlayerRequest TruckinDecisionMaker.ReplenishQty 
		 TruckinDecisionMaker.SellMade TruckinDecisionMaker.SellRequest 
		 TruckinDecisionMaker.StartGame TruckinDecisionMaker.StartMonitorProcess 
		 TruckinDecisionMaker.UpdateAlice TruckinPlayerInterface.AddPlayer 
		 TruckinPlayerInterface.AddPlayerRequest TruckinPlayerInterface.BeginGame 
		 TruckinPlayerInterface.Buy TruckinPlayerInterface.BuyMade 
		 TruckinPlayerInterface.ChargeTime TruckinPlayerInterface.CheckLocalPlayers 
		 TruckinPlayerInterface.ContinueGame TruckinPlayerInterface.CreatePlayerProcess 
		 TruckinPlayerInterface.DeletePlayerProcesses TruckinPlayerInterface.Move 
		 TruckinPlayerInterface.MoveMade TruckinPlayerInterface.NewGame 
		 TruckinPlayerInterface.NewGameRequest TruckinPlayerInterface.PlayerRequestComplete 
		 TruckinPlayerInterface.ReUseGame TruckinPlayerInterface.RemovePlayer 
		 TruckinPlayerInterface.RemovePlayerRequest TruckinPlayerInterface.RunNextPlayer 
		 TruckinPlayerInterface.ScheduleNextPlayer TruckinPlayerInterface.SelectPlayers 
		 TruckinPlayerInterface.Sell TruckinPlayerInterface.SellMade 
		 TruckinPlayerInterface.StartGame TruckinPlayerInterface.StartPlayerProcesses 
		 TruckinPlayerInterface.SuspendPlayer TruckinPlayerInterface.WakePlayer 
		 TruckinSimulator.AddBandit TruckinSimulator.AddPlayer TruckinSimulator.AttachBoard 
		 TruckinSimulator.BreakCargo TruckinSimulator.BuyMade TruckinSimulator.ClockProcess 
		 TruckinSimulator.DrivePlayer TruckinSimulator.GameOver TruckinSimulator.GasFill 
		 TruckinSimulator.GiveAliceBonus TruckinSimulator.Initialize TruckinSimulator.MaxMove 
		 TruckinSimulator.MoveMade TruckinSimulator.NewGame TruckinSimulator.ParkedAtAlice 
		 TruckinSimulator.ReUseGame TruckinSimulator.RedoGameParameters 
		 TruckinSimulator.RemovePlayer TruckinSimulator.SellMade TruckinSimulator.SetUpGauges 
		 TruckinSimulator.SpoilCargo TruckinSimulator.StartClockProcess 
		 TruckinSimulator.StartGame TruckinSimulator.UnattachBoard TruckinSimulator.UpdateRS 
		 TruckinSimulator.WhoWon)))



(* Copyright (c) 1983 Xerox Corporation)




(* Classes for MultiMachineTruckin Knowledge System)




(* Programmed by LoopsDesignTeam in June 1983.0 Maintained by Sanjay Mittal)




(* This version of Truckin supersedes the older versions)

(DEFCLASSES BWTruckin ColorTruckin DisplayTruckinS GameCommInterface GameDecisionMaker 
	    GamePlayerInterface GameSimulator MainCommInterface MasterTruckin MoveTruckinDM 
	    MoveTruckinPI NoDisplayTruckinS RemoteMasterComm RemoteSlaveComm SlaveTruckin 
	    TimeTruckinDM TimeTruckinPI Truckin TruckinBoard TruckinCommInterface 
	    TruckinDecisionMaker TruckinPlayerInterface TruckinSimulator)
[DEFCLASS BWTruckin
   (MetaClass GameClass Edited:                              (* sm: "27-JUN-83 17:31"))
   (Supers TruckinBoard)
   (ClassVariables (CopyCV NIL))]

[DEFCLASS ColorTruckin
   (MetaClass GameClass Edited:                              (* sm: "27-JUN-83 17:32"))
   (Supers TruckinBoard)
   (ClassVariables (numRows 4 doc                            (* number of RoadStops arranged vertically on the game 
							     board.))
		   (numColumns 7 doc                         (* number of RoadStops arranged horizontally on the 
							     game board.))
		   (colorP T doc                             (* This indicates that the display will be on the color
							     screen))
		   (CopyCV NIL))]

[DEFCLASS DisplayTruckinS
   (MetaClass GameClass Edited:                              (* sm: "27-JUN-83 17:10"))
   (Supers TruckinSimulator)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))]

[DEFCLASS GameCommInterface
   (MetaClass GameClass Edited:                              (* edited: "12-JUL-83 11:36")
	      doc                                            (* General class for Game Communications)
	      )
   (Supers GameObject)
   (ClassVariables (CopyCV))
   (InstanceVariables (simulator NIL doc                     (* instance of GameSimulator))
		      (playerInterface NIL doc               (* instance of PlayerInterface))
		      (broadcastList NIL doc                 (* list of objects which will get copies of incoming 
							     messages))
		      (machineID NIL doc                     (* unique ID for identifying different machines in the 
							     multiMC Truckin))
		      (worldProcess NIL doc                  (* handle of the WorldProcess))
		      (interimWP NIL doc                     (* handle of Interim World Process)))]

[DEFCLASS GameDecisionMaker
   (MetaClass GameClass Edited:                              (* sm: "30-JUN-83 18:53")
	      doc                                            (* Makes all decisions in the game)
	      )
   (Supers GameObject)
   (ClassVariables (CopyCV))
   (InstanceVariables (gameParameters DMParameters doc       (* class for changing game parameters at DecisionMaker 
							     level)))]

[DEFCLASS GamePlayerInterface
   (MetaClass GameClass Edited:                              (* sm: "30-JUN-83 15:34")
	      doc                                            (* All players's messages go to this class)
	      )
   (Supers GameObject)
   (ClassVariables (CopyCV))
   (InstanceVariables (localPlayers NIL doc                  (* list of players locally connected to this interface)
				    )
		      (suspendedPlayers NIL doc              (* list of players suspended pending completion of 
							     their requests)))]

[DEFCLASS GameSimulator
   (MetaClass GameClass Edited:                              (* sm: "27-JUN-83 15:33")
	      doc                                            (* Handles the game simulation and keeps the game world
							     in sync)
	      )
   (Supers GameObject)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))]

[DEFCLASS MainCommInterface
   (MetaClass GameClass Edited:                              (* sm: " 8-JUL-83 15:34"))
   (Supers TruckinCommInterface)
   (ClassVariables (CopyCV NIL))
   (InstanceVariables (decisionMaker NIL DefaultClass TimeTruckinDM doc 
                                                             (* instance of GameDecisionMaker))
		      (gameStarted NIL))]

[DEFCLASS MasterTruckin
   (MetaClass GameClass Edited:                              (* sm: "10-JUL-83 20:51"))
   (Supers RemoteMasterComm)
   (ClassVariables (CopyCV NIL))]

[DEFCLASS MoveTruckinDM
   (MetaClass GameClass Edited:                              (* sm: "29-JUN-83 10:17"))
   (Supers TruckinDecisionMaker)
   (ClassVariables (CopyCV)
		   (PlayerInterface MoveTruckinPI doc        (* name of class of this type associated with this 
							     DecisionMaker)))
   (InstanceVariables (aliceStay 3 doc                       (* how many moves can stay at Alices))
		      (banditFreq 5 doc                      (* how often bandits move))
		      (numMovesRemaining 200 DefaultGauge DigiMeter GaugeLimit (0 200)
					 GaugePos
					 (852 . 465)
					 SetByUser NIL doc 
                                                             (* number of moves remaining in the game.
							     SetByUser is used to flag that value is not to be 
							     reinitialized))
		      (replenishFreq 40 doc                  (* how often gas is replenished)))]

[DEFCLASS MoveTruckinPI
   (MetaClass GameClass Edited:                              (* sm: "29-JUN-83 10:16"))
   (Supers TruckinPlayerInterface)
   (ClassVariables (CopyCV)
		   (DecisionMaker MoveTruckinDM doc          (* name of associated DecisionMaker class)
				  ))]

[DEFCLASS NoDisplayTruckinS
   (MetaClass GameClass Edited:                              (* sm: "27-JUN-83 17:10"))
   (Supers TruckinSimulator)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))]

[DEFCLASS RemoteMasterComm
   (MetaClass GameClass Edited:                              (* sm: " 8-JUL-83 12:16"))
   (Supers TruckinCommInterface)
   (ClassVariables (CopyCV NIL))
   (InstanceVariables (decisionMaker NIL DefaultClass TimeTruckinDM doc 
                                                             (* instance of GameDecisionMaker))
		      (postman NIL DefaultClass MasterGateway doc 
                                                             (* instance of Master GateWay))
		      (gameStarted NIL))]

[DEFCLASS RemoteSlaveComm
   (MetaClass GameClass Edited:                              (* sm: " 8-JUL-83 12:14"))
   (Supers TruckinCommInterface)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))
   (InstanceVariables (postman NIL DefaultClass SlaveGateway doc 
                                                             (* instance of Slave GateWay))
		      (gameStarted NIL doc                   (* set to T when StartGame msg received))
		      )]

[DEFCLASS SlaveTruckin
   (MetaClass GameClass Edited:                              (* sm: "10-JUL-83 20:51"))
   (Supers RemoteSlaveComm)
   (ClassVariables (CopyCV (Icon))
		   (Icon ?))]

[DEFCLASS TimeTruckinDM
   (MetaClass GameClass Edited:                              (* sm: " 4-AUG-83 13:14"))
   (Supers TruckinDecisionMaker)
   (ClassVariables (MinMoveTime 1 doc                        (* min time everyone is charged))
		   (MaxMoveTime 30 doc                       (* max time per move, after which player yanked from 
							     game))
		   (AliceBonus 2 doc                         (* cashBox multiplied by this for reaching Alice)
			       )
		   (CopyCV)
		   (PlayerInterface TimeTruckinPI))
   (InstanceVariables (aliceStay 3 MaxTime 30 AliceFactor 8 doc 
                                                             (* aliceStay -
							     max conseq turns at Alice. MaxTime -
							     Max time allowed at Alice during a conseq stay)
				 )
		      (gameParameters TDMTParameters)
		      (banditFreq 50 LastTime 3000 BanditFactor 15 doc 
                                                             (* freq of bandits move))
		      (replenishFreq 300 LastTime 3000 ReplenishFactor 30 doc 
                                                             (* how freq are gas stations filled)))]

[DEFCLASS TimeTruckinPI
   (MetaClass GameClass Edited:                              (* sm: "29-JUN-83 10:16"))
   (Supers TruckinPlayerInterface)
   (ClassVariables (CopyCV)
		   (DecisionMaker TimeTruckinDM doc          (* name of associated DecisionMaker class)
				  ))]

[DEFCLASS Truckin
   (MetaClass GameClass Edited:                              (* sm: "10-JUL-83 20:50"))
   (Supers MainCommInterface)
   (ClassVariables (CopyCV NIL))]

[DEFCLASS TruckinBoard
   (MetaClass GameClass Edited:                              (* sm: "27-JUN-83 17:31"))
   (Supers GameBoard)
   (ClassVariables (numRows 6 doc                            (* number of RoadStops arranged vertically on the game 
							     board.))
		   (numColumns 11 doc                        (* number of RoadStops arranged horizontally on the 
							     game board.))
		   (colorP NIL doc                           (* This indicates that this is not a colordisplay)
			   )
		   (CopyCV NIL))
   (InstanceVariables (roadStops NIL doc                     (* List of RoadStops on gameBoard.)))]

[DEFCLASS TruckinCommInterface
   (MetaClass GameClass Edited:                              (* sm: " 8-JUL-83 15:35")
	      doc                                            (* Class for handling Truckin Communications on a 
							     single machine)
	      )
   (Supers GameCommInterface)
   (ClassVariables (CopyCV)
		   (InitializeIVs (gameStarted)))
   (InstanceVariables (simulator NIL DefaultClass DisplayTruckinS)
		      (playerInterface NIL DefaultClass TimeTruckinPI)
		      (gameStarted NIL))]

[DEFCLASS TruckinDecisionMaker
   (MetaClass GameClass Edited:                              (* dgb: "11-JUL-83 13:35"))
   (Supers GameDecisionMaker)
   (ClassVariables (CopyCV (PlayerInterface))
		   (PlayerInterface NIL doc                  (* name of class of this type associated with this 
							     DecisionMaker))
		   (InitializeIVs (bandits timeLeft players playerNames beginTime endTime timeLeft 
					   lastMoved loseTurn gameDuration startsAfter))
		   (AliceBonus 2))
   (InstanceVariables (gameParameters TruckinDMParameters)
		      (gameSeed NIL doc                      (* random number generator seed used for creating game)
				)
		      (simulator NIL doc                     (* instance of GameSimulator used by DecisionMaker)
				 )
		      (alices NIL doc                        (* actual AlicesRestaurant's on board))
		      (bandits NIL nextTime NIL doc          (* list of bandits currently on board.
							     nextTime is a list of locs to be used for placing 
							     bandits in next turn))
		      (lastMoved NIL doc                     (* last player who issued Move command))
		      (loseTurn NIL doc                      (* List of players that lose the next turn.)
				)
		      (players NIL doc                       (* List of the players for this simulation.)
			       )
		      (playerNames NIL doc                   (* list of names of players already in game)
				   )
		      (roadStops NIL doc                     (* same roadStops as in (gameBoard roadStops))
				 )
		      (unionHall NIL doc                     (* actual instance of UnionHall on board)
				 )
		      (beginTime 0 doc                       (* real clock time when game begins))
		      (endTime 0 doc                         (* real clock time when game ends))
		      (gameDuration 15 doc                   (* duration of game: endTime-beginTime))
		      (startsAfter 0 doc                     (* mins from now when game starts))
		      (timeLeft 1800 DefaultGauge SSDigiMeter DefaultLimit (0 1800)
				GaugePos
				(852 . 465)))]

[DEFCLASS TruckinPlayerInterface
   (MetaClass GameClass Edited:                              (* sm: "10-JUL-83 21:59"))
   (Supers GamePlayerInterface)
   (ClassVariables (CopyCV (DecisionMaker))
		   (DecisionMaker NIL doc                    (* name of associated DecisionMaker class)
				  )
		   (InitializeIVs (endTime beginTime unchargedTime lastMoved loseTurn localPlayers 
					   suspendedPlayers runningPlayer playerMenuWindow))
		   (MinMoveTime 1)
		   (MaxMoveTime 30))
   (InstanceVariables (localPlayers NIL doc                  (* list of players locally controlled by this PI)
				    )
		      (suspendedPlayers NIL doc              (* players suspended pending response from DM)
					)
		      (unchargedTime 0)
		      (roadStops NIL)
		      (lastMoved NIL)
		      (loseTurn NIL)
		      (beginTime 0)
		      (endTime 0)
		      (runningPlayer NIL doc                 (* player currently running))
		      (playerMenuWindow NIL position (650 . 720)
					doc                  (* Window for Menu to interrupt player processes)
					))]

[DEFCLASS TruckinSimulator
   (MetaClass GameClass Edited:                              (* dgb: "11-JUL-83 14:02"))
   (Supers GameSimulator)
   (ClassVariables (CopyCV)
		   (InitializeIVs (gameRunningFlg bandits timeLeft players unchargedTime beginTime 
						  endTime timeLeft barChart clock))
		   (AliceBonus 2))
   (InstanceVariables (barChart NIL doc                      (* barchart for players cash))
		      (gameBoard NIL doc DefaultClass BWTruckin 
                                                             (* instance of GameBoard))
		      (gameRunningFlg NIL doc                (* this flag is set to T when game starts and back to 
							     NIL when it ends))
		      (roadStops NIL doc                     (* same roadStops as in (gameBoard roadStops))
				 )
		      (alices NIL doc                        (* actual AlicesRestaurant's on board))
		      (bandits NIL nextTime NIL doc          (* list of bandits currently on board.
							     nextTime is a list of locs to be used for placing 
							     bandits in next turn))
		      (gameParameters TruckinParameters doc 
                                                             (* pointer to gameParameters object))
		      (players NIL doc                       (* List of the players for this simulation.)
			       )
		      (unchargedTime 0 doc                   (* time not charged because used by Execs or Breaks)
				     )
		      (unionHall NIL doc                     (* actual instance of UnionHall on board)
				 )
		      (beginTime 0)
		      (endTime 0)
		      (timeLeft 1800 DefaultGauge SSDigiMeter GaugeLimit (0 2000)
				GaugePos
				(852 . 465))
		      (clock NIL doc                         (* gauge attached to timeLeft)))]

(DEFINEQ

(MoveTruckinPI.BeginGame
  [LAMBDA (self players moves)                               (* sm: "27-JUN-83 11:03")

          (* * Starts a new game. Players is either the number of players or a list of Player objects.
	  If players is NIL, but the gameMaster has previous players, it uses those.)


    (PROG NIL
          [COND
	    ((NUMBERP moves)
	      (←@
		numMovesRemaining moves)
	      (PutValue self (QUOTE numMovesRemaining)
			T
			(QUOTE SetByUser]
          (RETURN (←Super
		    self BeginGame players])

(RemoteMasterComm.StartWorldProcess
  [LAMBDA (self)                                             (* edited: "12-JUL-83 12:27")
                                                             (* Starts world process)
    (PROG (hand)
          (DEL.PROCESS (FIND.PROCESS (QUOTE WorldProcess)))
          (SETQ hand (ADD.PROCESS (LIST (QUOTE ←)
					self
					(QUOTE WorldProcess))
				  (QUOTE NAME)
				  (QUOTE WorldProcess)
				  (QUOTE RESTARTABLE)
				  T))
          (←@
	    worldProcess hand)
          (←@
	    gameStarted T)
          (GameControlMenu)
          (RETURN hand])

(RemoteSlaveComm.StartWorldProcess
  [LAMBDA (self)                                             (* edited: "12-JUL-83 12:26")
                                                             (* Starts world process)
    (PROG (hand)
          (DEL.PROCESS (FIND.PROCESS (QUOTE WorldProcess)))
          (SETQ hand (ADD.PROCESS (LIST (QUOTE ←)
					self
					(QUOTE WorldProcess))
				  (QUOTE NAME)
				  (QUOTE WorldProcess)
				  (QUOTE RESTARTABLE)
				  T))
          (←@
	    worldProcess hand)
          (←@
	    gameStarted T)
          (GameControlMenu)
          (RETURN hand])

(SlaveTruckin
  [LAMBDA (displayFlg)                                       (* sm: "16-SEP-83 15:05")
                                                             (* Sets up the Slave M/c with or without display)
    [← ($ SlaveTruckin)
       New NIL NIL (COND
	 (displayFlg NIL)
	 (T (QUOTE NoDisplayTruckinS]
    (SETQ debugMode NIL)
    (SETQ PlayerProcRestFlg (QUOTE HARDRESET])

(TimeTruckinPI.BeginGame
  [LAMBDA (self players moves time)                          (* sm: "27-JUN-83 11:02")

          (* * Starts a new game. Players is either the number of players or a list of Player objects.
	  If players is NIL, but the gameMaster has previous players, it uses those.)


    (PROG NIL
          (COND
	    ((NUMBERP moves)
	      (←@
		avgNumMoves moves)))
          [COND
	    ((NUMBERP time)
	      (←@
		timeRemaining time)
	      (PutValue self (QUOTE timeRemaining)
			T
			(QUOTE SetByUser]
          (RETURN (←Super
		    self BeginGame players])

(TruckinCommInterface.NewInstance
  [LAMBDA (self)                                             (* sm: "27-JUN-83 15:39")
                                                             (* Received when new instance is created)
                                                             (* Any specialization must return self)
    (PROG NIL
          (←Super
	    self NewInstance)
          (RETURN self])
)

(RPAQQ GameBrowse (GameBoard GameSimulator GameDecisionMaker GameCommInterface GamePlayerInterface))

(RPAQQ GameProcRestFlg T)

(RPAQQ PlayerProcRestFlg HARDRESET)
[METH BWTruckin  InitializeGameWindow NIL
      (* Clears window and puts in proper background)]


[METH ColorTruckin  CreateGameBoard (region title)
      (* * Creates a new Window for the gameBoard.)]


[METH ColorTruckin  InitializeGameWindow (region)
      (* Initializes gamewindow and puts in proper background)]


[METH ColorTruckin  MakeDriveBitMaps NIL
      (* Creates Bit maps for Trucks)]


[METH DisplayTruckinS  NewGame (seed board)
      (* Generates a new game based on seed and board specified by DecisionMaster)]


[METH DisplayTruckinS  ReUseGame (seed)
      (* Sends message to GameBoard to reuse)]


[METH GameCommInterface  NewInstance (gameType boardType displayType dlist)
      (* Received when new instance is created)]


[METH GameDecisionMaker  NewInstance NIL
      (* Received when new instance is created)]


[METH GamePlayerInterface  ChangeGameParameters NIL
      (* Changes gameParameters via inspector)]


[METH GamePlayerInterface  NewInstance NIL
      (* Does initialization when created)]


[METH GameSimulator  NewInstance NIL
      (* Received when new instance is created)]


[METH MainCommInterface  AddBandit (name)
      (* Add bandit to game)]


[METH MainCommInterface  AddPlayer (reqID name type truck deniedFlg)
      (* Forwards to PI, Simulator, and DecisionMaker)]


[METH MainCommInterface  AddPlayerRequest (reqID name type truck)
      (* Forwards to DecisionMaker)]


[METH MainCommInterface  BeginGameRequest NIL
      (* Request for starting game - forwarded to DecisionMaker)]


[METH MainCommInterface  BreakCargo (playerName cargoPos)
      (* Forwards to Simulator)]


[METH MainCommInterface  BuyMade (playerName roadPosition reqQty qty reason penaltyAmt fragility 
lifetime)
      (* Forwards to Simulator)]


[METH MainCommInterface  BuyRequest (player roadPosition qty)
      (* Forwards to DecisionMaker)]


[METH MainCommInterface  GameOver NIL
      (* Sent to Simulator)]


[METH MainCommInterface  GasFill (prev new qty pr)
      (* Forwards to Simulator)]


[METH MainCommInterface  MaxMove (player maxMove)
      (* Forwards to Simulator)]


[METH MainCommInterface  MoveMade (playerName fromStop toStop reason penaltyAmount missTurns)
      (* Forwards to Simulator)]


[METH MainCommInterface  MoveRequest (player from to reason)
      (* Forwards to DecisionMaker)]


[METH MainCommInterface  NewGame (seed boardType gameType)
      (* Forwards to Simulator)]


[METH MainCommInterface  NewGameRequest (board)
      (* Forwards to DecisionMaker)]


[METH MainCommInterface  ParkedAtAlice (player time)
      (* Forwards to Simulator)]


[METH MainCommInterface  ReUseGame (seed)
      (* Forwards to Simulator and other recipients)]


[METH MainCommInterface  ReUseGameRequest NIL
      (* Forwards to DecisionMaker for reusing existing game board)]


[METH MainCommInterface  RemovePlayer (playerName reason)
      (* Forwards to Simulator)]


[METH MainCommInterface  RemovePlayerRequest (player reason)
      (* Request to remove player)]


[METH MainCommInterface  SellMade (playerName roadPosition reqQty qty cargoPos reason penaltyAmt)
      (* Forwards to Simulator, DecisionMaker, PlayerInterface)]


[METH MainCommInterface  SellRequest (player roadPosition commodityIndex qty)
      (* Forwards to DecisionMaker)]


[METH MainCommInterface  SetInitialParameters NIL
      (* Sets initial parameters)]


[METH MainCommInterface  SetUp (game board display)
      (* Sets up the Standard configuration)]


[METH MainCommInterface  SpoilCargo (playerName cargoPos)
      (* Forwards to Simulator)]


[METH MainCommInterface  StartGame (begTime endTime)
      (* Forwards to simulator, PI, DM, and then starts WorldProcess)]


[METH MainCommInterface  WorldProcess NIL
      (* This is the World Process)]


[METH MoveTruckinDM  InitializeGameParameters NIL
      (* Initializes critical variables for new game to run)]


[METH MoveTruckinDM  MoveBandits NIL
      (* randomly moves bandits around on the board before each turn)]


[METH MoveTruckinPI  RunGame (players)
      (* This is the main loop that runs the game)]


[METH NoDisplayTruckinS  AttachBoard (gameBoard)
      (* Attaches gameBoard to game)]


[METH NoDisplayTruckinS  DrivePlayer (curLoc finalLoc player)
      (* Noop for NoDisplay case)]


[METH NoDisplayTruckinS  UpdateRS (roadStop)
      (* Sent when any RoadStop's data changes)]


[METH RemoteMasterComm  AddBandit (name)
      (* Add bandit to game)]


[METH RemoteMasterComm  AddPlayer (reqID name type truck deniedFlg)
      (* Forwards to PI, Simulator, and DecisionMaker)]


[METH RemoteMasterComm  AddPlayerRequest (reqID name type truck)
      (* Forwards to DecisionMaker)]


[METH RemoteMasterComm  BeginGameRequest NIL
      (* Request for starting game - forwarded to DecisionMaker)]


[METH RemoteMasterComm  BreakCargo (playerName cargoPos)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  BuyMade (playerName roadPosition reqQty qty reason penaltyAmt fragility 
lifetime)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  BuyRequest (player roadPosition qty)
      (* Forwards to DecisionMaker)]


[METH RemoteMasterComm  GameOver NIL
      (* Sent to Simulator)]


[METH RemoteMasterComm  GasFill (prev new qty pr)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  InterimWorldProcess NIL
      (* Interim world process)]


[METH RemoteMasterComm  MaxMove (player maxMove)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  MoveMade (playerName fromStop toStop reason penaltyAmount missTurns)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  MoveRequest (player from to reason)
      (* Forwards to DecisionMaker)]


[METH RemoteMasterComm  NewGame (seed boardType gameType)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  NewGameRequest (board)
      (* Forwards to DecisionMaker)]


[METH RemoteMasterComm  ParkedAtAlice (player time)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  ReUseGame (seed)
      (* Forwards to Simulator and other recipients)]


[METH RemoteMasterComm  ReUseGameRequest NIL
      (* Forwards to DecisionMaker for reusing existing game board)]


[METH RemoteMasterComm  RemovePlayer (playerName reason)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  RemovePlayerRequest (player reason)
      (* Request to remove player)]


[METH RemoteMasterComm  SellMade (playerName roadPosition reqQty qty cargoPos reason penaltyAmt)
      (* Forwards to Simulator, DecisionMaker, PlayerInterface)]


[METH RemoteMasterComm  SellRequest (player roadPosition commodityIndex qty)
      (* Forwards to DecisionMaker)]


[METH RemoteMasterComm  SetInitialParameters NIL
      (* Sets initial parameters)]


[METH RemoteMasterComm  SetUp (game board display)
      (* Sets up the Standard configuration)]


[METH RemoteMasterComm  SpoilCargo (playerName cargoPos)
      (* Forwards to Simulator)]


[METH RemoteMasterComm  StartGame (begTime endTime)
      (* Forwards to simulator, PI, DM, and then starts WorldProcess)]


[METH RemoteMasterComm  StartInterimWorldProcess NIL
      (* Starts Interim World Process)]


[METH RemoteMasterComm  WorldProcess NIL
      (* This is the World Process.)]


[METH RemoteSlaveComm  AddBandit (name)
      (* Add bandit to game)]


[METH RemoteSlaveComm  AddPlayer (reqID name type truck deniedFlg)
      (* Forwards to PI, Simulator, and DecisionMaker)]


[METH RemoteSlaveComm  AddPlayerRequest (reqID name type truck)
      (* Forwards to DecisionMaker)]


[METH RemoteSlaveComm  BeginGameRequest NIL
      (* Blocks it.)]


[METH RemoteSlaveComm  BreakCargo (playerName cargoPos)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  BuyMade (playerName roadPosition reqQty qty reason penaltyAmt fragility 
lifetime)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  BuyRequest (player roadPosition qty)
      (* Forwards to DecisionMaker)]


[METH RemoteSlaveComm  GameOver NIL
      (* Sent to Simulator)]


[METH RemoteSlaveComm  GasFill (prev new qty pr)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  InterimWorldProcess NIL
      (* Interim world process)]


[METH RemoteSlaveComm  MaxMove (player maxMove)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  MoveMade (playerName fromStop toStop reason penaltyAmount missTurns)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  MoveRequest (player from to reason)
      (* Forwards to DecisionMaker)]


[METH RemoteSlaveComm  NewGame (seed boardType gameType)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  NewGameRequest (board)
      (* Blocks it)]


[METH RemoteSlaveComm  ParkedAtAlice (player time)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  ReUseGame (seed)
      (* Forwards to Simulator and other recipients)]


[METH RemoteSlaveComm  ReUseGameRequest NIL
      (* Blocks it)]


[METH RemoteSlaveComm  RemovePlayer (playerName reason)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  RemovePlayerRequest (player reason)
      (* Request to remove player)]


[METH RemoteSlaveComm  SellMade (playerName roadPosition reqQty qty cargoPos reason penaltyAmt)
      (* Forwards to Simulator, DecisionMaker, PlayerInterface)]


[METH RemoteSlaveComm  SellRequest (player roadPosition commodityIndex qty)
      (* Forwards to DecisionMaker)]


[METH RemoteSlaveComm  SetInitialParameters NIL
      (* Sets initial parameters)]


[METH RemoteSlaveComm  SetUp (game board display)
      (* Sets up the Standard configuration)]


[METH RemoteSlaveComm  SpoilCargo (playerName cargoPos)
      (* Forwards to Simulator)]


[METH RemoteSlaveComm  StartGame (begTime endTime)
      (* Forwards to simulator, PI, DM, and then starts WorldProcess)]


[METH RemoteSlaveComm  StartInterimWorldProcess NIL
      (* Starts Interim World Process)]


[METH RemoteSlaveComm  WorldProcess NIL
      (* This is the World Process)]


[METH TimeTruckinDM  ChargeTime (player clockTime)
      (* Calculates the actual time to be charged to player)]


[METH TimeTruckinDM  CheckAlice (player)
      (* check AlicesRestaurant's before each turn)]


[METH TimeTruckinDM  InitializeGameParameters NIL
      (* Initializes critical variables for new game to run)]


[METH TimeTruckinDM  MoveBandits NIL
      (* randomly moves bandits around on the board before each turn)]


[METH TimeTruckinDM  RedoGameParameters NIL
      (* Change game parameters based on players in the game)]


[METH TimeTruckinDM  ReplenishQty NIL
      (* Checks if time to replenish)]


[METH TimeTruckinPI  RunGame (players)
      (* This is the main loop that runs the game)]


[METH TruckinBoard  AssignRoadStops NIL
      (* * Assign RoadStops to the current GameBoard)]


[METH TruckinBoard  AttachToGame (game)
      (* attaches self to game)]


[METH TruckinBoard  CreateGameBoard (region title)
      (* * Creates a new Window for the gameBoard.)]


[METH TruckinBoard  DisplayGameBoard NIL
      (* * Displays the gameBoard. ReAllocates gameBoard window if needed.)]


[METH TruckinBoard  DrawRoadMarks NIL
      (* * Draw the dotted Lines in the road above the RoadStops.)
      (method DrawRoadMarks)]


[METH TruckinBoard  InitializeRoadStops (seed)
      (* Initializes RoadStop qty and pr)]


[METH TruckinBoard  MakeDriveBitMaps NIL
      (* Creates Bit maps for Trucks)]


[METH TruckinBoard  NewBoard (seed)
      (* Creates and displays a new game board)]


[METH TruckinBoard  PlaceRoadStops NIL
      (* mjs: "17-JAN-83 10:34")]


[METH TruckinBoard  ReInitializeRoadStops (seed)
      (* Reinitializes roadstops)]


[METH TruckinBoard  ReUseBoard (seed)
      (* Reuses game board: displaying afresh)]


[METH TruckinBoard  RemovePlayer (player)
      (* Sent to game board so it can remove player from board)]


[METH TruckinCommInterface  CleanGameWorld NIL
      (* Cleans up the game world after game over)]


[METH TruckinCommInterface  CreateDecisionMaker (game)
      (* Creates a new DecisionMaker)]


[METH TruckinCommInterface  CreateGateWay (machineName postalAddress)
      (* creates a gateway and links it)]


[METH TruckinCommInterface  CreatePlayerInterface (gameType)
      (* Create a PlayerInterface (if needed)
	 matching gameType)]


[METH TruckinCommInterface  CreateSimulator (display)
      (* Creates a new simulator)]


[METH TruckinCommInterface  SetInitialParameters NIL
      (* Sets initial parameters)]


[METH TruckinCommInterface  StartWorldProcess NIL
      (* Starts world process)]


[METH TruckinCommInterface  TellMe (obj)
      (* Adds obj to broadcastList)]


[METH TruckinDecisionMaker  AddBandit (name)
      (* Add bandit to list)]


[METH TruckinDecisionMaker  AddPlayer (reqID name type truck deniedFlg)
      (* If player added, do initial placing for him)]


[METH TruckinDecisionMaker  AddPlayerRequest (reqID name type truck)
      (* Decides if a new player can be added or not)]


[METH TruckinDecisionMaker  AttachSimulator (sim)
      (* Attaches local simulator by copying relevant info)]


[METH TruckinDecisionMaker  BeginGameRequest NIL
      (* Starts the game)]


[METH TruckinDecisionMaker  BuyMade (player roadPosition reqQty qty reason penaltyAmt fragility 
lifetime)
      (* Dummy for now)]


[METH TruckinDecisionMaker  BuyRequest (player roadPosition qty)
      (* message sent to DecisionMaker to BUY qty at roadPosition)]


[METH TruckinDecisionMaker  ChangeGameParameters NIL
      (* Changes gameParameters via inspector)]


[METH TruckinDecisionMaker  CheckAlice NIL
      (* check AlicesRestaurant's before each turn)]


[METH TruckinDecisionMaker  ForcedMove (player curLoc maxMilePost reason)
      (* determines the loc to move currentPlayer as a forced move close to maxMilePost)]


[METH TruckinDecisionMaker  GameOver NIL
      (* Sent when game is over)]


[METH TruckinDecisionMaker  GiveAliceBonus (atAlice)
      (* Dummy method)]


[METH TruckinDecisionMaker  InitializeGameParameters NIL
      (* Initializes critical variables for new game to run)]


[METH TruckinDecisionMaker  MonitorGame (gameOverFlg)
      (* Monitors the game to move bandits, replenish qty, check alice, and signal game end.)]


[METH TruckinDecisionMaker  MonitorProcess NIL
      (* Monitors the game to move bandits, replenish qty, check alice, and signal game end)]


[METH TruckinDecisionMaker  MoveBandits NIL
      (* randomly moves bandits around on the board before each turn)]


[METH TruckinDecisionMaker  MoveCheckingHazards (player curLoc newLoc reason)
      (* moves truck checking for hazards along the way. Called by GameMaster.MoveTruck)]


[METH TruckinDecisionMaker  MoveMade (player fromStop toStop reason penaltyAmount missTurns)
      (* Generates new MaxMove for player and checks for Alice overstay)]


[METH TruckinDecisionMaker  MoveRequest (player from to reason)
      (* sent to DecisionMaker for deciding if move can be made)]


[METH TruckinDecisionMaker  MoveTruck (player curLoc newLoc reason)
      (* actually moves the currentPlayer's truck)]


[METH TruckinDecisionMaker  NewGameRequest (board)
      (* Generates seed for a new game)]


[METH TruckinDecisionMaker  ReUseGameRequest NIL
      (* Generates a new seed for reusing existing game)]


[METH TruckinDecisionMaker  RedoGameParameters NIL
      (* Dummy. Needed if some game parameters need to be changed after the players are known)]


[METH TruckinDecisionMaker  RemovePlayer (player reason)
      (* removes player from game)]


[METH TruckinDecisionMaker  RemovePlayerRequest (player reason)
      (* Request to remove player)]


[METH TruckinDecisionMaker  ReplenishQty NIL
      (* replenish GasStations qty)]


[METH TruckinDecisionMaker  SellMade (player roadPosition reqQty qty cargoPos reason penaltyAmt)
      (* Dummy for now)]


[METH TruckinDecisionMaker  SellRequest (player roadPosition commodityIndex qty)
      (* message sent to DecisionMaker to sell qty of commodity at the player's roadPosition.)]


[METH TruckinDecisionMaker  StartGame NIL
      (* Starts game)]


[METH TruckinDecisionMaker  StartMonitorProcess NIL
      (* Start the monitor process)]


[METH TruckinDecisionMaker  UpdateAlice (player)
      (* Decides when parked at Alice)]


[METH TruckinPlayerInterface  AddPlayer (reqID name type truck deniedFlg)
      (* New player being added to game)]


[METH TruckinPlayerInterface  AddPlayerRequest (playerName playerType truckType)
      (* A request to create a new Player)]


[METH TruckinPlayerInterface  BeginGame (players moves)
      (* * Starts a new game. Players is either the number of players or a list of Player objects. If 
	 players is NIL, but the gameMaster has previous players, it uses those.)]


[METH TruckinPlayerInterface  Buy (player qty)
      (* message sent by currentPlayer to BUY qty at its current location)]


[METH TruckinPlayerInterface  BuyMade (player roadPosition reqQty qty reason penaltyAmt fragility 
lifetime)
      (* check if for local player)]


[METH TruckinPlayerInterface  ChargeTime (player clockTime)
      (* Calculates the actual time to be charged to player)]


[METH TruckinPlayerInterface  CheckLocalPlayers NIL
      (* Checks to make sure that all local players have processes)]


[METH TruckinPlayerInterface  ContinueGame (noRedrawFlg)
      (* to resume a game in the middle.)]


[METH TruckinPlayerInterface  CreatePlayerProcess (player staySuspendFlg)
      (* Creates a process for player and suspends the process)]


[METH TruckinPlayerInterface  DeletePlayerProcesses NIL
      (* Deletes players processes after the game)]


[METH TruckinPlayerInterface  Move (player newLoc)
      (* sent by to move to newLoc)]


[METH TruckinPlayerInterface  MoveMade (player fromStop toStop reason penaltyAmount missTurns)
      (* check if for local player)]


[METH TruckinPlayerInterface  NewGame (seed boardType gameType)
      (* Adds roadStops locally)]


[METH TruckinPlayerInterface  NewGameRequest (board)
      (* Request for creating a new game of existing type)]


[METH TruckinPlayerInterface  PlayerRequestComplete (player reason)
      (* if player passed as arg, set wakeReason)]


[METH TruckinPlayerInterface  ReUseGame NIL
      (* Received when the current board is used for a new game)]


[METH TruckinPlayerInterface  RemovePlayer (player reason)
      (* New method template)]


[METH TruckinPlayerInterface  RemovePlayerRequest (player reason)
      (* Request to remove player)]


[METH TruckinPlayerInterface  RunNextPlayer NIL
      (* Decides who to run next -)]


[METH TruckinPlayerInterface  ScheduleNextPlayer NIL
      (* Decides who to run next -)]


[METH TruckinPlayerInterface  SelectPlayers (players)
      (* Asks user to select players)]


[METH TruckinPlayerInterface  Sell (player commodity qty)
      (* message sent by currentPlayer to sell qty of commodity at the player's current location.)]


[METH TruckinPlayerInterface  SellMade (player roadPosition reqQty qty cargoPos reason penaltyAmt)
      (* check if for local player)]


[METH TruckinPlayerInterface  StartGame (begTime endTime)
      (* Starts the game at begTime)]


[METH TruckinPlayerInterface  StartPlayerProcesses NIL
      (* starts players in separate processes)]


[METH TruckinPlayerInterface  SuspendPlayer (player staySuspend)
      (* Suspends player after a Buy/Move/Sell request)]


[METH TruckinPlayerInterface  WakePlayer (player)
      (* Wakes player so it can be run at next BLOCK)]


[METH TruckinSimulator  AddBandit (name)
      (* Add bandit to game)]


[METH TruckinSimulator  AddPlayer (reqID name type truck deniedFlg)
      (* Adds player to its list - assumes player created by PlayerInterface)]


[METH TruckinSimulator  AttachBoard (gameBoard)
      (* Attaches gameBoard to game)]


[METH TruckinSimulator  BreakCargo (player commodIndex)
      (* Sent by a commodity when it breaks)]


[METH TruckinSimulator  BuyMade (player roadPosition reqQty qty reason penalty fragility lifetime)
      (* Indicates a definite BUY to be made, or reasons for not carrying out a BuyRequest)]


[METH TruckinSimulator  ClockProcess NIL
      (* Monitors game clock)]


[METH TruckinSimulator  DrivePlayer (curLoc finalLoc player)
      (* Drives player from curLoc to finalLoc)]


[METH TruckinSimulator  GameOver NIL
      (* Game Over)]


[METH TruckinSimulator  GasFill (prevStop gsStop qty pr)
      (* Instructions for moving a gas truck and filling GasStation)]


[METH TruckinSimulator  GiveAliceBonus (atAlice)
      (* Give bonus for reaching Alices)]


[METH TruckinSimulator  Initialize NIL
      (* Initializes)]


[METH TruckinSimulator  MaxMove (player maxMove)
      (* Puts maxMove in player)]


[METH TruckinSimulator  MoveMade (player from to reason penaltyAmt missTurn)
      (* Actually makes the move after all checks are done)]


[METH TruckinSimulator  NewGame (seed board)
      (* Generates a new game based on seed and board specified by DecisionMaster)]


[METH TruckinSimulator  ParkedAtAlice (player time)
      (* Marks when player parked at alice)]


[METH TruckinSimulator  ReUseGame (seed)
      (* Sends message to GameBoard to reuse)]


[METH TruckinSimulator  RedoGameParameters NIL
      (* Change anything after all game info is known - prior to game start)]


[METH TruckinSimulator  RemovePlayer (player reason)
      (* Sent to game board so it can remove player from board)]


[METH TruckinSimulator  SellMade (player roadPosition reqQty qty cargoPosition reason penalty)
      (* Performs an actual Sell, once all checking is done)]


[METH TruckinSimulator  SetUpGauges NIL
      (* Sets up gauges)]


[METH TruckinSimulator  SpoilCargo (player commodIndex)
      (* Sent by commodity when it spoils)]


[METH TruckinSimulator  StartClockProcess NIL
      (* Starts the clock process)]


[METH TruckinSimulator  StartGame (begTime endTime)
      (* SetsUp IVs for time left etc and starts game clock process)]


[METH TruckinSimulator  UnattachBoard NIL
      (* Removes game board)]


[METH TruckinSimulator  UpdateRS (roadStop)
      (* Sent when any RoadStop's data changes)]


[METH TruckinSimulator  WhoWon NIL
      (* summarizes the game results)]


(DEFINEQ

(BWTruckin.InitializeGameWindow
  (Method ((BWTruckin InitializeGameWindow)
	   self)                                             (* sm: "29-JUN-83 15:52")
                                                             (* Clears window and puts in proper background)
	  (CLEARW (@ gameWindow))
	  (BITBLT NIL NIL NIL (@ gameWindow)
		  NIL NIL NIL NIL (QUOTE TEXTURE)
		  (QUOTE REPLACE)
		  boardShade)))

(ColorTruckin.CreateGameBoard
  (Method ((ColorTruckin CreateGameBoard)
	   self region title)                                (* sm: " 5-JUL-83 18:37")

          (* * Creates a new Window for the gameBoard.)


	  (PROG (screen)
	        [COND
		  ((OR (NULL (COLORDISPLAYP))
		       (NULL (SETQ screen (COLORSCREENBITMAP)))
		       (NEQ 4 (fetch (BITMAP BITMAPBITSPERPIXEL) of screen)))
		    (COLORDISPLAY T 4)
		    (SETQ screen (COLORSCREENBITMAP]
	        (SETQ gameWindow (DSPCREATE screen))
	        (←@
		  gameWindow gameWindow)
	        (← self InitializeGameWindow region)
	        (← self MakeDriveBitMaps)
	        (RETURN gameWindow))))

(ColorTruckin.InitializeGameWindow
  (Method ((ColorTruckin InitializeGameWindow)
	   self region)                                      (* sm: " 5-JUL-83 18:37")
                                                             (* Initializes gamewindow and puts in proper 
							     background)
	  (PROG NIL
	        (SETQ gameWindow (@ gameWindow))
	        (BITBLT NIL NIL NIL gameWindow NIL NIL NIL NIL (QUOTE TEXTURE)
			(QUOTE REPLACE)
			borderColor)
	        (DSPXOFFSET (IQUOTIENT (IDIFFERENCE 640 (fetch (REGION WIDTH) of region))
				       2)
			    gameWindow)
	        (DSPYOFFSET (IQUOTIENT (IDIFFERENCE 480 (fetch (REGION HEIGHT) of region))
				       2)
			    gameWindow)
	        (DSPCLIPPINGREGION (create REGION
					   LEFT ← 0
					   BOTTOM ← 0
					   WIDTH ←(fetch (REGION WIDTH) of region)
					   HEIGHT ←(fetch (REGION HEIGHT) of region))
				   gameWindow)
	        (BITBLT NIL NIL NIL gameWindow NIL NIL NIL NIL (QUOTE TEXTURE)
			(QUOTE REPLACE)
			roadColor)
	        (RETURN gameWindow))))

(ColorTruckin.MakeDriveBitMaps
  (Method ((ColorTruckin MakeDriveBitMaps)
	   self)                                             (* sm: "27-JUN-83 17:33")
                                                             (* Creates Bit maps for Trucks)
	  (MakeDriveBitMaps 4)))

(DisplayTruckinS.NewGame
  (Method ((DisplayTruckinS NewGame)
	   self seed board)                                  (* sm: "28-JUN-83 09:13")
                                                             (* Generates a new game based on seed and board 
							     specified by DecisionMaster)
	  (←Super
	    self NewGame seed board)
	  (← (@ gameBoard)
	     DisplayGameBoard)))

(DisplayTruckinS.ReUseGame
  (Method ((DisplayTruckinS ReUseGame)
	   self seed)                                        (* sm: " 1-JUL-83 18:14")
                                                             (* Sends message to GameBoard to reuse)
	  (←Super
	    self ReUseGame seed)
	  (← (@ gameBoard)
	     DisplayGameBoard)))

(GameCommInterface.NewInstance
  (Method ((GameCommInterface NewInstance)
	   self gameType boardType displayType dlist)        (* dgb: "22-SEP-83 15:16")
                                                             (* Received when new instance is created)
                                                             (* Any specialization must return self)
	  (←Super
	    self NewInstance)
	  (SETQ Communicator self)                           (* gameType -
							     type of Game)
                                                             (* boardType -
							     type of board, e.g., BW or Color)
                                                             (* displayType -
							     type of display, e.g., Display or Silent)
                                                             (* dlist -
							     broadcastList)
	  (←@
	    broadcastList dlist)
	  (← self SetUp gameType boardType displayType)
	  self))

(GameDecisionMaker.NewInstance
  (Method ((GameDecisionMaker NewInstance)
	   self)                                             (* dgb: "22-SEP-83 15:17")
                                                             (* Received when new instance is created)
                                                             (* Any specialization must return self)
	  (←Super
	    self NewInstance)))

(GamePlayerInterface.ChangeGameParameters
  (Method ((GamePlayerInterface ChangeGameParameters)
	   self)                                             (* sm: "29-JUN-83 13:45")
                                                             (* Changes gameParameters via inspector)
	  (PROG (gp)
	        (SETQ gp (GetItHere self (QUOTE gameParameters)))
	        (COND
		  ((EQ gp NotSetValue)
		    (SETQ gp (← (GetObjectRec (@ gameParameters))
				New))
		    (←@
		      gameParameters gp)))
	        (PROMPT "Change Game Parameters by using the displayed Inspector." 
			"When done, click DONE")
	        (← gp SetUp)
	        (while (NOT GameParaSet)
		   do (TOTOPW GameParamW)
		      (TOTOPW GameCommandW)
		      (DISMISS 500))
	        (RETURN T))))

(GamePlayerInterface.NewInstance
  (Method ((GamePlayerInterface NewInstance)
	   self)                                             (* dgb: "22-SEP-83 15:15")
                                                             (* Does initialization when created)
                                                             (* Any specialization must return self)
                                                             (* later may set gameMaster to self too)
	  (←Super
	    self NewInstance)
	  (SETQ gameMaster self)))

(GameSimulator.NewInstance
  (Method ((GameSimulator NewInstance)
	   self)                                             (* dgb: "22-SEP-83 15:17")
                                                             (* Received when new instance is created)
                                                             (* Any specialization must return self)
	  (←Super
	    self NewInstance)))

(MainCommInterface.AddBandit
  (Method ((MainCommInterface AddBandit)
	   self name)                                        (* sm: "10-JUL-83 18:38")
                                                             (* Add bandit to game)
	  (← (@ simulator)
	     AddBandit name)
	  (← (@ decisionMaker)
	     AddBandit name)
	  (MailOut self (LIST (QUOTE AddBandit)
			      name))))

(MainCommInterface.AddPlayer
  (Method ((MainCommInterface AddPlayer)
	   self reqID name type truck deniedFlg)             (* sm: "10-JUL-83 18:40")
                                                             (* Forwards to PI, Simulator, and DecisionMaker)
	  (← (@ playerInterface)
	     AddPlayer reqID name type truck deniedFlg)
	  (← (@ simulator)
	     AddPlayer reqID name type truck deniedFlg)
	  (MailOut self (LIST (QUOTE AddPlayer)
			      reqID name type truck deniedFlg))
	  (← (@ decisionMaker)
	     AddPlayer reqID name type truck deniedFlg)))

(MainCommInterface.AddPlayerRequest
  (Method ((MainCommInterface AddPlayerRequest)
	   self reqID name type truck)                       (* sm: "30-JUN-83 17:33")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     AddPlayerRequest reqID name type truck)))

(MainCommInterface.BeginGameRequest
  (Method ((MainCommInterface BeginGameRequest)
	   self)                                             (* sm: " 1-JUL-83 17:13")
                                                             (* Request for starting game -
							     forwarded to DecisionMaker)
	  (← (@ decisionMaker)
	     BeginGameRequest)))

(MainCommInterface.BreakCargo
  (Method ((MainCommInterface BreakCargo)
	   self playerName cargoPos)                         (* sm: "10-JUL-83 18:41")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     BreakCargo playerName cargoPos)
	  (MailOut self (LIST (QUOTE BreakCargo)
			      (GetObjectRec playerName)
			      cargoPos))))

(MainCommInterface.BuyMade
  (Method ((MainCommInterface BuyMade)
	   self playerName roadPosition reqQty qty reason penaltyAmt fragility lifetime)
                                                             (* sm: "10-JUL-83 18:42")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (← (@ decisionMaker)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (← (@ playerInterface)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (MailOut self (LIST (QUOTE BuyMade)
			      (GetObjectRec playerName)
			      roadPosition reqQty qty reason penaltyAmt fragility lifetime))))

(MainCommInterface.BuyRequest
  (Method ((MainCommInterface BuyRequest)
	   self player roadPosition qty)                     (* sm: " 5-JUL-83 17:22")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     BuyRequest
	     (GetObjectRec player)
	     roadPosition qty)))

(MainCommInterface.GameOver
  (Method ((MainCommInterface GameOver)
	   self)                                             (* sm: "12-JUL-83 22:09")
                                                             (* Sent to Simulator)
	  (← (@ simulator)
	     GameOver)
	  (MailOut self (LIST (QUOTE GameOver)))
	  (←@
	    gameStarted NIL)))

(MainCommInterface.GasFill
  (Method ((MainCommInterface GasFill)
	   self prev new qty pr)                             (* sm: "10-JUL-83 18:44")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     GasFill prev new qty pr)
	  (MailOut self (LIST (QUOTE GasFill)
			      prev new qty pr))))

(MainCommInterface.MaxMove
  (Method ((MainCommInterface MaxMove)
	   self player maxMove)                              (* sm: "10-JUL-83 18:45")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     MaxMove player maxMove)
	  (MailOut self (LIST (QUOTE MaxMove)
			      (GetObjectRec player)
			      maxMove))))

(MainCommInterface.MoveMade
  (Method ((MainCommInterface MoveMade)
	   self playerName fromStop toStop reason penaltyAmount missTurns)
                                                             (* sm: "13-JUL-83 09:17")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (← (@ decisionMaker)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (← (@ playerInterface)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (MailOut self (LIST (QUOTE MoveMade)
			      (GetObjectRec playerName)
			      fromStop toStop reason penaltyAmount missTurns))
	  (← (@ decisionMaker)
	     UpdateAlice
	     (GetObjectRec playerName))))

(MainCommInterface.MoveRequest
  (Method ((MainCommInterface MoveRequest)
	   self player from to reason)                       (* sm: " 5-JUL-83 17:21")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     MoveRequest
	     (GetObjectRec player)
	     from to reason)))

(MainCommInterface.NewGame
  (Method ((MainCommInterface NewGame)
	   self seed boardType gameType)                     (* sm: "10-JUL-83 18:47")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     NewGame seed boardType gameType)
	  (← self CreatePlayerInterface gameType)
	  (← (@ playerInterface)
	     NewGame seed boardType gameType)
	  (MailOut self (LIST (QUOTE NewGame)
			      seed boardType gameType))))

(MainCommInterface.NewGameRequest
  (Method ((MainCommInterface NewGameRequest)
	   self board)                                       (* sm: "29-JUN-83 13:12")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     NewGameRequest board)))

(MainCommInterface.ParkedAtAlice
  (Method ((MainCommInterface ParkedAtAlice)
	   self player time)                                 (* sm: "10-JUL-83 18:48")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     ParkedAtAlice player time)
	  (MailOut self (LIST (QUOTE ParkedAtAlice)
			      (GetObjectRec player)
			      time))))

(MainCommInterface.ReUseGame
  (Method ((MainCommInterface ReUseGame)
	   self seed)                                        (* sm: "10-JUL-83 19:20")
                                                             (* Forwards to Simulator and other recipients)
	  (← (@ simulator)
	     ReUseGame seed)
	  (← (@ playerInterface)
	     ReUseGame)
	  (MailOut self (LIST (QUOTE ReUseGame)
			      seed))))

(MainCommInterface.ReUseGameRequest
  (Method ((MainCommInterface ReUseGameRequest)
	   self)                                             (* sm: "29-JUN-83 14:21")
                                                             (* Forwards to DecisionMaker for reusing existing game 
							     board)
	  (← (@ decisionMaker)
	     ReUseGameRequest)))

(MainCommInterface.RemovePlayer
  (Method ((MainCommInterface RemovePlayer)
	   self playerName reason)                           (* sm: "10-JUL-83 19:21")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     RemovePlayer playerName reason)
	  (← (@ playerInterface)
	     RemovePlayer playerName reason)
	  (MailOut self (LIST (QUOTE RemovePlayer)
			      (GetObjectRec playerName)
			      reason))))

(MainCommInterface.RemovePlayerRequest
  (Method ((MainCommInterface RemovePlayerRequest)
	   self player reason)                               (* sm: "10-JUL-83 21:03")
                                                             (* Request to remove player)
	  (← (@ decisionMaker)
	     RemovePlayerRequest player reason)))

(MainCommInterface.SellMade
  (Method ((MainCommInterface SellMade)
	   self playerName roadPosition reqQty qty cargoPos reason penaltyAmt)
                                                             (* sm: "10-JUL-83 19:22")
                                                             (* Forwards to Simulator, DecisionMaker, 
							     PlayerInterface)
	  (← (@ simulator)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (← (@ decisionMaker)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (← (@ playerInterface)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (MailOut self (LIST (QUOTE SellMade)
			      (GetObjectRec playerName)
			      roadPosition reqQty qty cargoPos reason penaltyAmt))))

(MainCommInterface.SellRequest
  (Method ((MainCommInterface SellRequest)
	   self player roadPosition commodityIndex qty)      (* sm: " 5-JUL-83 17:22")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     SellRequest
	     (GetObjectRec player)
	     roadPosition commodityIndex qty)))

(MainCommInterface.SetInitialParameters
  (Method ((MainCommInterface SetInitialParameters)
	   self)                                             (* sm: "10-JUL-83 20:16")
                                                             (* Sets initial parameters)
	  (←@(@ decisionMaker)
	    startsAfter 0)))

(MainCommInterface.SetUp
  (Method ((MainCommInterface SetUp)
	   self game board display)                          (* sm: "10-JUL-83 19:37")
                                                             (* Sets up the Standard configuration)
                                                             (* ARGS: If NIL, then default.
							     If T, then ask user, else use the passed arg)
	  (← self CreateDecisionMaker game)
	  (← self CreateSimulator display)
	  (← self SetInitialParameters)                      (* sends a request to DecisionMaker to create a new 
							     game)
	  (← (@ decisionMaker)
	     NewGameRequest board)))

(MainCommInterface.SpoilCargo
  (Method ((MainCommInterface SpoilCargo)
	   self playerName cargoPos)                         (* sm: "10-JUL-83 19:22")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     SpoilCargo playerName cargoPos)
	  (MailOut self (LIST (QUOTE SpoilCargo)
			      (GetObjectRec playerName)
			      cargoPos))))

(MainCommInterface.StartGame
  (Method ((MainCommInterface StartGame)
	   self begTime endTime)                             (* sm: "10-JUL-83 19:23")
                                                             (* Forwards to simulator, PI, DM, and then starts 
							     WorldProcess)
	  (← (@ simulator)
	     StartGame begTime endTime)
	  (← (@ playerInterface)
	     StartGame begTime endTime)
	  (← (@ decisionMaker)
	     StartGame begTime endTime)                      (* start the WorldProcess)
	  (← self StartWorldProcess)
	  (MailOut self (LIST (QUOTE StartGame)
			      begTime endTime))))

(MainCommInterface.WorldProcess
  [Method ((MainCommInterface WorldProcess)
	   self)                                             (* sm: "16-SEP-83 17:17")
                                                             (* This is the World Process)
	  (PROG ([endTime (SETUPTIMER.DATE (GDATE (IPLUS (@ Simulator endTime)
							 1]
		 cTime pendReq)                              (* Wait till it is 2 secs before game)
	        [BLOCK NIL (SETUPTIMER (IntervalToEvent (@ Simulator beginTime]
                                                             (* ask PI to start User Processes)
                                                             (* (← (@ playerInterface) StartPlayerProcesses))
	        (← (@ decisionMaker)
		   RedoGameParameters)
	        (← (@ simulator)
		   RedoGameParameters)                       (* Start the loop for checking messages from PI)
	        (PutValue (@ simulator)
			  (QUOTE timeLeft)
			  (IDIFFERENCE (@(@ simulator)
					 endTime)
				       (IDATE)))
	        (←@(@ playerInterface)
		  runningPlayer NIL)
	        (← (@ playerInterface)
		   CheckLocalPlayers)
	        (until (TIMEREXPIRED? endTime (QUOTE SECONDS))
		   do (← (@ playerInterface)
			 ScheduleNextPlayer)
		      (BLOCK)                                (* this will enable the Scheduler to consider all 
							     players next time around. Needed only for Single Mc 
							     case)
		      (for x in (@(@ playerInterface)
				  suspendedPlayers)
			 do (←@
			      x staySuspend NIL))
		      (← (@ decisionMaker)
			 MonitorGame))                       (* Game is over)
	        (← (@ decisionMaker)
		   MonitorGame T)
	        (←@
		  gameStarted NIL)
	        (← self CleanGameWorld)
	        (RETURN (QUOTE Done])

(MoveTruckinDM.InitializeGameParameters
  [Method ((MoveTruckinDM InitializeGameParameters)
	   self)                                             (* sm: " 1-JUL-83 15:54")
                                                             (* Initializes critical variables for new game to run)
	  (←Super
	    self InitializeGameParameters)
	  [COND
	    ((EQ (@ self numMovesRemaining SetByUser)
		 T)
	      (PutValue self (QUOTE numMovesRemaining)
			NIL
			(QUOTE SetByUser)))
	    (T (←@
		 numMovesRemaining
		 (GetInitialValue self (QUOTE numMovesRemaining]
	  (WriteGameStatus (DATE)
			   "  New Simulation! 
"
			   (CONCAT "Total Moves: " (@ numMovesRemaining])

(MoveTruckinDM.MoveBandits
  [Method ((MoveTruckinDM MoveBandits)
	   self)                                             (* sm: "27-JUN-83 10:55")
                                                             (* randomly moves bandits around on the board before 
							     each turn)
	  (COND
	    ((ZEROP (IMOD (@ numMovesRemaining)
			  (@ banditFreq)))                   (* Only move once in a while if you are a bandit)
	      (←Super
		self MoveBandits])

(MoveTruckinPI.RunGame
  [Method ((MoveTruckinPI RunGame)
	   self players)                                     (* sm: "27-JUN-83 11:03")
                                                             (* This is the main loop that runs the game)
	  (while (GREATERP (@ numMovesRemaining)
			   0)
	     bind playerRet
	     do (PROGN (WaitIfControlKey "Beginning of Game Loop")
		       (COND
			 ((ZEROP (IMOD (@ numMovesRemaining)
				       (@ replenishFreq)))
			   (← self ReplenishQty)))
		       [COND
			 ((ZEROP (IMOD (@ numMovesRemaining)
				       10))
			   (WriteGameStatus NIL "Moves Remaining: " (@ numMovesRemaining]
		       (← self CheckAlice)
		       (← self MoveBandits)
		       (←@
			 numMovesRemaining
			 (SUB1 (@ numMovesRemaining)))
		       (for x in (@ players)
			  do (PROGN (SETQ currentPlayer (←@
					currentPlayer x))
				    (←@
				      unchargedTime 0)
				    (SETQ forcedStop NIL)    (* update commodity status affected by moves)
				    (for y in (@(@ x truck)
						cargo)
				       do (DoFringeMethods y (QUOTE UpdateStatus)))
				    (COND
				      ((FMEMB x (@ loseTurn))
					(WriteGameStatus (CONCAT (@ x driver)
								 " lost his turn"))
					(←@
					  loseTurn
					  (REMOVE x (@ loseTurn)))
					(←@
					  lastMoved NIL))
				      (T (SETQ maxMove (RAND 1 (@@(@ x truck)
							       MaxDist)))
                                                             (* (WriteGameStatus (@ x driver) " can MOVE max " 
							     maxMove))
					 [COND
					   (debugMode (← x TakeTurn))
					   (T (SETQ playerRet (ERSETQ (← x TakeTurn)))
					      (COND
						((NULL playerRet)
						  (← self RemovePlayer x "Player crashed on a Bug"]
					 (←@
					   lastMoved NIL])

(NoDisplayTruckinS.AttachBoard
  (Method ((NoDisplayTruckinS AttachBoard)
	   self gameBoard)                                   (* dgb: "11-JUL-83 13:05")
                                                             (* Attaches gameBoard to game)
	  (←Super
	    self AttachBoard gameBoard)
	  (SETQ gameWindow NIL)))

(NoDisplayTruckinS.DrivePlayer
  (Method ((NoDisplayTruckinS DrivePlayer)
	   self curLoc finalLoc player)                      (* dgb: "11-JUL-83 12:40")
                                                             (* Noop for NoDisplay case)
	  self))

(NoDisplayTruckinS.UpdateRS
  (Method ((NoDisplayTruckinS UpdateRS)
	   self roadStop)                                    (* sm: "28-JUN-83 09:46")
                                                             (* Sent when any RoadStop's data changes)
                                                             (* Does not ask roadStop to display)
	  roadStop))

(RemoteMasterComm.AddBandit
  (Method ((RemoteMasterComm AddBandit)
	   self name)                                        (* sm: " 7-JUL-83 13:22")
                                                             (* Add bandit to game)
	  (PROG (msg)
	        (← (@ simulator)
		   AddBandit name)
	        (← (@ decisionMaker)
		   AddBandit name)
	        (SETQ msg (LIST (QUOTE AddBandit)
				name))
	        (SendOut self msg)
	        (MailOut self msg))))

(RemoteMasterComm.AddPlayer
  (Method ((RemoteMasterComm AddPlayer)
	   self reqID name type truck deniedFlg)             (* sm: "10-JUL-83 11:20")
                                                             (* Forwards to PI, Simulator, and DecisionMaker)
	  (PROG (msg)
	        (← (@ playerInterface)
		   AddPlayer reqID name type truck deniedFlg)
	        (← (@ simulator)
		   AddPlayer reqID name type truck deniedFlg)
	        (SETQ msg (LIST (QUOTE AddPlayer)
				reqID name type truck deniedFlg))
	        (SendOut self msg)
	        (MailOut self msg)
	        (← (@ decisionMaker)
		   AddPlayer reqID name type truck deniedFlg))))

(RemoteMasterComm.AddPlayerRequest
  (Method ((RemoteMasterComm AddPlayerRequest)
	   self reqID name type truck)                       (* sm: " 7-JUL-83 12:48")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     AddPlayerRequest reqID name type truck)))

(RemoteMasterComm.BeginGameRequest
  (Method ((RemoteMasterComm BeginGameRequest)
	   self)                                             (* sm: " 7-JUL-83 12:48")
                                                             (* Request for starting game -
							     forwarded to DecisionMaker)
	  (← (@ decisionMaker)
	     BeginGameRequest)))

(RemoteMasterComm.BreakCargo
  [Method ((RemoteMasterComm BreakCargo)
	   self playerName cargoPos)                         (* sm: " 7-JUL-83 13:38")
                                                             (* Forwards to Simulator)
	  (PROG (msg)
	        (← (@ simulator)
		   BreakCargo
		   (GetObjectRec playerName)
		   cargoPos)
	        (SendOut self (LIST (QUOTE BreakCargo)
				    (GetObjectName playerName)
				    cargoPos))
	        (MailOut self (LIST (QUOTE BreakCargo)
				    (GetObjectRec playerName)
				    cargoPos])

(RemoteMasterComm.BuyMade
  (Method ((RemoteMasterComm BuyMade)
	   self playerName roadPosition reqQty qty reason penaltyAmt fragility lifetime)
                                                             (* sm: " 7-JUL-83 13:39")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (← (@ decisionMaker)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (← (@ playerInterface)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (SendOut self (LIST (QUOTE BuyMade)
			      (GetObjectName playerName)
			      roadPosition reqQty qty reason penaltyAmt fragility lifetime))
	  (MailOut self (LIST (QUOTE BuyMade)
			      (GetObjectRec playerName)
			      roadPosition reqQty qty reason penaltyAmt fragility lifetime))))

(RemoteMasterComm.BuyRequest
  (Method ((RemoteMasterComm BuyRequest)
	   self player roadPosition qty)                     (* sm: " 7-JUL-83 12:48")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     BuyRequest
	     (GetObjectRec player)
	     roadPosition qty)))

(RemoteMasterComm.GameOver
  (Method ((RemoteMasterComm GameOver)
	   self)                                             (* sm: "12-JUL-83 22:09")
                                                             (* Sent to Simulator)
	  (← (@ simulator)
	     GameOver)
	  (SendOut self (LIST (QUOTE GameOver)))
	  (MailOut self (LIST (QUOTE GameOver)))
	  (←@
	    gameStarted NIL)))

(RemoteMasterComm.GasFill
  (Method ((RemoteMasterComm GasFill)
	   self prev new qty pr)                             (* sm: " 7-JUL-83 13:41")
                                                             (* Forwards to Simulator)
	  (PROG (msg)
	        (← (@ simulator)
		   GasFill prev new qty pr)
	        (SETQ msg (LIST (QUOTE GasFill)
				prev new qty pr))
	        (SendOut self msg)
	        (MailOut self msg))))

(RemoteMasterComm.InterimWorldProcess
  (Method ((RemoteMasterComm InterimWorldProcess)
	   self)                                             (* sm: " 8-JUL-83 15:41")
                                                             (* Interim world process)
	  (until (@ gameStarted)
	     do (COND
		  ((← (@ postman)
		      ReceiveP)
		    (ReceiveIn self)))
		(BLOCK))
	  (DEL.PROCESS (THIS.PROCESS))))

(RemoteMasterComm.MaxMove
  (Method ((RemoteMasterComm MaxMove)
	   self player maxMove)                              (* sm: "10-JUL-83 18:46")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     MaxMove
	     (GetObjectRec player)
	     maxMove)
	  (SendOut self (LIST (QUOTE MaxMove)
			      (COND
				((LITATOM player)
				  player)
				(T (GetObjectName player)))
			      maxMove))
	  (MailOut self (LIST (QUOTE MaxMove)
			      (GetObjectRec player)
			      maxMove))))

(RemoteMasterComm.MoveMade
  (Method ((RemoteMasterComm MoveMade)
	   self playerName fromStop toStop reason penaltyAmount missTurns)
                                                             (* sm: "13-JUL-83 09:17")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (← (@ decisionMaker)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (← (@ playerInterface)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (SendOut self (LIST (QUOTE MoveMade)
			      (GetObjectName playerName)
			      fromStop toStop reason penaltyAmount missTurns))
	  (MailOut self (LIST (QUOTE MoveMade)
			      (GetObjectRec playerName)
			      fromStop toStop reason penaltyAmount missTurns))
	  (← (@ decisionMaker)
	     UpdateAlice
	     (GetObjectRec playerName))))

(RemoteMasterComm.MoveRequest
  (Method ((RemoteMasterComm MoveRequest)
	   self player from to reason)                       (* sm: " 7-JUL-83 12:49")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     MoveRequest
	     (GetObjectRec player)
	     from to reason)))

(RemoteMasterComm.NewGame
  (Method ((RemoteMasterComm NewGame)
	   self seed boardType gameType)                     (* sm: " 7-JUL-83 13:49")
                                                             (* Forwards to Simulator)
	  (PROG (msg)
	        (← (@ simulator)
		   NewGame seed boardType gameType)
	        (← self CreatePlayerInterface gameType)
	        (← (@ playerInterface)
		   NewGame seed boardType gameType)
	        (SETQ msg (LIST (QUOTE NewGame)
				seed boardType gameType))
	        (SendOut self msg)
	        (MailOut self msg))))

(RemoteMasterComm.NewGameRequest
  (Method ((RemoteMasterComm NewGameRequest)
	   self board)                                       (* sm: " 7-JUL-83 12:49")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     NewGameRequest board)))

(RemoteMasterComm.ParkedAtAlice
  (Method ((RemoteMasterComm ParkedAtAlice)
	   self player time)                                 (* sm: " 7-JUL-83 13:54")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     ParkedAtAlice
	     (GetObjectRec player)
	     time)
	  (SendOut self (LIST (QUOTE ParkedAtAlice)
			      (GetObjectName player)
			      time))
	  (MailOut self (LIST (QUOTE ParkedAtAlice)
			      (GetObjectRec player)
			      time))))

(RemoteMasterComm.ReUseGame
  (Method ((RemoteMasterComm ReUseGame)
	   self seed)                                        (* sm: " 7-JUL-83 13:55")
                                                             (* Forwards to Simulator and other recipients)
	  (← (@ simulator)
	     ReUseGame seed)
	  (← (@ playerInterface)
	     ReUseGame)
	  (SendOut self (LIST (QUOTE ReUseGame)
			      seed))
	  (MailOut self (LIST (QUOTE ReUseGame)
			      seed))))

(RemoteMasterComm.ReUseGameRequest
  (Method ((RemoteMasterComm ReUseGameRequest)
	   self)                                             (* sm: " 7-JUL-83 12:49")
                                                             (* Forwards to DecisionMaker for reusing existing game 
							     board)
	  (← (@ decisionMaker)
	     ReUseGameRequest)))

(RemoteMasterComm.RemovePlayer
  (Method ((RemoteMasterComm RemovePlayer)
	   self playerName reason)                           (* sm: " 7-JUL-83 14:00")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     RemovePlayer
	     (GetObjectRec playerName)
	     reason)
	  (← (@ playerInterface)
	     RemovePlayer
	     (GetObjectRec playerName)
	     reason)
	  (SendOut self (LIST (QUOTE RemovePlayer)
			      (GetObjectName playerName)
			      reason))
	  (MailOut self (LIST (QUOTE RemovePlayer)
			      (GetObjectRec playerName)
			      reason))))

(RemoteMasterComm.RemovePlayerRequest
  (Method ((RemoteMasterComm RemovePlayerRequest)
	   self player reason)                               (* sm: "10-JUL-83 21:10")
                                                             (* Request to remove player)
	  (← (@ decisionMaker)
	     RemovePlayerRequest
	     (GetObjectRec player)
	     reason)))

(RemoteMasterComm.SellMade
  (Method ((RemoteMasterComm SellMade)
	   self playerName roadPosition reqQty qty cargoPos reason penaltyAmt)
                                                             (* sm: " 7-JUL-83 14:09")
                                                             (* Forwards to Simulator, DecisionMaker, 
							     PlayerInterface)
	  (← (@ simulator)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (← (@ decisionMaker)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (← (@ playerInterface)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (SendOut self (LIST (QUOTE SellMade)
			      (GetObjectName playerName)
			      roadPosition reqQty qty cargoPos reason penaltyAmt))
	  (MailOut self (LIST (QUOTE SellMade)
			      (GetObjectRec playerName)
			      roadPosition reqQty qty cargoPos reason penaltyAmt))))

(RemoteMasterComm.SellRequest
  (Method ((RemoteMasterComm SellRequest)
	   self player roadPosition commodityIndex qty)      (* sm: " 7-JUL-83 12:49")
                                                             (* Forwards to DecisionMaker)
	  (← (@ decisionMaker)
	     SellRequest
	     (GetObjectRec player)
	     roadPosition commodityIndex qty)))

(RemoteMasterComm.SetInitialParameters
  (Method ((RemoteMasterComm SetInitialParameters)
	   self)                                             (* sm: "10-JUL-83 20:19")
                                                             (* Sets initial parameters)
	  (←@(@ decisionMaker)
	    startsAfter 10)
	  (SETQ debugMode NIL)))

(RemoteMasterComm.SetUp
  (Method ((RemoteMasterComm SetUp)
	   self game board display)                          (* sm: "10-JUL-83 19:37")
                                                             (* Sets up the Standard configuration)
                                                             (* ARGS: If NIL, then default.
							     If T, then ask user, else use the passed arg)
	  (← self CreateDecisionMaker game)
	  (← self CreateSimulator display)
	  (← self CreateGateWay)
	  (← self SetInitialParameters)
	  (← self StartInterimWorldProcess)                  (* sends a request to DecisionMaker to create a new 
							     game)
	  (← (@ decisionMaker)
	     NewGameRequest board)))

(RemoteMasterComm.SpoilCargo
  (Method ((RemoteMasterComm SpoilCargo)
	   self playerName cargoPos)                         (* sm: "26-JUL-83 09:53")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     SpoilCargo
	     (GetObjectRec playerName)
	     cargoPos)                                       (* SpoilCargo is generated locally on each machine so 
							     should not be broadcast)
                                                             (* (SendOut self (LIST (QUOTE SpoilCargo) 
							     (GetObjectName playerName) cargoPos)))
	  (MailOut self (LIST (QUOTE SpoilCargo)
			      (GetObjectRec playerName)
			      cargoPos))))

(RemoteMasterComm.StartGame
  (Method ((RemoteMasterComm StartGame)
	   self begTime endTime)                             (* sm: " 7-JUL-83 14:38")
                                                             (* Forwards to simulator, PI, DM, and then starts 
							     WorldProcess)
	  (← (@ simulator)
	     StartGame begTime endTime)                      (* start the WorldProcess)
	  (← self StartWorldProcess)
	  (← (@ playerInterface)
	     StartGame begTime endTime)
	  (← (@ decisionMaker)
	     StartGame begTime endTime)
	  (SendOut self (LIST (QUOTE StartGame)
			      begTime endTime))
	  (MailOut self (LIST (QUOTE StartGame)
			      begTime endTime))))

(RemoteMasterComm.StartInterimWorldProcess
  (Method ((RemoteMasterComm StartInterimWorldProcess)
	   self)                                             (* sm: " 8-AUG-83 15:52")
                                                             (* Starts Interim World Process)
	  (DEL.PROCESS (QUOTE InterimWorldProc))
	  (←@
	    gameStarted NIL)
	  (←@
	    interimWP
	    (ADD.PROCESS (LIST (QUOTE ←)
			       self
			       (QUOTE InterimWorldProcess))
			 (QUOTE NAME)
			 (QUOTE InterimWorldProc)
			 (QUOTE RESTARTABLE)
			 GameProcRestFlg))))

(RemoteMasterComm.WorldProcess
  [Method ((RemoteMasterComm WorldProcess)
	   self)                                             (* sm: "16-SEP-83 17:16")
                                                             (* This is the World Process.)
	  (PROG ([endTime (SETUPTIMER.DATE (GDATE (@ Simulator endTime]
		 [begTime (SETUPTIMER (IntervalToEvent (@ Simulator beginTime]
		 cTime pendReq)                              (* Wait till it is 5 secs before game)
	        (until (TIMEREXPIRED? begTime (QUOTE MS))
		   do (COND
			((← (@ postman)
			    ReceiveP)
			  (ReceiveIn self)))
		      (BLOCK))                               (* ask PI to start User Processes)
                                                             (* (← (@ playerInterface) StartPlayerProcesses))
	        (← (@ decisionMaker)
		   RedoGameParameters)
	        (← (@ simulator)
		   RedoGameParameters)                       (* Start the loop for checking messages from PI)
	        (PutValue (@ simulator)
			  (QUOTE timeLeft)
			  (IDIFFERENCE (@(@ simulator)
					 endTime)
				       (IDATE)))
	        (←@(@ playerInterface)
		  runningPlayer NIL)
	        (← (@ playerInterface)
		   CheckLocalPlayers)
	        (until (TIMEREXPIRED? endTime (QUOTE SECONDS))
		   do (← (@ playerInterface)
			 ScheduleNextPlayer)
		      (BLOCK)
		      (← (@ decisionMaker)
			 MonitorGame)
		      (BLOCK)
		      (COND
			((← (@ postman)
			    ReceiveP)
			  (ReceiveIn self)))
		      (BLOCK))                               (* Game is over)
	        (← (@ decisionMaker)
		   MonitorGame T)
	        (←@
		  gameStarted NIL)
	        (← self CleanGameWorld)
	        (RETURN (QUOTE Done])

(RemoteSlaveComm.AddBandit
  (Method ((RemoteSlaveComm AddBandit)
	   self name)                                        (* sm: " 7-JUL-83 13:22")
                                                             (* Add bandit to game)
	  (PROG (msg)
	        (← (@ simulator)
		   AddBandit name)
	        (SETQ msg (LIST (QUOTE AddBandit)
				name))
	        (MailOut self msg))))

(RemoteSlaveComm.AddPlayer
  (Method ((RemoteSlaveComm AddPlayer)
	   self reqID name type truck deniedFlg)             (* sm: " 7-JUL-83 13:25")
                                                             (* Forwards to PI, Simulator, and DecisionMaker)
	  (PROG (msg)
	        (← (@ playerInterface)
		   AddPlayer reqID name type truck deniedFlg)
	        (← (@ simulator)
		   AddPlayer reqID name type truck deniedFlg)
	        (SETQ msg (LIST (QUOTE AddPlayer)
				reqID name type truck deniedFlg))
	        (MailOut self msg))))

(RemoteSlaveComm.AddPlayerRequest
  (Method ((RemoteSlaveComm AddPlayerRequest)
	   self reqID name type truck)                       (* sm: " 7-JUL-83 13:26")
                                                             (* Forwards to DecisionMaker)
	  (SendOut self (LIST (QUOTE AddPlayerRequest)
			      reqID name type truck))))

(RemoteSlaveComm.BeginGameRequest
  (Method ((RemoteSlaveComm BeginGameRequest)
	   self)                                             (* mjs: " 2-AUG-83 11:29")
                                                             (* Blocks it.)
	  (printout TTY "You cannot start a game from the Slave Machine!!" T)
	  (printout TTY "Wait till the Master Machine sends a StartGame to your machine" T)))

(RemoteSlaveComm.BreakCargo
  [Method ((RemoteSlaveComm BreakCargo)
	   self playerName cargoPos)                         (* sm: " 7-JUL-83 13:33")
                                                             (* Forwards to Simulator)
	  (PROG (msg)
	        (← (@ simulator)
		   BreakCargo
		   (GetObjectRec playerName)
		   cargoPos)
	        (MailOut self (LIST (QUOTE BreakCargo)
				    (GetObjectRec playerName)
				    cargoPos])

(RemoteSlaveComm.BuyMade
  (Method ((RemoteSlaveComm BuyMade)
	   self playerName roadPosition reqQty qty reason penaltyAmt fragility lifetime)
                                                             (* sm: " 7-JUL-83 13:35")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (← (@ playerInterface)
	     BuyMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty reason penaltyAmt fragility lifetime)
	  (MailOut self (LIST (QUOTE BuyMade)
			      (GetObjectRec playerName)
			      roadPosition reqQty qty reason penaltyAmt fragility lifetime))))

(RemoteSlaveComm.BuyRequest
  (Method ((RemoteSlaveComm BuyRequest)
	   self player roadPosition qty)                     (* sm: "10-JUL-83 14:42")
                                                             (* Forwards to DecisionMaker)
	  (SendOut self (LIST (QUOTE BuyRequest)
			      (COND
				((LITATOM player)
				  player)
				(T (GetObjectName player)))
			      roadPosition qty))))

(RemoteSlaveComm.GameOver
  (Method ((RemoteSlaveComm GameOver)
	   self)                                             (* sm: "12-JUL-83 22:10")
                                                             (* Sent to Simulator)
	  (← (@ simulator)
	     GameOver)
	  (MailOut self (LIST (QUOTE GameOver)))
	  (←@
	    gameStarted NIL)))

(RemoteSlaveComm.GasFill
  (Method ((RemoteSlaveComm GasFill)
	   self prev new qty pr)                             (* sm: " 7-JUL-83 13:41")
                                                             (* Forwards to Simulator)
	  (PROG (msg)
	        (← (@ simulator)
		   GasFill prev new qty pr)
	        (SETQ msg (LIST (QUOTE GasFill)
				prev new qty pr))
	        (MailOut self msg))))

(RemoteSlaveComm.InterimWorldProcess
  (Method ((RemoteSlaveComm InterimWorldProcess)
	   self)                                             (* sm: " 8-JUL-83 15:41")
                                                             (* Interim world process)
	  (until (@ gameStarted)
	     do (COND
		  ((← (@ postman)
		      ReceiveP)
		    (ReceiveIn self)))
		(BLOCK))
	  (DEL.PROCESS (THIS.PROCESS))))

(RemoteSlaveComm.MaxMove
  (Method ((RemoteSlaveComm MaxMove)
	   self player maxMove)                              (* sm: "10-JUL-83 18:45")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     MaxMove
	     (GetObjectRec player)
	     maxMove)
	  (MailOut self (LIST (QUOTE MaxMove)
			      (COND
				((LITATOM player)
				  player)
				(T (GetObjectName player)))
			      maxMove))))

(RemoteSlaveComm.MoveMade
  (Method ((RemoteSlaveComm MoveMade)
	   self playerName fromStop toStop reason penaltyAmount missTurns)
                                                             (* sm: " 7-JUL-83 13:45")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (← (@ playerInterface)
	     MoveMade
	     (GetObjectRec playerName)
	     fromStop toStop reason penaltyAmount missTurns)
	  (MailOut self (LIST (QUOTE MoveMade)
			      (GetObjectRec playerName)
			      fromStop toStop reason penaltyAmount missTurns))))

(RemoteSlaveComm.MoveRequest
  (Method ((RemoteSlaveComm MoveRequest)
	   self player from to reason)                       (* sm: "10-JUL-83 14:43")
                                                             (* Forwards to DecisionMaker)
	  (SendOut self (LIST (QUOTE MoveRequest)
			      (COND
				((LITATOM player)
				  player)
				(T (GetObjectName player)))
			      from to reason))))

(RemoteSlaveComm.NewGame
  (Method ((RemoteSlaveComm NewGame)
	   self seed boardType gameType)                     (* sm: "12-JUL-83 21:07")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     NewGame seed boardType gameType)
	  (← self CreatePlayerInterface gameType)
	  (← (@ playerInterface)
	     NewGame seed boardType gameType)
	  (MailOut self (LIST (QUOTE NewGame)
			      seed boardType gameType))))

(RemoteSlaveComm.NewGameRequest
  (Method ((RemoteSlaveComm NewGameRequest)
	   self board)                                       (* mjs: " 2-AUG-83 11:29")
                                                             (* Blocks it)
	  (printout TTY "Requests for new games can only be generated at the" " Master Machine" T)))

(RemoteSlaveComm.ParkedAtAlice
  (Method ((RemoteSlaveComm ParkedAtAlice)
	   self player time)                                 (* sm: " 7-JUL-83 13:54")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     ParkedAtAlice
	     (GetObjectRec player)
	     time)
	  (MailOut self (LIST (QUOTE ParkedAtAlice)
			      (GetObjectRec player)
			      time))))

(RemoteSlaveComm.ReUseGame
  (Method ((RemoteSlaveComm ReUseGame)
	   self seed)                                        (* sm: " 7-JUL-83 13:55")
                                                             (* Forwards to Simulator and other recipients)
	  (← (@ simulator)
	     ReUseGame seed)
	  (← (@ playerInterface)
	     ReUseGame)
	  (MailOut self (LIST (QUOTE ReUseGame)
			      seed))))

(RemoteSlaveComm.ReUseGameRequest
  (Method ((RemoteSlaveComm ReUseGameRequest)
	   self)                                             (* mjs: " 2-AUG-83 11:29")
                                                             (* Blocks it)
	  (printout TTY "Request to ReUse existing board can be given" T 
		    " ONLY at the Master Machine"
		    T)))

(RemoteSlaveComm.RemovePlayer
  (Method ((RemoteSlaveComm RemovePlayer)
	   self playerName reason)                           (* sm: " 7-JUL-83 14:00")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     RemovePlayer
	     (GetObjectRec playerName)
	     reason)
	  (← (@ playerInterface)
	     RemovePlayer
	     (GetObjectRec playerName)
	     reason)
	  (MailOut self (LIST (QUOTE RemovePlayer)
			      (GetObjectRec playerName)
			      reason))))

(RemoteSlaveComm.RemovePlayerRequest
  (Method ((RemoteSlaveComm RemovePlayerRequest)
	   self player reason)                               (* dgb: "15-JUL-83 00:31")
                                                             (* Request to remove player)
	  (SendOut self (LIST (QUOTE RemovePlayerRequest)
			      (GetObjectName player)
			      reason))))

(RemoteSlaveComm.SellMade
  (Method ((RemoteSlaveComm SellMade)
	   self playerName roadPosition reqQty qty cargoPos reason penaltyAmt)
                                                             (* sm: " 7-JUL-83 14:09")
                                                             (* Forwards to Simulator, DecisionMaker, 
							     PlayerInterface)
	  (← (@ simulator)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (← (@ playerInterface)
	     SellMade
	     (GetObjectRec playerName)
	     roadPosition reqQty qty cargoPos reason penaltyAmt)
	  (MailOut self (LIST (QUOTE SellMade)
			      (GetObjectRec playerName)
			      roadPosition reqQty qty cargoPos reason penaltyAmt))))

(RemoteSlaveComm.SellRequest
  (Method ((RemoteSlaveComm SellRequest)
	   self player roadPosition commodityIndex qty)      (* sm: "10-JUL-83 14:43")
                                                             (* Forwards to DecisionMaker)
	  (SendOut self (LIST (QUOTE SellRequest)
			      (COND
				((LITATOM player)
				  player)
				(T (GetObjectName player)))
			      roadPosition commodityIndex qty))))

(RemoteSlaveComm.SetInitialParameters
  (Method ((RemoteSlaveComm SetInitialParameters)
	   self)                                             (* sm: "10-JUL-83 20:19")
                                                             (* Sets initial parameters)
	  (SETQ debugMode T)
	  (SETQ timeTrace T)))

(RemoteSlaveComm.SetUp
  (Method ((RemoteSlaveComm SetUp)
	   self game board display)                          (* sm: "10-JUL-83 19:37")
                                                             (* Sets up the Standard configuration)
                                                             (* Ignores game and board ARGS)
	  (← self CreateSimulator display)
	  (← self CreateGateWay)
	  (← self SetInitialParameters)
	  (← self StartInterimWorldProcess)))

(RemoteSlaveComm.SpoilCargo
  (Method ((RemoteSlaveComm SpoilCargo)
	   self playerName cargoPos)                         (* sm: " 7-JUL-83 14:32")
                                                             (* Forwards to Simulator)
	  (← (@ simulator)
	     SpoilCargo
	     (GetObjectRec playerName)
	     cargoPos)
	  (MailOut self (LIST (QUOTE SpoilCargo)
			      (GetObjectRec playerName)
			      cargoPos))))

(RemoteSlaveComm.StartGame
  (Method ((RemoteSlaveComm StartGame)
	   self begTime endTime)                             (* sm: "12-JUL-83 21:07")
                                                             (* Forwards to simulator, PI, DM, and then starts 
							     WorldProcess)
	  (← (@ simulator)
	     StartGame begTime endTime)                      (* start the WorldProcess)
	  (← self StartWorldProcess)
	  (← (@ playerInterface)
	     StartGame begTime endTime)
	  (MailOut self (LIST (QUOTE StartGame)
			      begTime endTime))
	  (← (@ playerInterface)
	     SelectPlayers)))

(RemoteSlaveComm.StartInterimWorldProcess
  (Method ((RemoteSlaveComm StartInterimWorldProcess)
	   self)                                             (* sm: " 8-AUG-83 15:52")
                                                             (* Starts Interim World Process)
	  (DEL.PROCESS (QUOTE InterimWorldProc))
	  (←@
	    gameStarted NIL)
	  (←@
	    interimWP
	    (ADD.PROCESS (LIST (QUOTE ←)
			       self
			       (QUOTE InterimWorldProcess))
			 (QUOTE NAME)
			 (QUOTE InterimWorldProc)
			 (QUOTE RESTARTABLE)
			 GameProcRestFlg))))

(RemoteSlaveComm.WorldProcess
  [Method ((RemoteSlaveComm WorldProcess)
	   self)                                             (* sm: "16-SEP-83 17:17")
                                                             (* This is the World Process)
	  (PROG ([endTime (SETUPTIMER.DATE (GDATE (@ Simulator endTime]
		 [begTime (SETUPTIMER (IntervalToEvent (@ Simulator beginTime]
		 cTime pendReq)                              (* Wait till it is 5 secs before game)
	        (until (TIMEREXPIRED? begTime (QUOTE MS))
		   do (COND
			((← (@ postman)
			    ReceiveP)
			  (ReceiveIn self)))
		      (BLOCK))                               (* ask PI to start User Processes)
                                                             (* (← (@ playerInterface) StartPlayerProcesses))
	        (← (@ simulator)
		   RedoGameParameters)                       (* Start the loop for checking messages from PI)
	        (PutValue (@ simulator)
			  (QUOTE timeLeft)
			  (IDIFFERENCE (@(@ simulator)
					 endTime)
				       (IDATE)))
	        (←@(@ playerInterface)
		  runningPlayer NIL)
	        (← (@ playerInterface)
		   CheckLocalPlayers)
	        (until (TIMEREXPIRED? endTime (QUOTE SECONDS))
		   do (← (@ playerInterface)
			 ScheduleNextPlayer)
		      (BLOCK)
		      (for x in (@(@ playerInterface)
				  suspendedPlayers)
			 when (SETQ pendReq (@ x pendingRequest))
			 do (←@
			      x pendingRequest NIL)
			    (PutValue x (QUOTE pendingRequest)
				      (IDATE)
				      (QUOTE whenSent))
			    (PutValue x (QUOTE pendingRequest)
				      pendReq
				      (QUOTE inProcess))
			    (ApplyMethod self (CAR pendReq)
					 (CDR pendReq)))
		      (COND
			((← (@ postman)
			    ReceiveP)
			  (ReceiveIn self)))
		      (BLOCK))
	        (while (@ gameStarted)
		   do (COND
			((← (@ postman)
			    ReceiveP)
			  (ReceiveIn self)))
		      (BLOCK))
	        (← self CleanGameWorld)
	        (RETURN (QUOTE Done])

(TimeTruckinDM.ChargeTime
  (Method ((TimeTruckinDM ChargeTime)
	   self player clockTime)                            (* sm: "28-JUN-83 10:06")
                                                             (* Calculates the actual time to be charged to player)
                                                             (* if clockTime is NIL, MinMoveTime is charged)
	  (PROG (time charge)
	        [COND
		  ((NULL clockTime)
		    (SETQ charge (@@ MinMoveTime)))
		  (T [SETQ time (IDIFFERENCE clockTime (IPLUS (@ unchargedTime)
							      (@@ player Handicap]
		     [SETQ charge (SETQ time (FIX (QUOTIENT (PLUS 500 (TIMES time HandicapRatio))
							    1000]
		     (COND
		       ((LESSP time (@@ MinMoveTime))
			 (SETQ charge (@@ MinMoveTime)))
		       ((GREATERP time (@@ MaxMoveTime))     (* player exceeded limit. Yank from game)
			 (← self RemovePlayer player (CONCAT "Too much time taken " charge))
			 (SETQ charge 0]
	        (←@
		  player timeUsed (IPLUS charge (@ player timeUsed)))
	        (←@
		  timeRemaining
		  (IDIFFERENCE (@ timeRemaining)
			       charge))
	        (AND debugTimeTrace (WriteGameStatus (CONCAT "Time Used: by " (@ player driver))
						     (CONCAT "Clock(ms) " clockTime)
						     (CONCAT "Used(sec)" time)))
	        (AND timeTrace (WriteGameStatus "Time Charged to: " (@ player driver)
						(CONCAT " " charge " sec")))
	        (RETURN charge))))

(TimeTruckinDM.CheckAlice
  [Method ((TimeTruckinDM CheckAlice)
	   self player)                                      (* sm: "13-JUL-83 09:44")
                                                             (* check AlicesRestaurant's before each turn)
	  (for x in (@ alices) bind parked
	     do (for loc in (QUOTE (parkingPlace1 parkingPlace2))
		   do (PROG (time msg reason)
			    (COND
			      ((SETQ parked (GetValue x loc))
				(COND
				  ([OR (AND NIL              (* This condition is blocked out)
					    (GREATERP (GetValue x loc (QUOTE howLong))
						      3)
					    (SETQ msg "Stayed at Alices more than 3 turns")
					    (SETQ reason (QUOTE AliceTurn)))
				       (AND (GREATERP (GetValue x loc (QUOTE howLong))
						      0)
					    (GREATERP [SETQ time (IDIFFERENCE (IDATE)
									      (GetValue x loc
											(QUOTE 
										       timeParked]
						      (@ self aliceStay MaxTime))
					    (SETQ msg (CONCAT "Spent too much time at Alice: " time))
					    (SETQ reason (QUOTE AliceTime]
                                                             (* stayed there too long)
				    (COND
				      ((← (@ unionHall)
					  RoomToPark?)
					(BrokenRules parked msg NIL 1 "Forcibly moved to UnionHall")
					(← self MoveRequest parked (FindLocIndex x (@ roadStops))
					   (FindLocIndex (@ unionHall)
							 (@ roadStops))
					   reason))
				      (T                     (* UnionHall is temporarily filled)
					 (BrokenRules parked msg NIL 1 
						      "Will be moved to UnionHall next turn"])

(TimeTruckinDM.InitializeGameParameters
  (Method ((TimeTruckinDM InitializeGameParameters)
	   self)                                             (* sm: " 8-JUL-83 11:06")
                                                             (* Initializes critical variables for new game to run)
	  (←Super
	    self InitializeGameParameters)
	  (PutValue self (QUOTE replenishFreq)
		    (@ beginTime)
		    (QUOTE LastTime))
	  (PutValue self (QUOTE banditFreq)
		    (@ beginTime)
		    (QUOTE LastTime))))

(TimeTruckinDM.MoveBandits
  [Method ((TimeTruckinDM MoveBandits)
	   self)                                             (* sm: " 5-JUL-83 12:05")
                                                             (* randomly moves bandits around on the board before 
							     each turn)
	  (PROG ((ctime (IDATE)))
	        (COND
		  ((IGREATERP (IDIFFERENCE ctime (@ self banditFreq LastTime))
			      (@ banditFreq))
		    (PutValue self (QUOTE banditFreq)
			      ctime
			      (QUOTE LastTime))              (* Only move once in a while if you are a bandit)
		    (←Super
		      self MoveBandits])

(TimeTruckinDM.RedoGameParameters
  (Method ((TimeTruckinDM RedoGameParameters)
	   self)                                             (* sm: " 4-AUG-83 13:16")
                                                             (* Change game parameters based on players in the game)
	  (PROG NIL
	        (←Super
		  self RedoGameParameters)
	        [PutValue self (QUOTE banditFreq)
			  (ITIMES (@@ MinMoveTime)
				  (LENGTH (@ players))
				  (GetValue self (QUOTE banditFreq)
					    (QUOTE BanditFactor]

          (* (PutValue self (QUOTE replenishFreq) (ITIMES (@@ MinMoveTime) (LENGTH (@ players)) (GetValue self 
	  (QUOTE replenishFreq) (QUOTE ReplenishFactor)))))


	        (PutValue self (QUOTE replenishFreq)
			  NotSetValue)
	        (RETURN NIL))))

(TimeTruckinDM.ReplenishQty
  [Method ((TimeTruckinDM ReplenishQty)
	   self)                                             (* sm: " 5-JUL-83 12:06")
                                                             (* Checks if time to replenish)
	  (PROG ((ctime (IDATE)))
	        (COND
		  ((IGREATERP (IDIFFERENCE ctime (@ self replenishFreq LastTime))
			      (@ replenishFreq))
		    (PutValue self (QUOTE replenishFreq)
			      ctime
			      (QUOTE LastTime))
		    (←Super
		      self ReplenishQty])

(TimeTruckinPI.RunGame
  (Method ((TimeTruckinPI RunGame)
	   self players)                                     (* sm: "27-JUN-83 11:02")
                                                             (* This is the main loop that runs the game)
	  (while (GREATERP (@ timeRemaining)
			   0)
	     bind currPlayer begTime chargeTime playerRet
	     do (WaitIfControlKey "Beginning of Game Loop")
		[COND
		  ((ZEROP (IMOD (@ timeRemaining)
				10))
		    (WriteGameStatus NIL "Time Remaining: " (@ timeRemaining]
		(← self ReplenishQty)
		(← self MoveBandits)
		[for p bind (minTimeSoFar ← 10000000) in (@ players)
		   do (COND
			((ILESSP (@ p timeUsed)
				 minTimeSoFar)
			  (SETQ currPlayer p)
			  (SETQ minTimeSoFar (@ p timeUsed]
		(←@
		  currentPlayer
		  (SETQ currentPlayer currPlayer))
		(SETQ forcedStop NIL)                        (* update commodity status affected by moves)
		(for y in (@(@ currPlayer truck)
			    cargo)
		   do (DoFringeMethods y (QUOTE UpdateStatus)))
		(←@
		  unchargedTime 0)
		[COND
		  ((FMEMB currPlayer (@ loseTurn))
		    (WriteGameStatus (CONCAT (@ currPlayer driver)
					     " lost his turn"))
		    (SETQ chargeTime (← self ChargeTime currPlayer))
		    (←@
		      loseTurn
		      (REMOVE currPlayer (@ loseTurn)))
		    (←@
		      lastMoved NIL))
		  (T (SETQ maxMove (RAND 1 (@@(@ currPlayer truck)
					   MaxDist)))        (* (WriteGameStatus (@ x driver) " can MOVE max " 
							     maxMove))
		     (SETQ begTime (CLOCK))
		     [COND
		       (debugMode (← currPlayer TakeTurn))
		       (T (SETQ playerRet (ERSETQ (← currPlayer TakeTurn)))
			  (COND
			    ((NULL playerRet)
			      (← self RemovePlayer currPlayer "Player crashed on a Bug"]
		     (←@
		       lastMoved NIL)
		     (SETQ chargeTime (← self ChargeTime currPlayer (IDIFFERENCE (CLOCK)
										 begTime]
		(←@
		  currPlayer movesMade (ADD1 (@ currPlayer movesMade)))
		(← self UpdateAlice currPlayer chargeTime)
		(← self CheckAlice currPlayer))))

(TruckinBoard.AssignRoadStops
  [Method ((TruckinBoard AssignRoadStops)
	   self)                                             (* sm: "27-JUN-83 18:08")

          (* * Assign RoadStops to the current GameBoard)


	  (PROG ((numStopsWanted (ITIMES (@@ numRows)
					 (@@ numColumns)))
		 numStopsKnown stops rs stillNeeded (availRS (APPEND (SetRoadStops)))
		 count)                                      (* generate dummy board)
	        (for i from 1 to numStopsWanted do (SETQ stops (CONS NIL stops)))
                                                             (* install BoardPattern)
	        (SubstituteStop stops 1 (←New
				  ($ UnionHall)))
	        (for x in BoardPattern do (SubstituteStop stops (FindRandomNIL stops)
							  (← ($ AlicesRestaurant)
							     New)))
	        (for x in MustStops do (SubstituteStop stops (FindRandomNIL stops)
						       (← (GetObjectRec x)
							  New)))
	        (SETQ stillNeeded (for x in stops count (NULL x)))
	        (SETQ availRS (FillerRoadStops (DefaultMustStops)))
	        (SETQ numStopsKnown (FLENGTH availRS))
	        [for i from stillNeeded to 10 by -1
		   do [SETQ rs (CAR (NTH availRS (RAND 1 numStopsKnown]
		      [COND
			((ILEQ i numStopsKnown)
			  (SETQ availRS (DREMOVE rs availRS))
			  (SETQ numStopsKnown (FLENGTH availRS]
		      (SubstituteStop stops (FindRandomNIL stops)
				      (←New
					(GetClassRec rs]
	        [for i from 9 to 1 by -1
		   do [SETQ rs (CAR (NTH availRS (RAND 1 numStopsKnown]
		      [COND
			((ILEQ i numStopsKnown)
			  (SETQ availRS (DREMOVE rs availRS))
			  (SETQ numStopsKnown (FLENGTH availRS]
		      (SubstituteStop stops (FindFirstNIL stops)
				      (←New
					(GetClassRec rs]
	        (SETQ StopsNotUsed availRS)
	        (RETURN (←@
			  roadStops stops])

(TruckinBoard.AttachToGame
  (Method ((TruckinBoard AttachToGame)
	   self game)                                        (* sm: "28-JUN-83 09:33")
                                                             (* attaches self to game)
                                                             (* returns previous game (if any) to which attached)
	  (PROG (prevGame)
	        (SETQ prevGame (@ simulator))
	        (COND
		  ((GetObjectRec prevGame)
		    (← prevGame UnattachBoard)))
	        (PutValue self (QUOTE simulator)
			  game)
	        (RETURN prevGame))))

(TruckinBoard.CreateGameBoard
  (Method ((TruckinBoard CreateGameBoard)
	   self region title)                                (* sm: " 5-JUL-83 18:38")

          (* * Creates a new Window for the gameBoard.)


	  (PROG NIL
	        (SETQ gameWindow (CREATEW region title))
	        (←@
		  gameWindow gameWindow)
	        (← self InitializeGameWindow)
	        (← self MakeDriveBitMaps)
	        (RETURN gameWindow))))

(TruckinBoard.DisplayGameBoard
  (Method ((TruckinBoard DisplayGameBoard)
	   self)                                             (* sm: "29-JUN-83 15:51")

          (* * Displays the gameBoard. ReAllocates gameBoard window if needed.)


	  (PROG (region (xMargin 2)
			(xExtra 10)
			(yExtra 20)
			width height (k 0)
			(date (DATE)))

          (* * Initialize and display the gameWindow if needed.)


	        (SETQ gameWindow (@ gameWindow))
	        (COND
		  [(NOT gameWindow)                          (* New window if needed.)
		    [SETQ width (IPLUS xExtra (ITIMES (@@ numColumns)
						      (@@($ RoadStop)
							Width]
		    [SETQ height (IPLUS yExtra (ITIMES (@@ numRows)
						       (IPLUS (@@($ RoadStop)
								Height)
							      (@@($ Player)
								Height]
		    (SETQ region
		      (create REGION
			      LEFT ← 10
			      BOTTOM ← 10
			      WIDTH ← width
			      HEIGHT ← height))
		    (←@
		      windowRegion region)
		    (SETQ gameWindow (← self CreateGameBoard region
					(CONCAT 
"TRUCKIN Knowledge System.    Created by: DANIEL BOBROW, SANJAY MITTAL, and MARK STEFIK.    Copyright (c) "
						(CONCAT "19" (SUBSTRING date 8 9))
						" Xerox Corp" "     " (DATE]
		  (T (← self InitializeGameWindow)))
	        (← self DrawRoadMarks)
	        (for roadStop in (@ roadStops) do (← roadStop Display))
	        (RETURN self))))

(TruckinBoard.InitializeRoadStops
  (Method ((TruckinBoard InitializeRoadStops)
	   self seed)                                        (* sm: "28-JUN-83 09:35")
                                                             (* Initializes RoadStop qty and pr)
	  (RANDSET seed)
	  (for x in (@ roadStops) do (← x Initialize))))

(TruckinBoard.MakeDriveBitMaps
  (Method ((TruckinBoard MakeDriveBitMaps)
	   self)                                             (* sm: "27-JUN-83 18:09")
                                                             (* Creates Bit maps for Trucks)
	  (MakeDriveBitMaps 1)))

(TruckinBoard.NewBoard
  (Method ((TruckinBoard NewBoard)
	   self seed)                                        (* sm: " 5-JUL-83 18:40")
                                                             (* Creates and displays a new game board)
	  (RANDSET seed)                                     (* Display the board)
	  (SETQ gameWindow NIL)
	  (← self Initialize)
	  (← self AssignRoadStops)                           (* Pick Road Stops)
                                                             (* (← self DisplayGameBoard))
                                                             (* Place RoadStops on the board)
	  (← self PlaceRoadStops)                            (* Generate initial qty and pr for applicable 
							     roadStops)
	  (← self InitializeRoadStops (RANDSET))
	  self))

(TruckinBoard.PlaceRoadStops
  [Method ((TruckinBoard PlaceRoadStops)
	   self)                                             (* sm: "27-JUN-83 18:09")

          (* * Place the RoadStops onto the GameBoard.)


	  (PROG ((numRows (@@ numRows))
		 (numColumns (@@ numColumns))
		 (roadStops (@ roadStops))
		 (milePost 0)
		 roadStop x y xIncr yIncr prev)

          (* * Compute the x and y initial values and increments.)


	        (SETQ yIncr (IPLUS (@@($ RoadStop)
				     Height)
				   (@@($ Player)
				     Height)))
	        (SETQ xIncr (@@($ RoadStop)
		    Width))
	        (SETQ y (ITIMES numRows yIncr))

          (* * Place the RoadStops on the board.)


	        (for row from numRows to 1 by -2
		   do (SETQ x 0)
		      (SETQ y (IDIFFERENCE y yIncr))
		      (for col from 1 to numColumns
			 do (SETQ roadStop (pop roadStops))
			    (COND
			      (prev (←@
				      prev next roadStop)))
			    (←@
			      roadStop prev prev)
			    (SETQ prev roadStop)
			    (SETQ milePost (ADD1 milePost))
			    (← roadStop Place x y milePost (QUOTE Right))
			    (SETQ x (IPLUS x xIncr)))
		      (SETQ x (IDIFFERENCE x xIncr))
		      (SETQ y (IDIFFERENCE y yIncr))
		      (for col from numColumns to 1 by -1
			 do (SETQ roadStop (pop roadStops))
			    (←@
			      prev next roadStop)
			    (←@
			      roadStop prev prev)
			    (SETQ prev roadStop)
			    (SETQ milePost (ADD1 milePost))
			    (← roadStop Place x y milePost (QUOTE Left))
			    (SETQ x (IDIFFERENCE x xIncr])

(TruckinBoard.ReInitializeRoadStops
  (Method ((TruckinBoard ReInitializeRoadStops)
	   self seed)                                        (* sm: "29-JUN-83 14:34")
                                                             (* Reinitializes roadstops)
	  (RANDSET seed)
	  (for x in (@ roadStops) do (← x ReInitialize))))

(TruckinBoard.ReUseBoard
  (Method ((TruckinBoard ReUseBoard)
	   self seed)                                        (* sm: " 5-JUL-83 18:40")
                                                             (* Reuses game board: displaying afresh)
	  (← self Initialize)
	  (← self ReInitializeRoadStops (RANDSET))
	  self))

(TruckinBoard.RemovePlayer
  (Method ((TruckinBoard RemovePlayer)
	   self player)                                      (* sm: "27-JUN-83 18:09")
                                                             (* Sent to game board so it can remove player from 
							     board)
	  (PROG ((truck (@ player truck))
		 loc)
	        (SETQ loc (@ truck location))
	        (COND
		  (loc (← loc Unpark player)))
	        (RETURN player))))

(TruckinCommInterface.CleanGameWorld
  (Method ((TruckinCommInterface CleanGameWorld)
	   self)                                             (* sm: "16-SEP-83 17:17")
                                                             (* Cleans up the game world after game over)
	  (← (@ playerInterface)
	     DeletePlayerProcesses)
	  (AND GameControlWindow (CLOSEW GameControlWindow))))

(TruckinCommInterface.CreateDecisionMaker
  (Method ((TruckinCommInterface CreateDecisionMaker)
	   self game)                                        (* sm: " 5-JUL-83 18:41")
                                                             (* Creates a new DecisionMaker)
                                                             (* ARGS: If NIL, then default.
							     If T, then ask user, else use the passed arg)
	  (PROG (dm gameClass)
	        [COND
		  [(AND (SETQ gameClass (GetClassRec game))
			(← gameClass Subclass (QUOTE TruckinDecisionMaker]
		  [(NULL game)
		    (SETQ gameClass (GetClassRec (GetValue self (QUOTE decisionMaker)
							   (QUOTE DefaultClass]
		  (T (SETQ gameClass (GetClassRec (INMENU "Select the game" (← ($ 
									     TruckinDecisionMaker)
									       List
									       (QUOTE Subs]
	        (SETQ dm (← gameClass New))
	        (SETQ DecisionMaker dm)
	        (←@
		  decisionMaker dm)
	        (RETURN dm))))

(TruckinCommInterface.CreateGateWay
  (Method ((TruckinCommInterface CreateGateWay)
	   self machineName postalAddress)                   (* sm: "12-JUL-83 18:51")
                                                             (* creates a gateway and links it)
	  (PROG (gclass newP machineID)
	        (OR machineName (SETQ machineName (INTTY "Give me a name for your machine: " NIL 
							 "An atom which identifies your machine"
							 T)))
	        (OR postalAddress (SETQ postalAddress (INTTY 
						"What is the address of the postMaster machine? "
							     NIL 
					      "An integer which is the PupAddress of the machine"
							     T)))
	        [SETQ gclass (GetClassRec (GetValue self (QUOTE postman)
						    (QUOTE DefaultClass]
	        (SETQ newP (← gclass New))
	        (SETQ Postman newP)
	        (←@
		  postman newP)                              (* Link to PostMaster)
	        (SETQ machineID (← Postman GetPostalBox machineName postalAddress))
	        (←@
		  machineID machineID)
	        (RETURN Postman))))

(TruckinCommInterface.CreatePlayerInterface
  (Method ((TruckinCommInterface CreatePlayerInterface)
	   self gameType)                                    (* sm: "10-JUL-83 20:22")
                                                             (* Create a PlayerInterface 
							     (if needed) matching gameType)
	  (PROG (currentPI cpiClass piClass newPI)           (* currently not checking for any prior PI.
							     My do so later if needed)
	        [SETQ piClass (GetClassRec (GetClassValue (GetObjectRec gameType)
							  (QUOTE PlayerInterface]
	        [COND
		  ((NULL piClass)                            (* no matching PlayerInterface class found.
							     ask user)
		    (SETQ piClass (GetClassRec (INMENU (CONCAT 
							 "Select PlayerInterface for game type: "
							       gameType)
						       (← ($ TruckinPlayerInterface)
							  List!(QUOTE Subs]
	        (SETQ newPI (← piClass New))
	        (←@
		  playerInterface newPI)
	        (SETQ PI (SETQ PlayerInterface newPI))
	        (RETURN PlayerInterface))))

(TruckinCommInterface.CreateSimulator
  [Method ((TruckinCommInterface CreateSimulator)
	   self display)                                     (* sm: " 9-SEP-83 15:02")
                                                             (* Creates a new simulator)
	  (PROG (sim gameClass)
	        [COND
		  [(AND (SETQ gameClass (GetClassRec display))
			(← gameClass Subclass (QUOTE TruckinSimulator]
		  [(NULL display)
		    (SETQ gameClass (GetClassRec (GetValue self (QUOTE simulator)
							   (QUOTE DefaultClass]
		  (T (SETQ gameClass (GetClassRec (INMENU "Select the game" (← ($ TruckinSimulator)
									       List
									       (QUOTE Subs]
	        (SETQ sim (← gameClass New))
	        (SETQ Simulator sim)
	        (RETURN (←@
			  simulator sim])

(TruckinCommInterface.SetInitialParameters
  (Method ((TruckinCommInterface SetInitialParameters)
	   self)                                             (* sm: "10-JUL-83 19:36")
                                                             (* Sets initial parameters)
	  self))

(TruckinCommInterface.StartWorldProcess
  (Method ((TruckinCommInterface StartWorldProcess)
	   self)                                             (* sm: " 8-AUG-83 15:50")
                                                             (* Starts world process)
	  (PROG (hand)
	        (DEL.PROCESS (FIND.PROCESS (QUOTE WorldProcess)))
	        (SETQ hand (ADD.PROCESS (LIST (QUOTE ←)
					      self
					      (QUOTE WorldProcess))
					(QUOTE NAME)
					(QUOTE WorldProcess)
					(QUOTE RESTARTABLE)
					GameProcRestFlg))
	        (←@
		  worldProcess hand)
	        (←@
		  gameStarted T)
	        (GameControlMenu)
	        (RETURN hand))))

(TruckinCommInterface.TellMe
  [Method ((TruckinCommInterface TellMe)
	   self obj)                                         (* mjs: " 2-AUG-83 11:30")
                                                             (* Adds obj to broadcastList)
	  (COND
	    ([AND (GetObjectRec obj)
		  (NOT (FMEMB (GetObjectRec obj)
			      (@ broadcastList]
	      (←@
		broadcastList
		(CONS (GetObjectRec obj)
		      (@ broadcastList)))
	      (printout TTY obj " is now on the broadcast list. Welcome to the game!!" T])

(TruckinDecisionMaker.AddBandit
  [Method ((TruckinDecisionMaker AddBandit)
	   self name)                                        (* sm: "30-JUN-83 19:30")
                                                             (* Add bandit to list)
	  (←@
	    bandits
	    (CONS (GetObjectRec name)
		  (@ bandits])

(TruckinDecisionMaker.AddPlayer
  (Method ((TruckinDecisionMaker AddPlayer)
	   self reqID name type truck deniedFlg)             (* mjs: " 2-AUG-83 11:30")
                                                             (* If player added, do initial placing for him)
	  (PROG (player locs nextLoc)                        (* Check if request denied)
	        (COND
		  (deniedFlg (RETURN NIL)))
	        (SETQ player (GetObjectRec name))
	        (COND
		  ((FMEMB player (@ players))
		    (printout TTY "Shouldnt happen!! Attempt to add player" 
			      "already in game (in Decision Maker) "
			      name T)
		    (HELPCHECK "Adding player already in game!")
		    (RETURN NIL)))
	        (←@
		  players
		  (CONS player (@ players)))                 (* position the player on the board)
	        (SETQ locs (@ roadStops))
	        (SETQ nextLoc (CAR locs))
	        (SETQ locs (CDR locs))
	    LOOP(COND
		  ((← nextLoc RoomToPark?)
		    (← Communicator MoveMade player 0 (@ nextLoc milePost)
		       (QUOTE InitialPlacing)))
		  (T (SETQ nextLoc (CAR locs))
		     (SETQ locs (CDR locs))
		     (GO LOOP)))
	        (RETURN player))))

(TruckinDecisionMaker.AddPlayerRequest
  [Method ((TruckinDecisionMaker AddPlayerRequest)
	   self reqID name type truck)                       (* sm: "10-JUL-83 20:48")
                                                             (* Decides if a new player can be added or not)
	  (PROG (player locs nextLoc)                        (* Check if another object of name)
	        (SETQ player (GetObjectRec name))
	        (RETURN (COND
			  ([OR [AND player (NOT (← player InstOf!(QUOTE Player]
			       (AND player (FMEMB name (@ playerNames]
                                                             (* conflict in player request)
			    (← Communicator AddPlayer reqID name type truck (QUOTE NameConflict)))
			  (T (←@
			       playerNames
			       (CONS player (@ playerNames)))
			     (← Communicator AddPlayer reqID name type truck NIL])

(TruckinDecisionMaker.AttachSimulator
  (Method ((TruckinDecisionMaker AttachSimulator)
	   self sim)                                         (* sm: "28-JUN-83 11:45")
                                                             (* Attaches local simulator by copying relevant info)
	  (←@
	    simulator sim)
	  (←@
	    roadStops
	    (@(@ simulator)
	      roadStops))))

(TruckinDecisionMaker.BeginGameRequest
  (Method ((TruckinDecisionMaker BeginGameRequest)
	   self)                                             (* sm: " 5-JUL-83 18:56")
                                                             (* Starts the game)
	  (PROG (move nextLoc locs)
	        (← self ChangeGameParameters)
	        (←@
		  alices
		  (for x in (@ roadStops) when (← x InstOf!(QUOTE AlicesRestaurant)) collect x))
	        (←@
		  unionHall
		  (CAR (@ roadStops)))
	        [COND
		  ((AND banditCount (GREATERP banditCount 0))
		    (for banditIndex from 1 to (IMIN banditCount (FLENGTH banditNames))
		       do (← Communicator AddBandit (CAR (NTH banditNames banditIndex]
	        (←@
		  beginTime
		  (IPLUS (IDATE)
			 (ITIMES (@ startsAfter)
				 60)))
	        (←@
		  endTime
		  (IPLUS (@ beginTime)
			 (ITIMES (@ gameDuration)
				 60)))
	        (← self InitializeGameParameters)
	        (← Communicator StartGame (@ beginTime)
		   (@ endTime))
	        (RETURN T))))

(TruckinDecisionMaker.BuyMade
  (Method ((TruckinDecisionMaker BuyMade)
	   self player roadPosition reqQty qty reason penaltyAmt fragility lifetime)
                                                             (* sm: " 1-JUL-83 09:37")
                                                             (* Dummy for now)
	  self))

(TruckinDecisionMaker.BuyRequest
  [Method ((TruckinDecisionMaker BuyRequest)
	   self player roadPosition qty)                     (* sm: " 6-JUL-83 13:42")
                                                             (* message sent to DecisionMaker to BUY qty at 
							     roadPosition)
	  (PROG (truck loc commodity intendedLoc (ctime (IDATE)))
                                                             (* check if truck at a producer roadstop)
	        (SETQ truck (@ player truck))
	        (SETQ loc (@ truck location))
	        (SETQ intendedLoc (CAR (NTH (@ roadStops)
					    roadPosition)))
	        [COND
		  ((GREATERP ctime (@ Simulator endTime))
		    (RETURN (← Communicator BuyMade player roadPosition qty 0 (QUOTE GameOver]
	        [COND
		  ((NOT (EQ loc intendedLoc))                (* player not where he thought he was)
		    (RETURN (← Communicator BuyMade player roadPosition qty 0 (QUOTE IncorrectLoc]
	        [COND
		  ([NOT (AND (GetObjectRec loc)
			     (← loc InstOf!(QUOTE Producer]
		    (RETURN (← Communicator BuyMade player roadPosition qty 0 (QUOTE NotProducer]
                                                             (* Update game status window.)
                                                             (* (WriteGameStatus (@ currentPlayer driver) " Buys " 
							     (CONCAT qty " " (GetObjectName 
							     (@@ loc Commodity)) " units")))
                                                             (* check if qty is available at RoadStop)
	        [COND
		  ((ZEROP qty)
		    (RETURN (← Communicator BuyMade player roadPosition qty 0 (QUOTE Zero]
	        [COND
		  ((AND qty (GREATERP qty (@ loc qty)))
		    (RETURN (← Communicator BuyMade player roadPosition qty 0 (QUOTE 
										MoreThanAvailable)
			       .01]                          (* transfer ownership)
	        (SETQ commodity (← (@@ loc Commodity)
				   New
				   (@ loc pr)
				   (COND
				     (qty qty)
				     (T (@ loc qty)))
				   loc))
	        (RETURN (COND
			  [(← commodity CanTransfer player NIL qty)
			    (← Communicator BuyMade player roadPosition qty (@ commodity qty)
			       NIL NIL (COND
				 ((← commodity InstOf!(QUOTE FragileCommodity))
				   (@ commodity fragility))
				 (T NIL))
			       (COND
				 ((← commodity InstOf!(QUOTE PerishableCommodity))
				   (@ commodity lifetime))
				 (T NIL]
			  (T                                 (* there was some error during transaction)
			     (← Communicator BuyMade player roadPosition qty 0 FCTReason FCTPenalty])

(TruckinDecisionMaker.ChangeGameParameters
  (Method ((TruckinDecisionMaker ChangeGameParameters)
	   self)                                             (* sm: " 5-JUL-83 17:33")
                                                             (* Changes gameParameters via inspector)
	  (PROG (gp)
	        (SETQ gp (GetItHere self (QUOTE gameParameters)))
	        (COND
		  ((EQ gp NotSetValue)
		    (SETQ gp (← (GetObjectRec (@ gameParameters))
				New))
		    (←@
		      gameParameters gp)))
	        (PROMPT "Change Game Parameters by using the displayed Inspector." 
			"When done, click DONE")
	        (← gp SetUp)
	        (while (NOT GameParaSet)
		   do (TOTOPW GameParamW)
		      (TOTOPW GameCommandW)
		      (DISMISS 500))
	        (← gp StorePara)
	        (RETURN T))))

(TruckinDecisionMaker.CheckAlice
  [Method ((TruckinDecisionMaker CheckAlice)
	   self)                                             (* sm: "27-JUN-83 10:56")
                                                             (* check AlicesRestaurant's before each turn)
	  (for x in (@ alices) do (for loc in (QUOTE (parkingPlace1 parkingPlace2))
				     do (PROGN (COND
						 ((GetValue x loc)
						   (PutValue x loc (ADD1 (GetValue x loc
										   (QUOTE howLong)))
							     (QUOTE howLong))
						   (COND
						     ((GREATERP (GetValue x loc (QUOTE howLong))
								3)
                                                             (* stayed there too long)
						       (SETQ currentPlayer (GetValue x loc))
						       (COND
							 ((← (@ unionHall)
							     RoomToPark?)
							   (BrokenRules currentPlayer 
							     "Stayed at Alices more than 3 turns"
									NIL 1 
								    "Forcibly moved to UnionHall")
							   (← self MoveRequest currentPlayer
							      (FindLocIndex x (@ roadStops))
							      (FindLocIndex (@ unionHall)
									    (@ roadStops))
							      (QUOTE AliceTurn)))
							 (T 
                                                             (* UnionHall is temporarily filled)
							    (BrokenRules currentPlayer 
							     "Stayed at Alices more than 3 turns"
									 NIL 1 
							   "Will be moved to UnionHall next turn"])

(TruckinDecisionMaker.ForcedMove
  [Method ((TruckinDecisionMaker ForcedMove)
	   self player curLoc maxMilePost reason)            (* sm: "28-JUN-83 09:57")
                                                             (* determines the loc to move currentPlayer as a forced
							     move close to maxMilePost)
	  (PROG ((cmile (@ curLoc milePost))
		 newLoc)
	        [SETQ newLoc (COND
		    ((GREATERP cmile maxMilePost)
		      (for i from maxMilePost to cmile thereis (← (CAR (NTH (@ roadStops)
									    i))
								  RoomToPark?)))
		    (T (for i from maxMilePost to cmile by -1
			  thereis (← (CAR (NTH (@ roadStops)
					       i))
				     RoomToPark?]
	        [COND
		  ((NULL newLoc)                             (* no room to park anywhere)
		    (RETURN (← Communicator MoveMade player cmile cmile (QUOTE NoRoom]
	        (SETQ newLoc (CAR (NTH (@ roadStops)
				       newLoc)))
	        (RETURN (← self MoveTruck player curLoc newLoc reason])

(TruckinDecisionMaker.GameOver
  (Method ((TruckinDecisionMaker GameOver)
	   self)                                             (* sm: " 6-JUL-83 13:13")
                                                             (* Sent when game is over)
	  (← Communicator GameOver)))

(TruckinDecisionMaker.GiveAliceBonus
  (Method ((TruckinDecisionMaker GiveAliceBonus)
	   self atAlice)                                     (* sm: "27-JUN-83 10:56")
                                                             (* Dummy method)
	  self))

(TruckinDecisionMaker.InitializeGameParameters
  (Method ((TruckinDecisionMaker InitializeGameParameters)
	   self)                                             (* sm: " 8-JUL-83 11:07")
                                                             (* Initializes critical variables for new game to run)
	  (AND gameStatusWindow (CLEARW gameStatusWindow))
	  (COND
	    (truckinLogHandle (CLOSEF? truckinLogHandle)))
	  (COND
	    [truckinLogFlg (SETQ truckinLogHandle (OPENFILE truckinLogFile (QUOTE OUTPUT]
	    (T (SETQ truckinLogHandle NIL)))
	  (←@
	    lastMoved NIL)
	  (←@
	    loseTurn NIL)))

(TruckinDecisionMaker.MonitorGame
  [Method ((TruckinDecisionMaker MonitorGame)
	   self gameOverFlg)                                 (* dgb: "15-JUL-83 00:16")
                                                             (* Monitors the game to move bandits, replenish qty, 
							     check alice, and signal game end.)
	  (PROG ((ctime (IDATE)))
	        (COND
		  (gameOverFlg (← self GameOver))
		  ((IGREATERP ctime (@ Simulator endTime)))
		  (T (← self MoveBandits)
		     (← self ReplenishQty)
		     (← self CheckAlice])

(TruckinDecisionMaker.MonitorProcess
  [Method ((TruckinDecisionMaker MonitorProcess)
	   self)                                             (* sm: " 5-JUL-83 15:00")
                                                             (* Monitors the game to move bandits, replenish qty, 
							     check alice, and signal game end)
	  (PROG (begTime endTime cTime)
	        (SETQ endTime (SETUPTIMER (@ Simulator endTime)
					  NIL NIL (QUOTE SECONDS)))
	        [BLOCK NIL (SETUPTIMER (IntervalToEvent (@ Simulator beginTime]
	        (until (TIMEREXPIRED? endTime (QUOTE SECONDS))
		   do (← self MoveBandits)
		      (← self ReplenishQty)
		      (← self CheckAlice)
		      (BLOCK))
	        (← self GameOver)
	        (RETURN (QUOTE GameOver])

(TruckinDecisionMaker.MoveBandits
  (Method ((TruckinDecisionMaker MoveBandits)
	   self)                                             (* mjs: " 4-AUG-83 10:27")
                                                             (* randomly moves bandits around on the board before 
							     each turn)
	  (PROG ((maxLoc (FLENGTH (@ roadStops)))
		 loc curLoc banditLoc direction truck cmile dmile)
	        (WriteGameStatus NIL "Watch out!! The Bandits are Moving")
	        [for x in (@ bandits)
		   do (PROGN (SETQ truck (@ x truck))
			     (SETQ direction (@ x direction))
			     (SETQ curLoc (@ truck location))
			     [SETQ banditLoc (COND
				 ((NULL (GetObjectRec curLoc))
				   (RAND 1 maxLoc))
				 (T (@ curLoc milePost]
			     [COND
			       ((AND (EQ direction (QUOTE F))
				     (GREATERP (IPLUS banditLoc banditMoveRange)
					       maxLoc))
				 (←@
				   x direction (QUOTE B)))
			       ((AND (EQ direction (QUOTE B))
				     (LESSP (IDIFFERENCE banditLoc banditMoveRange)
					    1))
				 (←@
				   x direction (QUOTE F]
			     [SETQ loc (CAR (NTH (@ roadStops)
						 (COND
						   [(RandomRoomAvailable
						       [COND
							 ((EQ direction (QUOTE F))
							   banditLoc)
							 (T (IMAX 1 (IDIFFERENCE banditLoc 
										 banditMoveRange]
						       (COND
							 ((EQ direction (QUOTE B))
							   banditLoc)
							 (T (IMIN maxLoc (IPLUS banditLoc 
										banditMoveRange]
						   (T (RandomRoomAvailable 1 maxLoc]
			     [SETQ cmile (COND
				 ((NULL curLoc)
				   0)
				 (T (FindLocIndex curLoc (@ roadStops]
			     (SETQ dmile (FindLocIndex loc (@ roadStops)))
			     (WriteGameStatus (@ x driver)
					      " Moves to "
					      (@@ loc RoadSign))
			     (← Communicator MoveMade x cmile dmile (QUOTE BanditMove]
	        (RETURN T))))

(TruckinDecisionMaker.MoveCheckingHazards
  [Method ((TruckinDecisionMaker MoveCheckingHazards)
	   self player curLoc newLoc reason)                 (* sm: "28-JUN-83 09:59")
                                                             (* moves truck checking for hazards along the way.
							     Called by GameMaster.MoveTruck)
	  (PROG (cmile (dmile (@ newLoc milePost))
		       whoStopped rs forcedIndex dist fuelNeeded (truck (@ player truck)))
	        [COND
		  ((NOT (EQ curLoc (@ truck location)))
		    (INTTYL "Bug in MoveCheckingHazards" NIL "Type return to continue.")
		    (SETQ curLoc (@ truck location]
	        (SETQ cmile (@ curLoc milePost))
	        (SETQ dist (IDIFFERENCE (IMAX cmile dmile)
					(IMIN cmile dmile)))
                                                             (* check for WeighStations and Bandits)
	        [SETQ forcedIndex (for i from cmile to dmile by (COND
								  ((GREATERP cmile dmile)
								    -1)
								  (T 1))
				     when (AND (NOT (EQUAL i cmile))
					       (NOT (EQUAL i dmile)))
				     eachtime (SETQ rs (CAR (NTH (@ gameMaster roadStops)
								 i)))
				     thereis (SETQ whoStopped (← rs GoingPast player dist]
	        (COND
		  (forcedIndex (SETQ newLoc (CAR (NTH (@ roadStops)
						      forcedIndex)))
			       (SETQ dmile forcedIndex)))
	        (RETURN (← Communicator MoveMade player cmile dmile (OR whoStopped reason])

(TruckinDecisionMaker.MoveMade
  [Method ((TruckinDecisionMaker MoveMade)
	   self player fromStop toStop reason penaltyAmount missTurns)
                                                             (* sm: "26-JUL-83 09:45")
                                                             (* Generates new MaxMove for player and checks for 
							     Alice overstay)
                                                             (* update commodity status affected by moves)
	  (COND
	    ((← player InstOf!(QUOTE Player))                (* if not bandit or gasman)
                                                             (* (for y in (@ (@ player truck) cargo) do 
							     (DoFringeMethods y (QUOTE UpdateStatus))))
	      (COND
		((EQ reason (QUOTE GameOver)))
		(T (← Communicator MaxMove player (RAND 1 (@@(@ player truck)
							  MaxDist])

(TruckinDecisionMaker.MoveRequest
  [Method ((TruckinDecisionMaker MoveRequest)
	   self player from to reason)                       (* sm: " 6-SEP-83 14:52")
                                                             (* sent to DecisionMaker for deciding if move can be 
							     made)
                                                             (* reason, if given is used for system generated 
							     requests and is not charged as a move to player)
	  (PROG ((truck (@ player truck))
		 curLoc moves (cli from)
		 (nli to)
		 (gb GameBoard)
		 maxLoc
		 (maxMove (@ player maxMove))
		 (newLoc to)
		 fromLoc
		 (ctime (IDATE)))
	        (SETQ maxLoc (ITIMES (@@ gb numRows)
				     (@@ gb numColumns)))
	        (SETQ curLoc (@ truck location))
	        (SETQ fromLoc (CAR (NTH (@ roadStops)
					from)))
	        [COND
		  ((GREATERP ctime (@ Simulator endTime))
		    (RETURN (← Communicator MoveMade player from from (QUOTE GameOver]
	        [COND
		  ((NOT (EQ curLoc fromLoc))                 (* player not where he thought he was)
		    (RETURN (← Communicator MoveMade player from from (QUOTE IncorrectLoc]

          (* (COND ((AND (NOT reason) (EQ player (@ lastMoved))) (RETURN (← Communicator MoveMade player cli cli 
	  (QUOTE ConsecutiveMove))))) (COND ((NOT reason) (* set last moved only when no System Reason) 
	  (←@ lastMoved player))))


	        [COND
		  [(NUMBERP to)
		    (COND
		      [(LESSP nli 1)
			(RETURN (← Communicator MoveMade player cli cli (QUOTE OffBoardBeg]
		      [(GREATERP nli maxLoc)
			(RETURN (← Communicator MoveMade player cli cli (QUOTE OffBoardEnd]
		      (T (SETQ newLoc (CAR (NTH (@ roadStops)
						nli]
		  [(FMEMB to (@ roadStops))
		    (SETQ nli (FindLocIndex to (@ roadStops]
		  (T (BrokenRules player (CONCAT "Illegal location: " to))
		     (RETURN (← Communicator MoveMade player cli cli (QUOTE IllegalLoc]
                                                             (* if asked to go to UnionHall dont check any more)
	        [COND
		  ((← newLoc InstOf!(QUOTE UnionHall))
		    (RETURN (← self MoveTruck player curLoc newLoc reason]
	        [COND
		  ((OR (GREATERP nli (PLUS cli maxMove))
		       (LESSP nli (DIFFERENCE cli maxMove)))
		    (RETURN (← Communicator MoveMade player cli cli (QUOTE MoreThanAllowed)
			       NIL 1]                        (* check if want to move to curLoc)
	        [COND
		  ((EQ newLoc curLoc)                        (* no moves are made)
		    (RETURN (← Communicator MoveMade player cli cli (QUOTE AlreadyThere]
	        (RETURN (← self MoveTruck player curLoc newLoc reason])

(TruckinDecisionMaker.MoveTruck
  [Method ((TruckinDecisionMaker MoveTruck)
	   self player curLoc newLoc reason)                 (* sm: "28-JUN-83 10:01")
                                                             (* actually moves the currentPlayer's truck)

          (* reason -
	  if NIL then move asked by user. else is the reason for the move, where the actual loc will be different from the 
	  original request)


	  (PROG (dist cmile dmile (truck (@ player truck))
		      fuelNeeded actMile forcedMP)           (* check if want to go to UnionHall)
	        (SETQ cmile (@ curLoc milePost))
	        (SETQ dmile (@ newLoc milePost))
	        [COND
		  ((← newLoc InstOf!(QUOTE UnionHall))
		    (COND
		      ((← newLoc RoomToPark?)
			(RETURN (← Communicator MoveMade player cmile dmile reason)))
		      (T (RETURN (← Communicator MoveMade player cmile cmile (OR reason (QUOTE 
										    NoRoomStayPut]
                                                             (* check if truck has fuel)
	        (SETQ dist (IDIFFERENCE (IMAX cmile dmile)
					(IMIN cmile dmile)))
	        (SETQ fuelNeeded (TIMES dist (@@ truck Gpm)))
	        (COND
		  ((GREATERP fuelNeeded (@ truck fuel))
		    [SETQ actMile (FIX (FQUOTIENT (@ truck fuel)
						  (@@ truck Gpm]
		    [COND
		      ((ZEROP actMile)                       (* has no fuel -
							     move to UnionHall)
			(RETURN (← self MoveTruck player curLoc (@ unionHall)
				   (QUOTE NoFuel]
		    [SETQ forcedMP (COND
			((GREATERP dmile cmile)
			  (PLUS cmile actMile))
			(T (DIFFERENCE cmile actMile]
		    (← self ForcedMove player curLoc forcedMP (QUOTE LowFuel))
		    (RETURN NIL)))                           (* enough fuel for the move)
                                                             (* check if room at intended location)
	        (COND
		  ((← newLoc RoomToPark?))
		  (T (← self ForcedMove player curLoc dmile (QUOTE NoRoom))
		     (RETURN NIL)))
	        (RETURN (← self MoveCheckingHazards player curLoc newLoc reason])

(TruckinDecisionMaker.NewGameRequest
  (Method ((TruckinDecisionMaker NewGameRequest)
	   self board)                                       (* sm: " 5-JUL-83 18:42")
                                                             (* Generates seed for a new game)
                                                             (* board -
							     type of gameBoard needed (BW, Color etc))
	  (PROG (gbClass seed)
	        [COND
		  [(AND (SETQ gbClass (GetClassRec board))
			(← gbClass Subclass (QUOTE TruckinBoard]
		  [(NULL board)
		    (SETQ gbClass (GetClassRec (QUOTE BWTruckin]
		  (T (SETQ gbClass (GetClassRec (INMENU "Select type of Game Board"
							(← ($ TruckinBoard)
							   List
							   (QUOTE Subs]
	        (← Communicator NewGame (SETQ seed (RANDSET T))
		   (GetObjectName gbClass)
		   (GetObjectName (Class self)))
	        (← self AttachSimulator (@ Communicator simulator))
                                                             (* initialize IVs which change game to game)
	        (← self Initialize)
	        (←@
		  gameSeed seed)
	        (RETURN seed))))

(TruckinDecisionMaker.ReUseGameRequest
  (Method ((TruckinDecisionMaker ReUseGameRequest)
	   self)                                             (* sm: " 5-JUL-83 13:57")
                                                             (* Generates a new seed for reusing existing game)
	  (PROG (seed)
	        (←@
		  gameSeed
		  (SETQ seed (RANDSET T)))
	        (← self Initialize)
	        (← Communicator ReUseGame seed)
	        (RETURN seed))))

(TruckinDecisionMaker.RedoGameParameters
  (Method ((TruckinDecisionMaker RedoGameParameters)
	   self)                                             (* sm: " 8-JUL-83 14:34")
                                                             (* Dummy. Needed if some game parameters need to be 
							     changed after the players are known)
	  self))

(TruckinDecisionMaker.RemovePlayer
  (Method ((TruckinDecisionMaker RemovePlayer)
	   self player reason)                               (* sm: "10-JUL-83 21:20")
                                                             (* removes player from game)
	  (PROG NIL

          (* (WriteGameStatus (@ player driver) " Committed serious violation: " reason) (COND ((EQ (QUOTE YES) 
	  (EVAL.IN.TTY.PROCESS (INTTY (CONCAT "Should I remove " (@ player driver) " from game?") (QUOTE 
	  (YES NO)) "Y to remove. N to let stay in game") T)))))


	        (←@
		  players
		  (REMOVE player (@ players)))
	        (←@
		  playerNames
		  (REMOVE (@ player driver)
			  (@ playerNames)))
	        (← Communicator RemovePlayer player reason)
	        (RETURN player))))

(TruckinDecisionMaker.RemovePlayerRequest
  (Method ((TruckinDecisionMaker RemovePlayerRequest)
	   self player reason)                               (* sm: "10-JUL-83 21:15")
                                                             (* Request to remove player)
	  (← self RemovePlayer player reason)))

(TruckinDecisionMaker.ReplenishQty
  (Method ((TruckinDecisionMaker ReplenishQty)
	   self)                                             (* sm: "28-JUN-83 10:03")
                                                             (* replenish GasStations qty)
	  (PROG (gasMan gasStations (prevStop 0)
			nextStop unionHall (roadStops (@ roadStops)))
	        (SETQ gasStations (for gasStation in roadStops when (AND (← gasStation InstOf!($
									      GasStation))
									 (← gasStation RoomToPark?)
									 (ZEROP (@ gasStation qty)))
				     collect gasStation))
	        (COND
		  (gasStations (for x in gasStations
				  do (← Communicator GasFill prevStop (SETQ nextStop
					  (FindLocIndex x roadStops))
					(GetInitialValue x (QUOTE qty))
					(TIMES 2 (@ x pr)))
				     (SETQ prevStop nextStop))
			       (← Communicator GasFill prevStop 0)))
	        (RETURN gasStations))))

(TruckinDecisionMaker.SellMade
  (Method ((TruckinDecisionMaker SellMade)
	   self player roadPosition reqQty qty cargoPos reason penaltyAmt)
                                                             (* sm: " 1-JUL-83 09:38")
                                                             (* Dummy for now)
	  self))

(TruckinDecisionMaker.SellRequest
  [Method ((TruckinDecisionMaker SellRequest)
	   self player roadPosition commodityIndex qty)      (* sm: " 6-SEP-83 14:42")
                                                             (* message sent to DecisionMaker to sell qty of 
							     commodity at the player's roadPosition.)
                                                             (* commodityIndex -
							     index into cargo of player)
	  (PROG (truck loc commodity intendedLoc commodities (ctime (IDATE)))
                                                             (* check if truck at a Consumer RoadStop)
	        (SETQ truck (@ player truck))
	        (SETQ loc (@ truck location))
	        (SETQ intendedLoc (CAR (NTH (@ roadStops)
					    roadPosition)))
	        [COND
		  ((GREATERP ctime (@ Simulator endTime))
		    (RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
			       (QUOTE GameOver]
	        [COND
		  ((NOT (EQ loc intendedLoc))                (* player is not where he thought he was)
		    (RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
			       (QUOTE IncorrectLoc]
	        [COND
		  ([NOT (AND (GetObjectRec loc)
			     (← loc InstOf!(QUOTE Consumer]
		    (RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
			       (QUOTE NotConsumer]           (* check if trying to sell 0)
                                                             (* check if commodityIndex is class or actual commodity
							     index)
	        [COND
		  [(NUMBERP commodityIndex)
		    (COND
		      [(ZEROP commodityIndex)
			(RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
				   (QUOTE IncorrectRequest]
		      [(GREATERP commodityIndex (FLENGTH (@ truck cargo)))
			(RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
				   (QUOTE NotOwned]
		      (T (SETQ commodity (CAR (NTH (@ truck cargo)
						   commodityIndex]
		  (T (RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
				(QUOTE IncorrectCommodity]   (* (WriteGameStatus (@ currentPlayer driver) " Sells " 
							     (CONCAT qty " " (ClassName commodity) " units.")))
                                                             (* check if truck has qty)
	        [COND
		  ((NULL qty)
		    (SETQ qty (@ commodity qty]
	        [COND
		  ((ZEROP qty)
		    (RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
			       (QUOTE CannotSellZero]
	        [COND
		  ((GREATERP qty (@ commodity qty))
		    (RETURN (← Communicator SellMade player roadPosition qty 0 commodityIndex
			       (QUOTE MoreThanOwned)
			       .1]                           (* transfer ownership)
	        (RETURN (COND
			  ((← commodity CanTransfer loc (@ loc pr)
			      qty)
			    (← Communicator SellMade player roadPosition qty qty commodityIndex))
			  (T                                 (* there was some error during transaction)
			     (← Communicator SellMade player roadPosition qty 0 commodityIndex 
				FCTReason FCTPenalty])

(TruckinDecisionMaker.StartGame
  (Method ((TruckinDecisionMaker StartGame)
	   self)                                             (* sm: " 8-JUL-83 14:30")
                                                             (* Starts game)
                                                             (* (← self StartMonitorProcess) 
							     (← self RedoGameParameters))
	  T))

(TruckinDecisionMaker.StartMonitorProcess
  (Method ((TruckinDecisionMaker StartMonitorProcess)
	   self)                                             (* sm: " 1-JUL-83 14:47")
                                                             (* Start the monitor process)
	  (ADD.PROCESS (LIST (QUOTE ←)
			     self
			     (QUOTE MonitorProcess))
		       (QUOTE GameMonitor))))

(TruckinDecisionMaker.UpdateAlice
  [Method ((TruckinDecisionMaker UpdateAlice)
	   self player)                                      (* sm: "13-JUL-83 09:35")
                                                             (* Decides when parked at Alice)
	  (for x in (@ alices) do (for loc in (QUOTE (parkingPlace1 parkingPlace2))
				     do (COND
					  ((EQ player (GetValue x loc))
					    [COND
					      ((ZEROP (GetValue x loc (QUOTE howLong)))
						(← Communicator ParkedAtAlice player
						   (GetValue x loc (QUOTE timeParked]
					    (PutValue x loc (ADD1 (GetValue x loc (QUOTE howLong)))
						      (QUOTE howLong])

(TruckinPlayerInterface.AddPlayer
  (Method ((TruckinPlayerInterface AddPlayer)
	   self reqID name type truck deniedFlg)             (* sm: "16-SEP-83 16:41")
                                                             (* New player being added to game)
	  (PROG (plClass player)
	        (SETQ player (GetObjectRec name))
	        (COND
		  (deniedFlg [COND
			       ((EQUAL reqID (@ Communicator machineID))
                                                             (* local request was denied.
							     Destroy previously created object)
				 (WriteGameStatus "Request to create player " name
						  (CONCAT " denied: " deniedFlg 
							  " Create another player"))
				 (AND player (← player Destroy]
			     (RETURN NIL)))                  (* check if this was a requested local player)
	        (COND
		  ([AND (EQUAL reqID (@ Communicator machineID))
			(NOT (FMEMB player (@ localPlayers]
		    (←@
		      localPlayers
		      (CONS player (@ localPlayers)))        (* Create a process for player if local player)
		    (← (@ player truck)
		       Initialize)
		    (← player Initialize)
		    (← self CreatePlayerProcess player T)
		    [COND
		      ((@ Simulator gameRunningFlg)
			(AND (@ playerMenuWindow)
			     (CLOSEW (@ playerMenuWindow)))
			(←@
			  playerMenuWindow
			  (PlayerInterruptMenu (for x in (@ localPlayers) collect (@ x driver))
					       (@ self playerMenuWindow position]
		    (pushnew ExistingPlayers player))
		  (T                                         (* Not local so create a RemotePlayer)
		     (SETQ plClass ($ RemotePlayer))
		     (SETQ player (← plClass New name truck type))
                                                             (* Initialize player and truck)
		     (← player Initialize)
		     (← (@ player truck)
			Initialize)))
	        (←@
		  player remoteMachine reqID)                (* (←@ players (CONS player 
							     (@ players))))
	        (RETURN player))))

(TruckinPlayerInterface.AddPlayerRequest
  (Method ((TruckinPlayerInterface AddPlayerRequest)
	   self playerName playerType truckType)             (* sm: "10-JUL-83 20:28")
                                                             (* A request to create a new Player)
                                                             (* If playerName is an instance of Player, then used 
							     with other two args extracted from it)
	  (PROG (plClass player)
	        [COND
		  [(SETQ player (GetObjectRec playerName))
		    (COND
		      [(NOT (FMEMB player (@ Simulator players]
		      (T (WriteGameStatus "Cannot use " playerName 
					  " as player - another object by that name exists!")
			 (RETURN NIL]
		  (T                                         (* get needed info from user)
		     (SETQ player (CreateNewPlayer playerName playerType truckType]
	        [SETQ truckType (GetObjectName (Class (@ player truck]
	        (SETQ playerType (GetObjectName (Class player)))
	        (SETQ playerName (@ player driver))
	        (← Communicator AddPlayerRequest (@ Communicator machineID)
		   playerName playerType truckType))))

(TruckinPlayerInterface.BeginGame
  (Method ((TruckinPlayerInterface BeginGame)
	   self players moves)                               (* sm: " 1-JUL-83 17:11")

          (* * Starts a new game. Players is either the number of players or a list of Player objects.
	  If players is NIL, but the gameMaster has previous players, it uses those.)


	  (PROG (board)
	        (SETQ board GameBoard)
	        (SetMachineDepPara)
	        (← board MakeDriveBitMaps)
	        (COND
		  ((OR (@ Simulator players)
		       (@ Simulator bandits))                (* if this board has been used before, ask for a new 
							     game on it)
		    (← Communicator ReUseGameRequest)))      (* Ask user to select players)
	        (← self SelectPlayers players)
	        (← Communicator BeginGameRequest)
	        (RETURN T))))

(TruckinPlayerInterface.Buy
  [Method ((TruckinPlayerInterface Buy)
	   self player qty)                                  (* sm: "10-JUL-83 18:35")
                                                             (* message sent by currentPlayer to BUY qty at its 
							     current location)
	  (PROG (truck loc cmile)
	        [COND
		  ((NUMBERP qty)
		    (SETQ qty (FIX qty]
	        (SETQ truck (@ player truck))
	        (SETQ loc (@ truck location))
	        (SETQ cmile (FindLocIndex loc (@ roadStops)))
                                                             (* Update game status window.)
	        (WriteGameStatus (@ player driver)
				 " Wants to Buy "
				 (CONCAT qty " " (GetObjectName (@@ loc Commodity))
					 " units"))
	        (←@
		  player pendingRequest (LIST (QUOTE BuyRequest)
					      player cmile qty))
	        (RETURN (← self SuspendPlayer player T])

(TruckinPlayerInterface.BuyMade
  [Method ((TruckinPlayerInterface BuyMade)
	   self player roadPosition reqQty qty reason penaltyAmt fragility lifetime)
                                                             (* sm: " 6-JUL-83 11:14")
                                                             (* check if for local player)
	  (COND
	    ((FMEMB player (@ localPlayers))                 (* set the reason when awakened)
	      (← self PlayerRequestComplete player reason])

(TruckinPlayerInterface.ChargeTime
  (Method ((TruckinPlayerInterface ChargeTime)
	   self player clockTime)                            (* sm: " 6-JUL-83 13:09")
                                                             (* Calculates the actual time to be charged to player)
                                                             (* if clockTime is NIL, MinMoveTime is charged)
	  (PROG (time charge used)
	        (SETQ used (IDIFFERENCE clockTime (@ player startedAt)))
	        [SETQ time (IDIFFERENCE used (IPLUS (@ player unchargedTime)
						    (@@ player Handicap]
                                                             (* (SETQ charge (SETQ time (FIX 
							     (ITIMES time HandicapRatio)))))
	        (SETQ charge time)
	        [COND
		  ((LESSP time (@@ MinMoveTime))
		    (SETQ charge (@@ MinMoveTime)))
		  ((GREATERP time (@@ MaxMoveTime))          (* player exceeded limit. Yank from game)
                                                             (* currently not yanked)
                                                             (* (← self RemovePlayer player 
							     (CONCAT "Too much time taken " charge)))
		    ]
	        (←@
		  player timeUsed (IPLUS charge (@ player timeUsed)))
	        (AND debugTimeTrace (WriteGameStatus (CONCAT "Time Used: by " (@ player driver))
						     (CONCAT "Elapsed(sec)" used)))
	        (AND timeTrace (WriteGameStatus "Time Charged to: " (@ player driver)
						(CONCAT " " charge " sec")))
	        (RETURN charge))))

(TruckinPlayerInterface.CheckLocalPlayers
  [Method ((TruckinPlayerInterface CheckLocalPlayers)
	   self)                                             (* sm: "16-SEP-83 17:09")
                                                             (* Checks to make sure that all local players have 
							     processes)
                                                             (* Should be needed only in abnormal situations, e.g., 
							     machine crashes or manual deletion of a player's 
							     process)
	  (for x in (@ localPlayers) do (COND
					  ((PROCESSP (@ x processHandle)))
					  (T                 (* process has disappeared. recreate)
					     (printout TTY "SysWarning: process for "
						       (@ x driver)
						       " has disappeared. Recreating the process." T)
					     (← self CreatePlayerProcess x])

(TruckinPlayerInterface.ContinueGame
  (Method ((TruckinPlayerInterface ContinueGame)
	   self noRedrawFlg)                                 (* sm: "27-JUN-83 11:01")
                                                             (* to resume a game in the middle.)
	  (PROG ((board (@ gameBoard)))
	        [COND
		  ((NULL noRedrawFlg)                        (* redisplays the game board)
		    (CLEARW (@ board gameWindow))
		    (← board DisplayGameBoard)               (* (← board PlaceRoadStops))
		    (for rs in (@ board roadStops)
		       do (←@
			    rs parkingPlace1 NIL)
			  (←@
			    rs parkingPlace2 NIL))
		    (for p in (@ players)
		       do (SETQ currentPlayer p)
			  (← (@(@ p truck)
			       location)
			     Park))
		    (for b in (@ bandits)
		       do (SETQ currentPlayer b)
			  (← (@(@ b truck)
			       location)
			     Park]                           (* resume game)
	        (← self RunGame)
	        (← self WhoWon)
	        (WriteGameStatus NIL "Simulation Complete! " (DATE))
	        (AND truckinLogHandle (CLOSEF? truckinLogHandle))
	        (SETQ truckinLogHandle NIL)
	        (RETURN "Simulation Complete!"))))

(TruckinPlayerInterface.CreatePlayerProcess
  (Method ((TruckinPlayerInterface CreatePlayerProcess)
	   self player staySuspendFlg)                       (* sm: "16-SEP-83 17:07")
                                                             (* Creates a process for player and suspends the 
							     process)
                                                             (* marks player to stay suspended if staySuspendFlg is 
							     non-NIL)
	  (PROG (hand)
	        (DEL.PROCESS (FIND.PROCESS (@ player driver)))
	        (SETQ hand (ADD.PROCESS (LIST (QUOTE ←)
					      player
					      (QUOTE StartGame))
					(QUOTE NAME)
					(@ player driver)
					(QUOTE RESTARTABLE)
					PlayerProcRestFlg))
	        (←@
		  player processHandle hand)
	        [COND
		  ((FMEMB player (@ suspendedPlayers)))
		  (T (←@
		       suspendedPlayers
		       (CONS player (@ suspendedPlayers]
	        (COND
		  (staySuspendFlg (←@
				    player staySuspend staySuspendFlg)))
	        (SUSPEND.PROCESS hand))))

(TruckinPlayerInterface.DeletePlayerProcesses
  [Method ((TruckinPlayerInterface DeletePlayerProcesses)
	   self)                                             (* sm: "12-JUL-83 16:33")
                                                             (* Deletes players processes after the game)
	  (for x in (@ localPlayers) do (DEL.PROCESS (@ x processHandle)))
	  (AND (@ playerMenuWindow)
	       (CLOSEW (@ playerMenuWindow])

(TruckinPlayerInterface.Move
  [Method ((TruckinPlayerInterface Move)
	   self player newLoc)                               (* dgb: "15-JUL-83 00:25")
                                                             (* sent by to move to newLoc)
	  (PROG ((truck (@ player truck))
		 curLoc cli nli maxLoc (gb GameBoard))
	        (SETQ maxLoc (ITIMES (@@ gb numRows)
				     (@@ gb numColumns)))
	        (SETQ curLoc (@ truck location))
	        [SETQ cli (COND
		    ((NULL curLoc)
		      0)
		    (T (FindLocIndex curLoc (@ roadStops]
	        [COND
		  ((NUMBERP newLoc)
		    (SETQ nli (PLUS cli newLoc)))
		  [(FMEMB newLoc (@ roadStops))
		    (SETQ nli (FindLocIndex newLoc (@ roadStops]
		  (T (BrokenRules player (CONCAT "Illegal location: " newLoc]
	        (WriteGameStatus (@ player driver)
				 (CONCAT " Wants to Move " (IDIFFERENCE nli cli))
				 (CONCAT " (max " (@ player maxMove)
					 ")"))
	        (COND
		  ((AND (GREATERP nli 0)
			(LEQ nli maxLoc))
		    (SETQ newLoc (CAR (NTH (@ roadStops)
					   nli)))
		    (WriteGameStatus " To: " (@@ newLoc RoadSign)
				     NIL T))
		  (T (WriteGameStatus NIL NIL NIL T)))
	        (←@
		  player pendingRequest (LIST (QUOTE MoveRequest)
					      player cli nli))
	        (RETURN (← self SuspendPlayer player T])

(TruckinPlayerInterface.MoveMade
  [Method ((TruckinPlayerInterface MoveMade)
	   self player fromStop toStop reason penaltyAmount missTurns)
                                                             (* sm: " 6-JUL-83 11:15")
                                                             (* check if for local player)
	  (COND
	    ((FMEMB player (@ localPlayers))                 (* ask to be resumed)
	      (← self PlayerRequestComplete player reason])

(TruckinPlayerInterface.NewGame
  (Method ((TruckinPlayerInterface NewGame)
	   self seed boardType gameType)                     (* sm: " 5-JUL-83 13:33")
                                                             (* Adds roadStops locally)
	  (←@
	    roadStops
	    (@ Simulator roadStops))
	  (← self Initialize)))

(TruckinPlayerInterface.NewGameRequest
  (Method ((TruckinPlayerInterface NewGameRequest)
	   self board)                                       (* sm: "29-JUN-83 13:14")
                                                             (* Request for creating a new game of existing type)
                                                             (* board -
							     type of GameBoard desired)
	  (← Communicator NewGameRequest board)))

(TruckinPlayerInterface.PlayerRequestComplete
  [Method ((TruckinPlayerInterface PlayerRequestComplete)
	   self player reason)                               (* sm: "10-JUL-83 11:28")
                                                             (* if player passed as arg, set wakeReason)
	  (COND
	    (player (←@
		      player wakeReason reason)
		    (←@
		      player staySuspend NIL])

(TruckinPlayerInterface.ReUseGame
  (Method ((TruckinPlayerInterface ReUseGame)
	   self)                                             (* sm: " 5-JUL-83 13:34")
                                                             (* Received when the current board is used for a new 
							     game)
	  (← self Initialize)))

(TruckinPlayerInterface.RemovePlayer
  [Method ((TruckinPlayerInterface RemovePlayer)
	   self player reason)                               (* sm: "10-JUL-83 21:18")
                                                             (* New method template)
	  (COND
	    ((FMEMB player (@ localPlayers))
	      (DREMOVE player (@ localPlayers))
	      (DREMOVE player (@ suspendedPlayers))
	      (AND (@ player processHandle)
		   (DEL.PROCESS (@ player processHandle])

(TruckinPlayerInterface.RemovePlayerRequest
  (Method ((TruckinPlayerInterface RemovePlayerRequest)
	   self player reason)                               (* mjs: " 2-AUG-83 11:33")
                                                             (* Request to remove player)
	  (PROG NIL
	        (SETQ player (GetObjectRec player))
	        (COND
		  ([OR (NOT player)
		       (NOT (← player InstOf!(QUOTE Player]
		    (printout TTY "Are you kidding! " player " is NOT a player" T)
		    (RETURN NIL)))
	        (COND
		  ((NOT (FMEMB player (@ localPlayers)))
		    (printout TTY "Cannot remove non-local player" T)
		    (RETURN NIL)))
	        (← Communicator RemovePlayerRequest player (OR reason (QUOTE LocalRequest)))
	        (RETURN player))))

(TruckinPlayerInterface.RunNextPlayer
  [Method ((TruckinPlayerInterface RunNextPlayer)
	   self)                                             (* sm: " 6-JUL-83 11:16")
                                                             (* Decides who to run next -)
                                                             (* This is one of the few methods which need to be 
							     changed to get different strategies for scheduling 
							     players)
	  (PROG NIL
	        (AND (@ Simulator gameRunningFlg)
		     (COND
		       ((FMEMB player (@ suspendedPlayers))
			 (DREMOVE player (@ suspendedPlayers))
			 (WAKE.PROCESS (@ player processHandle)
				       (NOT reason])

(TruckinPlayerInterface.ScheduleNextPlayer
  [Method ((TruckinPlayerInterface ScheduleNextPlayer)
	   self)                                             (* sm: "16-SEP-83 17:02")
                                                             (* Decides who to run next -)
	  (PROG (currPlayer pendReq waitTime)
	        (COND
		  [(@ localPlayers)
		    (COND
		      ((EQUAL (FLENGTH (@ localPlayers))
			      (FLENGTH (@ suspendedPlayers)))
                                                             (* all suspended. Pick one)
			[for p bind (minTimeSoFar ← 10000000) in (@ suspendedPlayers)
			   do (COND
				((ILESSP (@ p timeUsed)
					 minTimeSoFar)
				  (SETQ currPlayer p)
				  (SETQ minTimeSoFar (@ p timeUsed]
			[COND
			  (currPlayer (←@
					suspendedPlayers
					(REMOVE currPlayer (@ suspendedPlayers)))
				      (←@
					runningPlayer currPlayer)
				      [COND
					((SETQ pendReq (@ currPlayer pendingRequest))
					  (←@
					    currPlayer pendingRequest NIL)
					  (PutValue currPlayer (QUOTE pendingRequest)
						    pendReq
						    (QUOTE inProcess))
					  (PutValue currPlayer (QUOTE pendingRequest)
						    (IDATE)
						    (QUOTE whenSent))
					  (ApplyMethod Communicator (CAR pendReq)
						       (CDR pendReq]
				      (←@
					unchargedTime 0)
				      (←@
					currPlayer schCount (ADD1 (@ currPlayer schCount)))
				      (COND
					[(@ currPlayer staySuspend)
					  (COND
					    ((IGREATERP (SETQ waitTime (IDIFFERENCE (IDATE)
										    (@ currPlayer 
										   pendingRequest 
										       whenSent)))
							60)
					      (printout TTY "SysWarning: over " waitTime 
						      " secs have elapsed since request sent by "
							(@ currPlayer driver)
							T]
					(T (← self WakePlayer currPlayer]
			(RETURN currPlayer))
		      (T                                     (* one player already running)
			 (COND
			   ((@ runningPlayer)
			     [COND
			       [(@(@ runningPlayer)
				   staySuspend)
				 (COND
				   ((IGREATERP (SETQ waitTime (IDIFFERENCE (IDATE)
									   (@(@ runningPlayer)
									     pendingRequest whenSent))
						 )
					       60)
				     (printout TTY "SysWarning: over " waitTime 
					       " secs have elapsed since request sent by "
					       (@(@ runningPlayer)
						 driver)
					       T]
			       (T (← self WakePlayer (@ runningPlayer]
			     (RETURN (@ runningPlayer)))
			   (T (printout TTY "Shouldnt Happen!! Scheduled player is NOT known" T)
			      (HELPCHECK "What happened to scheduled player?")
			      (← self CheckLocalPlayers)
			      (RETURN NIL]
		  (T (RETURN NIL])

(TruckinPlayerInterface.SelectPlayers
  (Method ((TruckinPlayerInterface SelectPlayers)
	   self players)                                     (* mjs: " 2-AUG-83 11:35")
                                                             (* Asks user to select players)
	  (PROG NIL
	        (←@
		  localPlayers NIL)
	        (COND
		  ((AND (EQ players T)
			ExistingPlayers)                     (* ask existing players to be added to game)
		    (SETQ players ExistingPlayers)))
	        (COND
		  ((OR (NUMBERP players)
		       (NULL players))
		    (SETQ players (CreatePlayers ExistingPlayers)))
		  ((ATOM players)
		    (printout TTY "Illegal arg" -3 players T)
		    (RETURN NIL)))
	        (for x in (INTERSECTION players players) do (← self AddPlayerRequest x))
	        (RETURN players))))

(TruckinPlayerInterface.Sell
  [Method ((TruckinPlayerInterface Sell)
	   self player commodity qty)                        (* sm: " 6-SEP-83 14:28")
                                                             (* message sent by currentPlayer to sell qty of 
							     commodity at the player's current location.)

          (* commodity is either an instance of commodity or a class of commodity. In the latter case, the game master will 
	  try to find the proper instance if any from the cargo of the truck)


	  (PROG (truck loc commodityIndex commodityClass commodities cmile)
	        [COND
		  ((NUMBERP qty)
		    (SETQ qty (FIX qty]
	        (SETQ truck (@ player truck))
	        (SETQ loc (@ truck location))
	        (SETQ cmile (FindLocIndex loc (@ roadStops)))
                                                             (* check if commodity is class or actual commodity 
							     instance)
	        (COND
		  [(AND (GetObjectRec commodity)
			(← (GetObjectRec commodity)
			   InstOf!(QUOTE Commodity)))
		    (SETQ commodityIndex (FindLocIndex (GetObjectRec commodity)
						       (@ truck cargo]
		  [(AND (GetClassRec commodity)
			(← (GetClassRec commodity)
			   Subclass
			   (QUOTE Commodity)))               (* get commodity instance from cargo)
		    (SETQ commodities (for x in (@ truck cargo) when (← x InstOf! commodity)
					 collect x))
		    (COND
		      ((NULL commodities)
			(WriteGameStatus (@ player driver)
					 " does not own " commodity)
			(SETQ commodity NIL)
			(SETQ commodityIndex 0))
		      [(NULL qty)                            (* no qty specified. pick any from cargo)
			(SETQ commodity (CAR commodities))
			(SETQ commodityIndex (FindLocIndex commodity (@ truck cargo]
		      (T                                     (* get the instance with at least specified qty)
			 [SETQ commodity (for x in commodities thereis (NOT (LESSP qty
										   (@ x qty]
			 [COND
			   ((NULL commodity)                 (* no instance with qty -
							     pick any)
			     (SETQ commodity (CAR commodities]
			 (SETQ commodityIndex (FindLocIndex commodity (@ truck cargo]
		  (T (WriteGameStatus (@ player driver)
				      " selling incorrect commodity: " commodity)
		     (SETQ commodity NIL)
		     (SETQ commodityIndex 0)))               (* Update Status Window.)
	        [COND
		  ((AND (GetObjectRec commodity)
			(← (GetObjectRec commodity)
			   InstOf!(QUOTE Commodity)))
		    (WriteGameStatus (@ player driver)
				     " Wants to sell "
				     (CONCAT qty " " (ClassName commodity)
					     " units."]
	        (←@
		  player pendingRequest (LIST (QUOTE SellRequest)
					      player cmile commodityIndex qty))
	        (RETURN (← self SuspendPlayer player T])

(TruckinPlayerInterface.SellMade
  [Method ((TruckinPlayerInterface SellMade)
	   self player roadPosition reqQty qty cargoPos reason penaltyAmt)
                                                             (* sm: " 6-JUL-83 11:15")
                                                             (* check if for local player)
	  (COND
	    ((FMEMB player (@ localPlayers))                 (* ask to be resumed)
	      (← self PlayerRequestComplete player reason])

(TruckinPlayerInterface.StartGame
  (Method ((TruckinPlayerInterface StartGame)
	   self begTime endTime)                             (* mjs: " 2-AUG-83 11:38")
                                                             (* Starts the game at begTime)
                                                             (* Put in code to : wait till begTime;
							     spawn processes for each player;)
	  (PROG ((currTime (IDATE)))
	        (←@
		  beginTime begTime)
	        (←@
		  endTime endTime)
	        (WriteGameStatus "The following players are already in the game")
	        (WriteGameStatus "" (for x in (@ Simulator players) collect (@ x driver)))
	        (printout TTY "If you want to add any more players, do:" T .FONT BOLDFONT 
			  "(← PlayerInterface AddPlayerRequest)"
			  .FONT DEFAULTFONT T)
	        [COND
		  ((@ localPlayers)
		    (←@
		      playerMenuWindow
		      (PlayerInterruptMenu (for x in (@ localPlayers) collect (@ x driver))
					   (@ self playerMenuWindow position]

          (* (COND ((EQ (QUOTE YES) (EVAL.IN.TTY.PROCESS (QUOTE (INTTY "Do you want to add any more players? " 
	  (QUOTE (YES NO)))) T)) (SETQ players (EVAL.IN.TTY.PROCESS (QUOTE (CreatePlayers NIL)) T)) (for x in 
	  (INTERSECTION players players) when (NOT (FMEMB x (@ localPlayers))) do (← self AddPlayerRequest x)))))


	        (RETURN T))))

(TruckinPlayerInterface.StartPlayerProcesses
  (Method ((TruckinPlayerInterface StartPlayerProcesses)
	   self)                                             (* sm: " 8-JUL-83 13:53")
                                                             (* starts players in separate processes)
	  (PROG (hand)
	        (←@
		  suspendedPlayers NIL)
	        (for x in (@ localPlayers) when (NOT (FMEMB x (@ suspendedPlayers)))
		   do (← self CreatePlayerProcess x))
	        (RETURN T))))

(TruckinPlayerInterface.SuspendPlayer
  [Method ((TruckinPlayerInterface SuspendPlayer)
	   self player staySuspend)                          (* sm: " 8-AUG-83 20:45")
                                                             (* Suspends player after a Buy/Move/Sell request)
	  (PROG NIL
	        (← self ChargeTime player (IDATE))
	        [COND
		  ((FMEMB player (@ suspendedPlayers))
		    (printout TTY (@ player driver)
			      "  " "Was already suspended!" T))
		  (T (←@
		       suspendedPlayers
		       (CONS player (@ suspendedPlayers]
	        (COND
		  (staySuspend (←@
				 player staySuspend staySuspend)))
	        [COND
		  ((@ runningPlayer)
		    (COND
		      ((EQ player (@ runningPlayer))
			(←@
			  runningPlayer NIL))
		      (T (printout TTY "Shouldnt Happen!! Player just suspended: " (@ player driver)
				   T "Wasn't even scheduled" T)
			 (HELPCHECK "Unscheduled player suspended!"]
	        (COND
		  ((NOT (EQ (THIS.PROCESS)
			    (@ player processHandle)))
		    (HELPCHECK "Player being suspended from a different process")))
	        (SUSPEND.PROCESS (@ player processHandle))
	        (until (AND (EQ player (@ runningPlayer))
			    (NOT (@ player staySuspend)))
		   do (SUSPEND.PROCESS (@ player processHandle])

(TruckinPlayerInterface.WakePlayer
  [Method ((TruckinPlayerInterface WakePlayer)
	   self player)                                      (* sm: "16-SEP-83 16:55")
                                                             (* Wakes player so it can be run at next BLOCK)
	  (PROG ((hand (@ player processHandle)))
	        [COND
		  ((PROCESSP hand))
		  (T                                         (* player process has disappeared)
		     (printout TTY "SysWarning: process for " (@ player driver)
			       " has disappeared. Recreating the process." T)
		     (← self CreatePlayerProcess player)
		     (←@
		       suspendedPlayers
		       (REMOVE player (@ suspendedPlayers]
	        (←@
		  player unchargedTime 0)
	        (←@
		  player startedAt (IDATE))
	        (WAKE.PROCESS (@ player processHandle)
			      (@ player wakeReason])

(TruckinSimulator.AddBandit
  [Method ((TruckinSimulator AddBandit)
	   self name)                                        (* sm: " 1-JUL-83 17:45")
                                                             (* Add bandit to game)
	  (←@
	    bandits
	    (CONS (← ($ Bandit)
		     New name)
		  (@ bandits])

(TruckinSimulator.AddPlayer
  (Method ((TruckinSimulator AddPlayer)
	   self reqID name type truck deniedFlg)             (* dgb: "11-JUL-83 14:01")
                                                             (* Adds player to its list -
							     assumes player created by PlayerInterface)
	  (PROG (player)
	        (COND
		  (deniedFlg (RETURN NIL)))
	        (SETQ player (GetObjectRec name))
	        (COND
		  ((FMEMB player (@ players))
		    (RETURN NIL)))
	        (←@
		  players
		  (CONS player (@ players)))
	        [COND
		  ((AND (@ gameRunningFlg)
			(@ barChart))
		    (← (@ barChart)
		       Attach
		       (@ player truck)
		       (QUOTE cashBox)
		       NIL
		       (@ player driver]
	        (RETURN player))))

(TruckinSimulator.AttachBoard
  (Method ((TruckinSimulator AttachBoard)
	   self gameBoard)                                   (* sm: "28-JUN-83 09:31")
                                                             (* Attaches gameBoard to game)
	  (PutValue self (QUOTE gameBoard)
		    gameBoard)
	  (←@
	    roadStops
	    (@ gameBoard roadStops))
	  (← gameBoard AttachToGame self)))

(TruckinSimulator.BreakCargo
  (Method ((TruckinSimulator BreakCargo)
	   self player commodIndex)                          (* sm: "27-JUN-83 10:59")
                                                             (* Sent by a commodity when it breaks)
	  (PROG ((truck (@ player truck))
		 commod)
	        (SETQ commod (CAR (NTH (@ truck cargo)
				       commodIndex)))
	        (←@
		  commod status NIL)
	        (WriteGameStatus (CONCAT (@ player driver)
					 "'s Cargo of:")
				 (CONCAT (@ commod qty)
					 " "
					 (ClassName commod)
					 " units")
				 " destroyed by RoughRoad"))))

(TruckinSimulator.BuyMade
  [Method ((TruckinSimulator BuyMade)
	   self player roadPosition reqQty qty reason penalty fragility lifetime)
                                                             (* sm: " 1-JUL-83 16:51")
                                                             (* Indicates a definite BUY to be made, or reasons for 
							     not carrying out a BuyRequest)
	  (PROG ((truck (@ player truck))
		 (loc (CAR (NTH (@ roadStops)
				roadPosition)))
		 commodity)                                  (* (AuxBuyMade player roadPosition reqQty qty reason 
							     penalty fragility lifetime))
	        (COND
		  ((ZEROP qty)                               (* no buy made)
		    (BrokenRules player (CONCAT "Buy not made: " reason)
				 penalty)
		    (RETURN NIL)))
	        (SETQ commodity (← (GetObjectRec (@@ loc Commodity))
				   New
				   (@ loc pr)
				   qty loc))
	        (COND
		  ((← commodity InstOf!(QUOTE FragileCommodity))
		    (←@
		      commodity fragility fragility)))
	        (COND
		  ((← commodity InstOf!(QUOTE PerishableCommodity))
		    (←@
		      commodity lifetime lifetime)))
	        (RETURN (← commodity TransferOwner truck NIL qty])

(TruckinSimulator.ClockProcess
  [Method ((TruckinSimulator ClockProcess)
	   self)                                             (* sm: "12-JUL-83 21:09")
                                                             (* Monitors game clock)
	  (PROG ([endTime (SETUPTIMER.DATE (GDATE (@ Simulator endTime]
		 (blockTime (SETUPTIMER 800 NIL NIL (QUOTE MS)))
		 cTime countDown)                            (* Wait till it is game time)
	        [SETQ countDown (SETUPTIMER (IntervalToEvent (@ Simulator beginTime]
	        (until (TIMEREXPIRED? countDown)
		   do (printout PROMPTWINDOW T T (CHARACTER 7)
				"Game starting soon!" T)
		      (←@
			timeLeft
			(IDIFFERENCE (@ beginTime)
				     (IDATE)))
		      (BLOCK 4000))
	        (←@
		  timeLeft
		  (IDIFFERENCE (@ Simulator endTime)
			       (IDATE)))
	        (until (TIMEREXPIRED? endTime (QUOTE SECONDS))
		   do (←@
			timeLeft
			(IDIFFERENCE (@ Simulator endTime)
				     (IDATE)))
		      (SETQ blockTime (SETUPTIMER 800 blockTime NIL (QUOTE MS)))
		      (BLOCK NIL blockTime))
	        (←@
		  timeLeft 0)
	        (RETURN (QUOTE Done])

(TruckinSimulator.DrivePlayer
  (Method ((TruckinSimulator DrivePlayer)
	   self curLoc finalLoc player)                      (* dgb: "11-JUL-83 12:40")
                                                             (* Drives player from curLoc to finalLoc)
	  (Drive curLoc finalLoc player)))

(TruckinSimulator.GameOver
  (Method ((TruckinSimulator GameOver)
	   self)                                             (* dgb: "11-JUL-83 13:56")
                                                             (* Game Over)
	  (← self WhoWon)
	  (←@
	    gameRunningFlg NIL)))

(TruckinSimulator.GasFill
  (Method ((TruckinSimulator GasFill)
	   self prevStop gsStop qty pr)                      (* sm: " 6-JUL-83 18:33")
                                                             (* Instructions for moving a gas truck and filling 
							     GasStation)
                                                             (* Fills gas station at gsStop)
                                                             (* Spl cases: If prevStop =0 then start at UnionHall.
							     If gsStop=0 then end at UnionHall)
	  (PROG (gasMan prevRS newRS (unionHall (@ unionHall))
			(roadStops (@ roadStops)))
	        (SETQ gasMan (OR (GetObjectRec (QUOTE Gas))
				 (← ($ GasPlayer)
				    New)))
	        [COND
		  ((ZEROP prevStop)
		    (WriteGameStatus NIL "Here comes the GasMan!")
		    (COND
		      ((← unionHall RoomToPark?)
			(← unionHall Crash gasMan)
			(DISMISS 1500)))
		    (SETQ prevRS unionHall))
		  (T (SETQ prevRS (CAR (NTH roadStops prevStop]
	        [COND
		  ((ZEROP gsStop)
		    (SETQ newRS unionHall))
		  (T (SETQ newRS (CAR (NTH roadStops gsStop]
	        (COND
		  ((← prevRS Parked? gasMan)
		    (← prevRS Unpark gasMan)))
	        (Drive prevRS newRS gasMan)
	        (COND
		  [(EQ newRS unionHall)
		    (COND
		      ((← newRS RoomToPark?)
			(← newRS Crash gasMan)
			(DISMISS 1500)
			(← newRS Unpark gasMan]
		  (T (← newRS Park gasMan)
		     (DISMISS 200)
		     (←@
		       newRS qty qty)
		     (←@
		       newRS pr pr)
		     (DISMISS 300)))
	        (RETURN newRS))))

(TruckinSimulator.GiveAliceBonus
  [Method ((TruckinSimulator GiveAliceBonus)
	   self atAlice)                                     (* sm: " 6-JUL-83 13:21")
                                                             (* Give bonus for reaching Alices)
	  (WriteGameStatus "Their cashbox multiplied by " (@@ AliceBonus))
	  (for p in atAlice do (←@(@ p truck)
				 cashBox
				 (FIX (TIMES (@(@ p truck)
					       cashBox)
					     (@@ AliceBonus])

(TruckinSimulator.Initialize
  (Method ((TruckinSimulator Initialize)
	   self)                                             (* edited: "12-JUL-83 12:09")
                                                             (* Initializes)
	  (AND (@ barChart)
	       (← (@ barChart)
		  Close))
	  (for x in (@ players) when (← x InstOf!(QUOTE RemotePlayer)) DO (← x Destroy))
	  (←Super
	    self Initialize)))

(TruckinSimulator.MaxMove
  (Method ((TruckinSimulator MaxMove)
	   self player maxMove)                              (* sm: " 1-JUL-83 11:51")
                                                             (* Puts maxMove in player)
	  (←@
	    player maxMove maxMove)))

(TruckinSimulator.MoveMade
  (Method ((TruckinSimulator MoveMade)
	   self player from to reason penaltyAmt missTurn)   (* sm: " 6-SEP-83 15:02")
                                                             (* Actually makes the move after all checks are done)

          (* player -
	  player being moved from, to -
	  indices of from and to locs reason -
	  reason for move penaltyAmt -
	  if any associated with move missTurn -
	  any missed turn associated with move)

                                                             (* Current set of reasons: Bandit, WeighStation, 
							     NoFuel, UnionHall, OffBoardBeg, OffBoardEnd, 
							     ConsecMoves, IllegalLoc, MoreThanAllowed, AlreadyThere,
							     NoRoom, LowFuel)
	  (PROG (curLoc finalLoc dist (truck (@ player truck)))
	        (←@
		  player movesMade (ADD1 (@ player movesMade)))
	        [COND
		  ((← player InstOf!(QUOTE Player))          (* if not bandit or gasman)
		    (for y in (@(@ player truck)
				cargo)
		       do (DoFringeMethods y (QUOTE UpdateStatus]
	        (COND
		  ((AND (EQUAL from to)
			(← player InstOf!(QUOTE Player)))    (* no physical move. print message)
		    (BrokenRules player (CONCAT "Move not made: " reason)
				 penaltyAmt missTurn)
		    [COND
		      ((EQ reason (QUOTE IncorrectLoc))
			(WriteGameStatus (@ player driver)
					 (CONCAT " located at: " (@(@ player truck)
						   location))
					 (CONCAT " thinks he is at stop# " from]
		    (RETURN NIL)))
	        (SETQ curLoc (COND
		    ((GREATERP from 0)
		      (CAR (NTH (@ roadStops)
				from)))
		    (T NIL)))
	        (SETQ finalLoc (CAR (NTH (@ roadStops)
					 to)))
	        (SETQ dist (IABS (IDIFFERENCE from to)))
	        [←@
		  truck fuel (IMAX 0 (IDIFFERENCE (@ truck fuel)
						  (ITIMES dist (@@ truck Gpm]
	        (COND
		  (curLoc (← curLoc Unpark player)
			  (← self DrivePlayer curLoc finalLoc player)))
	        (← finalLoc Visit player reason (IDATE))     (* more code here for UnionHall, Bandit & WS cash lost,
							     etc)
	        (RETURN finalLoc))))

(TruckinSimulator.NewGame
  (Method ((TruckinSimulator NewGame)
	   self seed board)                                  (* sm: "26-JUL-83 11:20")
                                                             (* Generates a new game based on seed and board 
							     specified by DecisionMaster)
	  (PROG (gb)
	        (SETQ gb (← (GetClassRec board)
			    New self))
	        (SETQ GameBoard gb)
	        (SETQ gameWindow NIL)
	        (SetMachineDepPara)
	        (← gb NewBoard seed)
	        (← self AttachBoard gb)
	        (← self Initialize)
	        (← self SetUpGauges)
	        (←@
		  alices
		  (for x in (@ roadStops) when (← x InstOf!(QUOTE AlicesRestaurant)) collect x))
	        (←@
		  unionHall
		  (CAR (@ roadStops)))
	        (RETURN self))))

(TruckinSimulator.ParkedAtAlice
  [Method ((TruckinSimulator ParkedAtAlice)
	   self player time)                                 (* sm: " 1-JUL-83 11:44")
                                                             (* Marks when player parked at alice)
	  (for loc in (QUOTE (parkingPlace1 parkingPlace2)) bind (x ←(@(@ player truck)
								      location))
	     do (COND
		  ((EQ player (GetValue x loc))
		    (PutValue x loc time (QUOTE timeParked])

(TruckinSimulator.ReUseGame
  (Method ((TruckinSimulator ReUseGame)
	   self seed)                                        (* sm: "30-JUN-83 19:36")
                                                             (* Sends message to GameBoard to reuse)
	  (← (@ gameBoard)
	     ReUseBoard seed)
	  (← self Initialize)))

(TruckinSimulator.RedoGameParameters
  [Method ((TruckinSimulator RedoGameParameters)
	   self)                                             (* sm: " 8-AUG-83 15:29")
                                                             (* Change anything after all game info is known -
							     prior to game start)
	  (COND
	    ((@ barChart))
	    (T (←@
		 barChart
		 (←New
		   ($ SSBarChart)
		   SetUp
		   (@ players)
		   (QUOTE cashBox)
		   "CashBox of Players" 20000 (QUOTE (truck))
		   NIL
		   (QUOTE (430 . 630])

(TruckinSimulator.RemovePlayer
  (Method ((TruckinSimulator RemovePlayer)
	   self player reason)                               (* sm: "10-JUL-83 21:18")
                                                             (* Sent to game board so it can remove player from 
							     board)
	  (PROG ((pobj player))
	        (DREMOVE pobj (@ players))
	        (← (@ gameBoard)
		   RemovePlayer pobj)
	        (WriteGameStatus (@ player driver)
				 "Removed from game: " reason)
	        (RETURN player))))

(TruckinSimulator.SellMade
  [Method ((TruckinSimulator SellMade)
	   self player roadPosition reqQty qty cargoPosition reason penalty)
                                                             (* sm: " 1-JUL-83 16:52")
                                                             (* Performs an actual Sell, once all checking is done)
	  (PROG [(truck (@ player truck))
		 commodity
		 (loc (CAR (NTH (@ roadStops)
				roadPosition]                (* (AuxSellMade player roadPosition reqQty qty 
							     cargoPosition reason penalty))
	        (COND
		  ((ZEROP qty)                               (* no sell made)
		    (BrokenRules player (CONCAT "Unable to sell: " reason)
				 penalty)
		    (RETURN NIL)))
	        (SETQ commodity (CAR (NTH (@ truck cargo)
					  cargoPosition)))
	        (RETURN (← commodity TransferOwner loc (@ loc pr)
			   qty])

(TruckinSimulator.SetUpGauges
  (Method ((TruckinSimulator SetUpGauges)
	   self)                                             (* sm: " 1-JUL-83 14:55")
                                                             (* Sets up gauges)
	  (← self AddGauges (QUOTE timeLeft)
	     T "Time Remaining (sec)")))

(TruckinSimulator.SpoilCargo
  (Method ((TruckinSimulator SpoilCargo)
	   self player commodIndex)                          (* sm: "27-JUN-83 11:00")
                                                             (* Sent by commodity when it spoils)
	  (PROG ((truck (@ player truck))
		 commod)
	        (SETQ commod (CAR (NTH (@ truck cargo)
				       commodIndex)))
	        (←@
		  commod status NIL)
	        (WriteGameStatus (CONCAT (@ player driver)
					 "'s cargo of: ")
				 (CONCAT (@ commod qty)
					 " "
					 (ClassName commod)
					 " units")
				 " just perished. Tch! Tch!")
	        (RETURN NIL))))

(TruckinSimulator.StartClockProcess
  (Method ((TruckinSimulator StartClockProcess)
	   self)                                             (* sm: " 8-AUG-83 15:53")
                                                             (* Starts the clock process)
	  (DEL.PROCESS (FIND.PROCESS (QUOTE GameClock)))
	  (ADD.PROCESS (LIST (QUOTE ←)
			     self
			     (QUOTE ClockProcess))
		       (QUOTE NAME)
		       (QUOTE GameClock)
		       (QUOTE RESTARTABLE)
		       GameProcRestFlg)))

(TruckinSimulator.StartGame
  (Method ((TruckinSimulator StartGame)
	   self begTime endTime)                             (* sm: " 5-JUL-83 16:13")
                                                             (* SetsUp IVs for time left etc and starts game clock 
							     process)
	  (←@
	    beginTime begTime)
	  (←@
	    endTime endTime)
	  (←@
	    timeLeft
	    (IDIFFERENCE endTime begTime))                   (* Start the clock process here)
	  (← self StartClockProcess)
	  (WriteGameStatus (DATE)
			   "  New Simulation!")
	  [WriteGameStatus (CONCAT "Game Begins at: " (GDATE (@ beginTime)))
			   (CONCAT "Game will end at: " (GDATE (@ endTime]
	  (←@
	    gameRunningFlg T)))

(TruckinSimulator.UnattachBoard
  (Method ((TruckinSimulator UnattachBoard)
	   self)                                             (* sm: "28-JUN-83 09:31")
                                                             (* Removes game board)
	  (PutValue self (QUOTE gameBoard)
		    NotSetValue)
	  (←@
	    roadStops NIL)))

(TruckinSimulator.UpdateRS
  (Method ((TruckinSimulator UpdateRS)
	   self roadStop)                                    (* sm: "28-JUN-83 09:45")
                                                             (* Sent when any RoadStop's data changes)
	  (← roadStop DisplayData)))

(TruckinSimulator.WhoWon
  (Method ((TruckinSimulator WhoWon)
	   self)                                             (* mjs: " 2-AUG-83 11:49")
                                                             (* summarizes the game results)
	  (PROG (atAlice winner)
	        (printout TTY 5 .FONT BOLDFONT "Summary of Game" .FONT DEFAULTFONT T)
	        (WriteGameStatus NIL "Summary of Game")
	        [SETQ atAlice (for x in (@ alices) join (for y in (QUOTE (parkingPlace1 parkingPlace2)
									 )
							   when (GetValue x y)
							   collect (GetValue x y]
	        (printout TTY "Following players made it to Alices" T T)
	        (WriteGameStatus "Following players made it to Alices")
	        (← self GiveAliceBonus atAlice)
	        [for x in atAlice
		   do (printout TTY .FONT BOLDFONT (@ x driver)
				-5 "$" (@(@ x truck)
				  cashBox)
				T)
		      (WriteGameStatus (@ x driver)
				       (CONCAT "   $" (@(@ x truck)
						 cashBox]
	        (printout PPDefault T .FONT DEFAULTFONT "Summary of all player's status" T)
	        (for x in (@ players)
		   do (← x Summarize)
		      (AND truckinLogFlg truckinLogHandle (← x Summarize truckinLogHandle)))
	        (printout PPDefault T)
	        (SETQ atAlice (@ players))
	        (SETQ winner (CAR atAlice))
	        [for x in (CDR atAlice) do (COND
					     ((GREATERP (@(@ x truck)
							  cashBox)
							(@(@ winner truck)
							  cashBox))
					       (SETQ winner x]
	        (printout TTY .FONT BOLDFONT "Winner is :" (@ winner driver)
			  (CONCAT " Cash: $" (@(@ winner truck)
				    cashBox))
			  .FONT DEFAULTFONT T)
	        (WriteGameStatus "Winner is: " (@ winner driver)
				 (CONCAT " Cash: $" (@(@ winner truck)
					   cashBox)))
	        (RETURN winner))))
)
(PUTPROPS TRUCKINM COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (37422 40575 (MoveTruckinPI.BeginGame 37432 . 37965) (RemoteMasterComm.StartWorldProcess
 37967 . 38562) (RemoteSlaveComm.StartWorldProcess 38564 . 39158) (SlaveTruckin 39160 . 39554) (
TimeTruckinPI.BeginGame 39556 . 40151) (TruckinCommInterface.NewInstance 40153 . 40573)) (63722 224276
 (BWTruckin.InitializeGameWindow 63732 . 64163) (ColorTruckin.CreateGameBoard 64165 . 64905) (
ColorTruckin.InitializeGameWindow 64907 . 66044) (ColorTruckin.MakeDriveBitMaps 66046 . 66334) (
DisplayTruckinS.NewGame 66336 . 66735) (DisplayTruckinS.ReUseGame 66737 . 67082) (
GameCommInterface.NewInstance 67084 . 68071) (GameDecisionMaker.NewInstance 68073 . 68483) (
GamePlayerInterface.ChangeGameParameters 68485 . 69325) (GamePlayerInterface.NewInstance 69327 . 69872
) (GameSimulator.NewInstance 69874 . 70276) (MainCommInterface.AddBandit 70278 . 70690) (
MainCommInterface.AddPlayer 70692 . 71290) (MainCommInterface.AddPlayerRequest 71292 . 71634) (
MainCommInterface.BeginGameRequest 71636 . 72001) (MainCommInterface.BreakCargo 72003 . 72430) (
MainCommInterface.BuyMade 72432 . 73365) (MainCommInterface.BuyRequest 73367 . 73724) (
MainCommInterface.GameOver 73726 . 74093) (MainCommInterface.GasFill 74095 . 74474) (
MainCommInterface.MaxMove 74476 . 74881) (MainCommInterface.MoveMade 74883 . 75835) (
MainCommInterface.MoveRequest 75837 . 76195) (MainCommInterface.NewGame 76197 . 76708) (
MainCommInterface.NewGameRequest 76710 . 77030) (MainCommInterface.ParkedAtAlice 77032 . 77455) (
MainCommInterface.ReUseGame 77457 . 77890) (MainCommInterface.ReUseGameRequest 77892 . 78261) (
MainCommInterface.RemovePlayer 78263 . 78762) (MainCommInterface.RemovePlayerRequest 78764 . 79106) (
MainCommInterface.SellMade 79108 . 80046) (MainCommInterface.SellRequest 80048 . 80423) (
MainCommInterface.SetInitialParameters 80425 . 80743) (MainCommInterface.SetUp 80745 . 81432) (
MainCommInterface.SpoilCargo 81434 . 81861) (MainCommInterface.StartGame 81863 . 82515) (
MainCommInterface.WorldProcess 82517 . 84410) (MoveTruckinDM.InitializeGameParameters 84412 . 85130) (
MoveTruckinDM.MoveBandits 85132 . 85623) (MoveTruckinPI.RunGame 85625 . 87541) (
NoDisplayTruckinS.AttachBoard 87543 . 87876) (NoDisplayTruckinS.DrivePlayer 87878 . 88143) (
NoDisplayTruckinS.UpdateRS 88145 . 88523) (RemoteMasterComm.AddBandit 88525 . 89026) (
RemoteMasterComm.AddPlayer 89028 . 89720) (RemoteMasterComm.AddPlayerRequest 89722 . 90062) (
RemoteMasterComm.BeginGameRequest 90064 . 90427) (RemoteMasterComm.BreakCargo 90429 . 91027) (
RemoteMasterComm.BuyMade 91029 . 92123) (RemoteMasterComm.BuyRequest 92125 . 92480) (
RemoteMasterComm.GameOver 92482 . 92901) (RemoteMasterComm.GasFill 92903 . 93366) (
RemoteMasterComm.InterimWorldProcess 93368 . 93815) (RemoteMasterComm.MaxMove 93817 . 94416) (
RemoteMasterComm.MoveMade 94418 . 95518) (RemoteMasterComm.MoveRequest 95520 . 95876) (
RemoteMasterComm.NewGame 95878 . 96484) (RemoteMasterComm.NewGameRequest 96486 . 96804) (
RemoteMasterComm.ParkedAtAlice 96806 . 97367) (RemoteMasterComm.ReUseGame 97369 . 97869) (
RemoteMasterComm.ReUseGameRequest 97871 . 98238) (RemoteMasterComm.RemovePlayer 98240 . 98913) (
RemoteMasterComm.RemovePlayerRequest 98915 . 99286) (RemoteMasterComm.SellMade 99288 . 100378) (
RemoteMasterComm.SellRequest 100380 . 100753) (RemoteMasterComm.SetInitialParameters 100755 . 101100) 
(RemoteMasterComm.SetUp 101102 . 101854) (RemoteMasterComm.SpoilCargo 101856 . 102613) (
RemoteMasterComm.StartGame 102615 . 103345) (RemoteMasterComm.StartInterimWorldProcess 103347 . 103941
) (RemoteMasterComm.WorldProcess 103943 . 105785) (RemoteSlaveComm.AddBandit 105787 . 106199) (
RemoteSlaveComm.AddPlayer 106201 . 106777) (RemoteSlaveComm.AddPlayerRequest 106779 . 107136) (
RemoteSlaveComm.BeginGameRequest 107138 . 107552) (RemoteSlaveComm.BreakCargo 107554 . 108032) (
RemoteSlaveComm.BuyMade 108034 . 108817) (RemoteSlaveComm.BuyRequest 108819 . 109248) (
RemoteSlaveComm.GameOver 109250 . 109613) (RemoteSlaveComm.GasFill 109615 . 110044) (
RemoteSlaveComm.InterimWorldProcess 110046 . 110491) (RemoteSlaveComm.MaxMove 110493 . 110985) (
RemoteSlaveComm.MoveMade 110987 . 111719) (RemoteSlaveComm.MoveRequest 111721 . 112151) (
RemoteSlaveComm.NewGame 112153 . 112660) (RemoteSlaveComm.NewGameRequest 112662 . 113003) (
RemoteSlaveComm.ParkedAtAlice 113005 . 113455) (RemoteSlaveComm.ReUseGame 113457 . 113886) (
RemoteSlaveComm.ReUseGameRequest 113888 . 114253) (RemoteSlaveComm.RemovePlayer 114255 . 114812) (
RemoteSlaveComm.RemovePlayerRequest 114814 . 115201) (RemoteSlaveComm.SellMade 115203 . 116000) (
RemoteSlaveComm.SellRequest 116002 . 116449) (RemoteSlaveComm.SetInitialParameters 116451 . 116773) (
RemoteSlaveComm.SetUp 116775 . 117271) (RemoteSlaveComm.SpoilCargo 117273 . 117727) (
RemoteSlaveComm.StartGame 117729 . 118367) (RemoteSlaveComm.StartInterimWorldProcess 118369 . 118961) 
(RemoteSlaveComm.WorldProcess 118963 . 121130) (TimeTruckinDM.ChargeTime 121132 . 122681) (
TimeTruckinDM.CheckAlice 122683 . 124413) (TimeTruckinDM.InitializeGameParameters 124415 . 124952) (
TimeTruckinDM.MoveBandits 124954 . 125607) (TimeTruckinDM.RedoGameParameters 125609 . 126435) (
TimeTruckinDM.ReplenishQty 126437 . 126986) (TimeTruckinPI.RunGame 126988 . 129203) (
TruckinBoard.AssignRoadStops 129205 . 131300) (TruckinBoard.AttachToGame 131302 . 131917) (
TruckinBoard.CreateGameBoard 131919 . 132374) (TruckinBoard.DisplayGameBoard 132376 . 133881) (
TruckinBoard.InitializeRoadStops 133883 . 134239) (TruckinBoard.MakeDriveBitMaps 134241 . 134529) (
TruckinBoard.NewBoard 134531 . 135394) (TruckinBoard.PlaceRoadStops 135396 . 137112) (
TruckinBoard.ReInitializeRoadStops 137114 . 137468) (TruckinBoard.ReUseBoard 137470 . 137814) (
TruckinBoard.RemovePlayer 137816 . 138287) (TruckinCommInterface.CleanGameWorld 138289 . 138695) (
TruckinCommInterface.CreateDecisionMaker 138697 . 139770) (TruckinCommInterface.CreateGateWay 139772
 . 140901) (TruckinCommInterface.CreatePlayerInterface 140903 . 142055) (
TruckinCommInterface.CreateSimulator 142057 . 142921) (TruckinCommInterface.SetInitialParameters 
142923 . 143211) (TruckinCommInterface.StartWorldProcess 143213 . 143924) (TruckinCommInterface.TellMe
 143926 . 144482) (TruckinDecisionMaker.AddBandit 144484 . 144811) (TruckinDecisionMaker.AddPlayer 
144813 . 146079) (TruckinDecisionMaker.AddPlayerRequest 146081 . 147015) (
TruckinDecisionMaker.AttachSimulator 147017 . 147402) (TruckinDecisionMaker.BeginGameRequest 147404 . 
148527) (TruckinDecisionMaker.BuyMade 148529 . 148866) (TruckinDecisionMaker.BuyRequest 148868 . 
151655) (TruckinDecisionMaker.ChangeGameParameters 151657 . 152529) (TruckinDecisionMaker.CheckAlice 
152531 . 154055) (TruckinDecisionMaker.ForcedMove 154057 . 155159) (TruckinDecisionMaker.GameOver 
155161 . 155449) (TruckinDecisionMaker.GiveAliceBonus 155451 . 155716) (
TruckinDecisionMaker.InitializeGameParameters 155718 . 156365) (TruckinDecisionMaker.MonitorGame 
156367 . 156946) (TruckinDecisionMaker.MonitorProcess 156948 . 157780) (
TruckinDecisionMaker.MoveBandits 157782 . 159814) (TruckinDecisionMaker.MoveCheckingHazards 159816 . 
161398) (TruckinDecisionMaker.MoveMade 161400 . 162316) (TruckinDecisionMaker.MoveRequest 162318 . 
165218) (TruckinDecisionMaker.MoveTruck 165220 . 167465) (TruckinDecisionMaker.NewGameRequest 167467
 . 168684) (TruckinDecisionMaker.ReUseGameRequest 168686 . 169170) (
TruckinDecisionMaker.RedoGameParameters 169172 . 169534) (TruckinDecisionMaker.RemovePlayer 169536 . 
170338) (TruckinDecisionMaker.RemovePlayerRequest 170340 . 170662) (TruckinDecisionMaker.ReplenishQty 
170664 . 171662) (TruckinDecisionMaker.SellMade 171664 . 171993) (TruckinDecisionMaker.SellRequest 
171995 . 175380) (TruckinDecisionMaker.StartGame 175382 . 175776) (
TruckinDecisionMaker.StartMonitorProcess 175778 . 176185) (TruckinDecisionMaker.UpdateAlice 176187 . 
176921) (TruckinPlayerInterface.AddPlayer 176923 . 179056) (TruckinPlayerInterface.AddPlayerRequest 
179058 . 180289) (TruckinPlayerInterface.BeginGame 180291 . 181172) (TruckinPlayerInterface.Buy 181174
 . 182143) (TruckinPlayerInterface.BuyMade 182145 . 182653) (TruckinPlayerInterface.ChargeTime 182655
 . 184282) (TruckinPlayerInterface.CheckLocalPlayers 184284 . 185177) (
TruckinPlayerInterface.ContinueGame 185179 . 186461) (TruckinPlayerInterface.CreatePlayerProcess 
186463 . 187556) (TruckinPlayerInterface.DeletePlayerProcesses 187558 . 188018) (
TruckinPlayerInterface.Move 188020 . 189451) (TruckinPlayerInterface.MoveMade 189453 . 189938) (
TruckinPlayerInterface.NewGame 189940 . 190276) (TruckinPlayerInterface.NewGameRequest 190278 . 190739
) (TruckinPlayerInterface.PlayerRequestComplete 190741 . 191148) (TruckinPlayerInterface.ReUseGame 
191150 . 191487) (TruckinPlayerInterface.RemovePlayer 191489 . 191989) (
TruckinPlayerInterface.RemovePlayerRequest 191991 . 192833) (TruckinPlayerInterface.RunNextPlayer 
192835 . 193568) (TruckinPlayerInterface.ScheduleNextPlayer 193570 . 196404) (
TruckinPlayerInterface.SelectPlayers 196406 . 197296) (TruckinPlayerInterface.Sell 197298 . 200349) (
TruckinPlayerInterface.SellMade 200351 . 200840) (TruckinPlayerInterface.StartGame 200842 . 202283) (
TruckinPlayerInterface.StartPlayerProcesses 202285 . 202812) (TruckinPlayerInterface.SuspendPlayer 
202814 . 204184) (TruckinPlayerInterface.WakePlayer 204186 . 205078) (TruckinSimulator.AddBandit 
205080 . 205414) (TruckinSimulator.AddPlayer 205416 . 206229) (TruckinSimulator.AttachBoard 206231 . 
206640) (TruckinSimulator.BreakCargo 206642 . 207279) (TruckinSimulator.BuyMade 207281 . 208574) (
TruckinSimulator.ClockProcess 208576 . 209816) (TruckinSimulator.DrivePlayer 209818 . 210125) (
TruckinSimulator.GameOver 210127 . 210417) (TruckinSimulator.GasFill 210419 . 212133) (
TruckinSimulator.GiveAliceBonus 212135 . 212623) (TruckinSimulator.Initialize 212625 . 213077) (
TruckinSimulator.MaxMove 213079 . 213360) (TruckinSimulator.MoveMade 213362 . 215662) (
TruckinSimulator.NewGame 215664 . 216519) (TruckinSimulator.ParkedAtAlice 216521 . 217029) (
TruckinSimulator.ReUseGame 217031 . 217367) (TruckinSimulator.RedoGameParameters 217369 . 217927) (
TruckinSimulator.RemovePlayer 217929 . 218468) (TruckinSimulator.SellMade 218470 . 219409) (
TruckinSimulator.SetUpGauges 219411 . 219734) (TruckinSimulator.SpoilCargo 219736 . 220400) (
TruckinSimulator.StartClockProcess 220402 . 220938) (TruckinSimulator.StartGame 220940 . 221688) (
TruckinSimulator.UnattachBoard 221690 . 222033) (TruckinSimulator.UpdateRS 222035 . 222329) (
TruckinSimulator.WhoWon 222331 . 224274)))))
STOP