********************************************************************
* NOTE: This file is generated automatically from the event * definition file Minimax.evt. ********************************************************************<* PRAGMA LL *> MODULEevent handling methods:; <*NOWARN*> IMPORT TextPort, Rd, ZeusClass, Filter, TextEditVBT; <*NOWARN*> IMPORT TypeFmt, Fmt, Minimax, MinimaxViewClass, ZFmt; <*NOWARN*> IMPORT Wr, ZeusPanel, GameBoard, FormsVBT, VBT, View; <* FATAL FormsVBT.Error, FormsVBT.Unimplemented *> REVEAL T = Public BRANDED OBJECT fv: FormsVBT.T := NIL; te: TextEditVBT.T := NIL; OVERRIDES init := TViewInit; install := TViewInstall; delete := TViewDelete; snapshot := TViewSnapshot; restore := TViewRestore; config := TViewConfig; reactivity := TViewReactivity; startrun := TViewStartrun; endrun := TViewEndrun; oeSetup := Setup; oePlayerMove := PlayerMove; oeFinished := Finished; oeEvaluateNode := EvaluateNode; oePlayerThinking := PlayerThinking; oeFinishedEvalNode := FinishedEvalNode; oeBoardValueUpdated := BoardValueUpdated; oeHumanCellSelected := HumanCellSelected; oeHumanIllegalMove := HumanIllegalMove; END; PROCEDURE MinimaxTranscriptView TViewInit (view: T): T = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "init"); RETURN MinimaxViewClass.T.init (view, NIL); END TViewInit; PROCEDUREClear (<* UNUSED *> fv : FormsVBT.T; <* UNUSED *> name: TEXT; cl : REFANY; <* UNUSED *> time: VBT.TimeStamp) = BEGIN TextPort.SetText(NARROW(cl, T).te.tp, "") END Clear; PROCEDURETViewInstall (view: T) = <* LL = VBT.mu *> BEGIN view.fv := ZeusPanel.NewForm("MinimaxTranscriptView.fv"); view.te := FormsVBT.GetVBT(view.fv, "transcript"); TViewZTrace (view, "install"); FormsVBT.AttachProc(view.fv, "clear", Clear, view); EVAL Filter.Replace (view, view.fv); MinimaxViewClass.T.install (view); END TViewInstall; PROCEDURETViewDelete (view: T) = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "delete"); MinimaxViewClass.T.delete (view); END TViewDelete; PROCEDURETViewSnapshot (view: T; wr: Wr.T) RAISES {ZeusClass.Error} = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "snapshot"); MinimaxViewClass.T.snapshot (view, wr); END TViewSnapshot; PROCEDURETViewRestore (view: T; rd: Rd.T) RAISES {ZeusClass.Error} = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "restore"); MinimaxViewClass.T.restore (view, rd); END TViewRestore; PROCEDURETViewConfig ( view: T; state: ZeusClass.StateChange; o: ZeusClass.T) = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "config"); MinimaxViewClass.T.config (view, state, o); END TViewConfig; PROCEDURETViewReactivity (view: T; <*UNUSED*> on: BOOLEAN) = <* LL = VBT.mu *> BEGIN TViewZTrace(view, "reactivity"); MinimaxViewClass.T.reactivity (view, TRUE); END TViewReactivity; PROCEDURETViewStartrun (view: T) = <* LL = {} *> BEGIN TViewZTrace (view, "startrun"); MinimaxViewClass.T.startrun (view); END TViewStartrun; PROCEDURETViewEndrun (view: T) = <* LL = {} *> BEGIN TViewZTrace (view, "endrun"); MinimaxViewClass.T.endrun (view); END TViewEndrun;PROCEDURESetup (view: T; ) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "Setup ...") ELSE TViewTrace (view, "Setup " ) END END END END Setup; PROCEDUREPlayerMove (view: T; player: INTEGER; fromx, fromy, tox, toy: INTEGER) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "PlayerMove ...") ELSE TViewTrace (view, "PlayerMove " & Fmt.Int(player) & " " & Fmt.Int(fromx) & " " & Fmt.Int(fromy) & " " & Fmt.Int(tox) & " " & Fmt.Int(toy) ) END END END END PlayerMove; PROCEDUREFinished (view: T; winner: INTEGER) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "Finished ...") ELSE TViewTrace (view, "Finished " & Fmt.Int(winner) ) END END END END Finished; PROCEDUREEvaluateNode (view: T; board: GameBoard.T) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "EvaluateNode ...") ELSE TViewTrace (view, "EvaluateNode " & TypeFmt.Board(board) ) END END END END EvaluateNode; PROCEDUREPlayerThinking (view: T; player: INTEGER; board: GameBoard.T) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "PlayerThinking ...") ELSE TViewTrace (view, "PlayerThinking " & Fmt.Int(player) & " " & TypeFmt.Board(board) ) END END END END PlayerThinking; PROCEDUREFinishedEvalNode (view: T; board: GameBoard.T) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "FinishedEvalNode ...") ELSE TViewTrace (view, "FinishedEvalNode " & TypeFmt.BoardKey(board) ) END END END END FinishedEvalNode; PROCEDUREBoardValueUpdated (view: T; board: GameBoard.T; newValue: Minimax.BoardValue) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "BoardValueUpdated ...") ELSE TViewTrace (view, "BoardValueUpdated " & TypeFmt.BoardKey(board) & " " & Fmt.Int(newValue) ) END END END END BoardValueUpdated; PROCEDUREHumanCellSelected (view: T; xCoord, yCoord: INTEGER) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "HumanCellSelected ...") ELSE TViewTrace (view, "HumanCellSelected " & Fmt.Int(xCoord) & " " & Fmt.Int(yCoord) ) END END END END HumanCellSelected; PROCEDUREHumanIllegalMove (view: T; ) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "HumanIllegalMove ...") ELSE TViewTrace (view, "HumanIllegalMove " ) END END END END HumanIllegalMove; PROCEDURETViewZTrace (view: T; t: TEXT) = BEGIN IF view.fv # NIL THEN IF FormsVBT.GetBoolean(view.fv, "zeus") THEN TextPort.PutText(view.te.tp, "**zeus: " & t & "\n"); TextPort.Normalize(view.te.tp, LAST(INTEGER)) END END END TViewZTrace; PROCEDURETViewTrace (view: T; t: TEXT) = BEGIN TextPort.PutText(view.te.tp, "--event: " & t & "\n"); TextPort.Normalize(view.te.tp, LAST(INTEGER)) END TViewTrace; PROCEDURETViewNew (): View.T = BEGIN RETURN NEW(T).init() END TViewNew; BEGIN ZeusPanel.RegisterView (TViewNew, "Minimax Transcript View", "Minimax"); END MinimaxTranscriptView.