program ConveyorSimulation; uses CRT; const OFF = 0; ON = 1; UP = 1; DOWN = 2; LEFT = 3; RIGHT = 4; CENTER = 5; NONE = 0; BOTTOM = 1; TOP = 2; NOT_DONE = 0; DONE = 1; VISIBLE = TRUE; NOT_VISIBLE = FALSE; const BLACK = (0); BLUE = (1); GREEN = (2); CYAN = (3); RED = (4); MAGENTA = (5); BROWN = (6); LIGHT_GRAY = (7); DARK_GRAY = (8); LIGHT_BLUE = (9); LIGHT_GREEN = (10); LIGHT_CYAN = (11); LIGHT_RED = (12); LIGHT_MAGENTA = (13); YELLOW = (14); WHITE = (15); const NO_BLINK = 0; BLINK = 1; const DOWN_KEY = #80; UP_KEY = #72; ENTER_KEY = #13; ESC_KEY = #27; BLANK = ' '; const MAX_NUMBER_OF_SWITCHES_IN_SEQUENCE = 6; const SWITCH_SET = ['1'..'5', '0']; const VALID_KEYS = ['1'..'5', '0', ESC_KEY]; type byteType = byte; type charType = char; type boolType = boolean; type charSetType = set of charType; type stringType = string; type text20Type = string [20]; type stateType = byteType; type lengthType = real; type numberType = byteType; type wordType = word; type byteSetType = set of byte; type realType = record value : real; numOfChar : byteType; numOfCharAfterComma : byteType; end; type intType = record value : integer; numOfChar : byteType; end; type screenPositionType = record x : byteType; y : byteType; end; type attributeType = byteType; type switchType = record name : text20Type; state : stateType; end; type lampType = record name : text20Type; state : stateType; end; type conveyorType = record number : numberType; name : text20Type; conveyorLength : lengthType; state : stateType; position : byteType; switch : switchType; lamp : lampType; end; type conveyorArrayType = array [1..5] of conveyorType; type emergencyStopType = record switch : switchType; lamp : lampType; end; type positionType = record x : byteType; y : byteType; end; type switchSequenceArrayType = array [1..MAX_NUMBER_OF_SWITCHES_IN_SEQUENCE] of byte; var conveyor : conveyorArrayType; emergencyStop : emergencyStopType; posOfBox : positionType; posOfElevator : byteType; validSwitchSequence : switchSequenceArrayType; actualSequencePosition : byteType; (* +++++++++++++++++++ Global Operations ++++++++++++++++++++++++++++++++++ *) procedure setConveyorNumber (number : byteType); begin conveyor [number].number := number; end; procedure getConveyorNumber ( conveyorNumber : byteType; var number : byteType); begin number := conveyor [conveyorNumber].number; end; procedure setConveyorName (conveyorNumber : byteType; name : text20Type); begin conveyor [conveyorNumber].name := name; end; procedure getConveyorName ( conveyorNumber : byteType; var name : text20Type); begin name := conveyor [conveyorNumber].name; end; procedure setConveyorLength (conveyorNumber : byteType; conveyorLength : lengthType); begin conveyor [conveyorNumber].conveyorLength := conveyorLength; end; procedure getConveyorLength ( conveyorNumber : byteType; var conveyorLength : lengthType); begin conveyorLength := conveyor [conveyorNumber].conveyorLength; end; procedure setConveyorState (conveyorNumber : byteType; state : stateType); begin conveyor [conveyorNumber].state := state; end; procedure getConveyorState ( conveyorNumber : byteType; var state : stateType); begin state := conveyor [conveyorNumber].state; end; procedure setConveyorPosition (conveyorNumber : byteType; position : byteType); begin conveyor [conveyorNumber].position := position; end; procedure getConveyorPosition ( conveyorNumber : numberType; var position : byteType); begin position := conveyor [conveyorNumber].position; end; procedure setConveyorSwitchName (conveyorNumber : byteType; name : text20Type); begin conveyor [conveyorNumber].switch.name := name; end; procedure getConveyorSwitchName ( conveyorNumber : byteType; var name : text20Type); begin name := conveyor [conveyorNumber].switch.name; end; procedure setConveyorSwitchState (conveyorNumber : byteType; state : stateType); begin conveyor [conveyorNumber].switch.state := state; end; procedure getConveyorSwitchState ( conveyorNumber : byteType; var state : stateType); begin state := conveyor [conveyorNumber].switch.state; end; procedure setConveyorLampName (conveyorNumber : byteType; name : text20Type); begin conveyor [conveyorNumber].lamp.name := name; end; procedure getConveyorLampName ( conveyorNumber : byteType; var name : text20Type); begin name := conveyor [conveyorNumber].lamp.name; end; procedure setConveyorLampState (conveyorNumber : byteType; state : stateType); begin conveyor [conveyorNumber].lamp.state := state; end; procedure getConveyorLampState ( conveyorNumber : numberType; var state : stateType); begin state := conveyor [conveyorNumber].lamp.state; end; procedure setEmergencyStopSwitchName (name : text20Type); begin emergencyStop.switch.name := name; end; procedure getEmergencyStopSwitchName (var name : text20Type); begin name := emergencyStop.switch.name; end; procedure getEmergencyStopSwitchState (var state : stateType); begin state := emergencyStop.switch.state; end; procedure setEmergencyStopSwitchState (state : stateType); begin emergencyStop.switch.State := state; end; procedure setEmergencyStopLampName (name : text20Type); begin emergencyStop.lamp.name := name; end; procedure getEmergencyStopLampName (var name : text20Type); begin name := emergencyStop.lamp.name; end; procedure setEmergencyStopLampState (state : stateType); begin emergencyStop.lamp.state := state; end; procedure getEmergencyStopLampState (var state : stateType); begin state := emergencyStop.lamp.state; end; procedure setPosOfBox (x, y : byteType); begin posOfBox.x := x; posOfBox.y := y; end; procedure getPosOfBox (var x : byteType; var y : byteType); begin x := posOfBox.x; y := posOfBox.y; end; procedure setPosOfElevator (position : byteType); begin posOfElevator := position; end; procedure getPosOfElevator (var position : byteType); begin position := posOfElevator; end; procedure setValidSwitchSequence (position : byteType; value : byteType); begin validSwitchSequence [position] := value; end; procedure getValidSwitchSequence ( position : byteType; var value : byteType); begin value := validSwitchSequence [position]; end; procedure setActualSequencePosition (position : byteType); begin actualSequencePosition := position; end; procedure getActualSequencePosition (var position : byteType); begin position := actualSequencePosition; end; procedure changeConveyorLampState ( conveyorNumber : numberType; state : stateType; var stateChanged : boolType); var actualState : stateType; begin getConveyorLampState (conveyorNumber, actualState); if (actualState <> state) then begin setConveyorLampState (conveyorNumber, state); stateChanged := true; end else stateChanged := false; end; procedure changeConveyorSwitchState ( conveyorNumber : numberType; state : stateType; var stateChanged : boolType); var actualState : stateType; begin getConveyorSwitchState (conveyorNumber, actualState); if (actualState <> state) then begin setConveyorSwitchState (conveyorNumber, state); stateChanged := true; end else stateChanged := false; end; procedure changeConveyorPosition ( conveyorNumber : numberType; position : byteType; var positionChanged : boolType); var actualPosition : byteType; begin getConveyorPosition (conveyorNumber, actualPosition); if (actualPosition <> position) then begin setConveyorPosition (conveyorNumber, position); positionChanged := true; end else positionChanged := false; end; procedure changeEmergencyStopSwitchState ( state : stateType; var stateChanged : boolType); var actualState : stateType; begin getEmergencyStopSwitchState (actualState); if (actualState <> state) then begin setEmergencyStopSwitchState (state); stateChanged := true; end else stateChanged := false; end; procedure changeEmergencyStopLampState ( state : stateType; var stateChanged : boolType); var actualState : stateType; begin getEmergencyStopLampState (actualState); if (actualState <> state) then begin setEmergencyStopLampState (state); stateChanged := true; end else stateChanged := false; end; (* +++++++++++++++++++ User Interface +++++++++++++++++++++++++++++++++++++ *) procedure clearScreen; begin clrScr; end; procedure getTextAttribute (var attribute : attributeType); begin attribute := textAttr; end; procedure setTextAttribute (attribute : attributeType); begin textAttr := attribute; end; procedure setTextBlink (attribute : byteType); begin case attribute of NO_BLINK : if (textAttr > 127) then textAttr := textAttr - 128; BLINK : if (textAttr < 128) then textAttr := textAttr + 128; end; end; procedure setForeGroundColor (color : byteType); begin textColor (color); end; procedure setBackgroundColor (color : byteType); begin textBackground (color); end; procedure showChar (x, y : byteType; character : charType; attibute : attributeType; colorFront : byteType; colorBack : byteType); var textattribute : byteType; begin getTextAttribute (textAttribute); setForeGroundColor (colorFront); setBackGroundColor (colorBack); if (attibute = 7) then setTextBlink (BLINK); gotoXY (x, y); write (character); setTextBlink (NO_BLINK); setTextAttribute (textAttribute); end; procedure deleteChars (x, y : byteType; numOfChars : byteType; color : byteType); var i : byteType; begin for i := 0 to (numOfChars - 1) do begin showChar (x + i, y, BLANK, 0, 0, color); end; end; procedure showText (x, y : byteType; outText : stringType; attibute : attributeType; colorFront : byteType; colorBack : byteType); var textattribute : byteType; begin getTextAttribute (textAttribute); setForeGroundColor (colorFront); setBackGroundColor (colorBack); if (attibute = 7) then setTextBlink (BLINK); gotoXY (x, y); write (outText); setTextBlink (NO_BLINK); setTextAttribute (textAttribute); end; procedure getCharFromKeyboard ( x, y : byteType; valChars : charSetType; color : byteType; var key : charType); var textattribute : byteType; begin getTextAttribute (textAttribute); setBackGroundColor (color); repeat showChar (x, y, BLANK, 0, 0, color); gotoXY (x, y); key := readKey; until (key in valChars); setTextAttribute (textAttribute); end; procedure showLamp (x, y : byteType; state : byteType); const LAMP_SIGN = '±±'; begin if state = ON then showText (x, y, LAMP_SIGN, 0, 0, RED) else if state = OFF then showText (x, y, LAMP_SIGN, 0, 0, GREEN); end; procedure drawColoredArea (x, y : byteType; lengthOfArea : byteType; rows : byteType; color : byteType); var textAttribute : byteType; line : stringType; i : byteType; begin getTextAttribute (textAttribute); line := ''; for i := 1 to lengthOfArea do begin line := line + ' '; end; for i := 0 to rows do begin showText (x, y + i, line, 0, 0, color); end; setTextAttribute (textAttribute); end; procedure drawHorizontalLine (x, y : byteType; lengthOfLine : byteType; style : byteType; colorFront, colorBack : byteType); const HORIZONTAL_LINE_SINGLE = #196; (* character: 'Ä' *) HORIZONTAL_LINE_DOUBLE = #205; (* character: 'Í' *) var character : char; row : byte; begin case style of 1 : character := HORIZONTAL_LINE_SINGLE; 2 : character := HORIZONTAL_LINE_DOUBLE; end; for row := x to (x + lengthOfLine) do begin showChar (row, y, character, 0, colorFront, colorBack); end; end; procedure drawVerticalLine (x, y : byteType; lengthOfLine : byteType; style : byteType; colorFront, colorBack : byteType); const VERTICAL_LINE_SINGLE = #179; (* character: '³' *) VERTICAL_LINE_DOUBLE = #186; (* character: 'º' *) var character : char; line : byte; begin case style of 1 : character := VERTICAL_LINE_SINGLE; 2 : character := VERTICAL_LINE_DOUBLE; end; for line := y to (y + lengthOfLine) do begin showChar (x, line, character, 0, colorFront, colorBack); end; end; procedure drawFrame (x1, y1, x2, y2 : byteType; style : byteType; colorFront, colorBack : byteType); var topLeftCorner : charType; topRightCorner : charType; bottomRightCorner : charType; bottomLeftCorner : charType; begin case style of 1 : begin topLeftCorner := #218; (* character: 'Ú' *) topRightCorner := #191; (* character: '¿' *) bottomRightCorner := #217; (* character: 'Ù' *) bottomLeftCorner := #192; (* character: 'À' *) end; 2 : begin topLeftCorner := #201; (* character: 'É' *) topRightCorner := #187; (* character: '»' *) bottomRightCorner := #188; (* character: '¼' *) bottomLeftCorner := #200; (* character: 'È' *) end; end; showChar (x1, y1, topLeftCorner, 0, colorFront, colorBack); showChar (x2, y1, topRightCorner, 0, colorFront, colorBack); showChar (x1, y2, bottomLeftCorner, 0, colorFront, colorBack); showChar (x2, y2, bottomRightCorner, 0, colorFront, colorBack); drawHorizontalLine (x1 + 1, y1, x2 - x1 - 2, style, colorFront,colorBack); drawHorizontalLine (x1 + 1, y2, x2 - x1 - 2, style, colorFront,colorBack); drawVerticalLine (x1, y1 + 1, y2 - y1 - 2, style, colorFront,colorBack); drawVerticalLine (x2, y1 + 1, y2 - y1 - 2, style, colorFront,colorBack); end; procedure drawSign (x, y : byteType; sign : charType; boxColor : byteType; backGroundColor : byteType); begin showChar (x, y, sign, 0, boxColor, backGroundColor); end; procedure drawMovingSign (sign : charType; x, y : byteType; numOfSteps : byteType; direction : byteType; speed : wordType; boxColor : byteType; backGroundColor : byteType); var i : byteType; begin if (direction = RIGHT) then begin for i := 0 to numOfSteps do begin showChar (x + i, y, sign, 0, boxColor, backGroundColor); delay (speed); showChar (x + i, y , BLANK, 1, 0, backGroundColor); end; showChar (x + i, y, sign, 0, boxColor ,backGroundColor); end; if (direction = LEFT) then begin for i := 0 to numOfSteps do begin showChar (x - i, y, sign, 0, boxColor, backGroundColor); delay (speed); showChar (x - i, y , BLANK, 1, 0, backGroundColor); end; showChar (x - i, y, sign, 0, boxColor ,backGroundColor); end; if (direction = UP) then begin for i := 0 to numOfSteps do begin showChar (x, y - i, sign, 0, boxColor, backGroundColor); delay (speed); showChar (x, y - i , BLANK, 1, 0, backGroundColor); end; showChar (x, y - i, sign, 0, boxColor ,backGroundColor); end; if (direction = DOWN) then begin for i := 0 to numOfSteps do begin showChar (x, y + i, sign, 0, boxColor, backGroundColor); delay (speed); showChar (x, y + i , BLANK, 1, 0, backGroundColor); end; showChar (x, y + i, sign, 0, boxColor ,backGroundColor); end; end; procedure drawMovingBox (x, y : byteType; numOfSteps : byteType; direction : byteType; speed : wordType; boxColor : byteType; backGroundColor : byteType); const BOX_SIGN = '±'; begin setPosOfBox (x, y); drawMovingSign (BOX_SIGN, x, y, numOfSteps, direction, speed, boxColor, backGroundColor); if (direction = LEFT) then setPosOfBox (x - numOfSteps, y); if (direction = RIGHT) then setPosOfBox (x + numOfSteps, y); if (direction = UP) then setPosOfBox (x, y - numOfSteps); if (direction = DOWN) then setPosOfBox (x, y + numOfSteps); end; procedure drawBox (x, y : byteType; boxColor : byteType; backGroundColor : byteType); const BOX_SIGN = '±'; begin drawSign (x, y, BOX_SIGN, boxColor, backGroundColor); setPosOfBox (x, y); end; procedure drawMovingElevator (x, y : byteType; lengthOfLine : byteType; numOfSteps : byteType; direction : byteType; speed : wordType; boxVisible : boolType; posInElevator : byteType; lineColor : byteType; boxColor : byteType; backGroundColor : byteType); var i : byteType; xOfBox : byteType; yOfBox : byteType; begin if (boxVisible = VISIBLE) then begin if (posInElevator = LEFT) then setPosOfBox (x + 1, y - 1); if (posInElevator = RIGHT) then setPosOfBox (x + lengthOfLine - 1, y - 1); if (posInElevator = CENTER) then begin i := trunc (lengthOfLine / 2); setPosOfBox (x + trunc (lengthOfLine / 2) + 1, y - 1); end; end; if ((direction = UP) and (posOfElevator = BOTTOM)) then begin if (boxVisible = VISIBLE) then getPosOfBox (xOfBox, yOfBox); for i := 0 to numOfSteps do begin drawHorizontalLine (x, y - i, lengthOfLine, 1, lineColor, backGroundColor); if (boxVisible = VISIBLE) then begin drawBox (xOfBox, y - i - 1, boxColor, backGroundColor); end; delay (speed); deleteChars (x, y - i, lengthOfLine + 1, backGroundColor); if (boxVisible = VISIBLE) then deleteChars (xOfBox, y - i - 1, 1, backGroundColor); end; drawHorizontalLine (x, y - i, lengthOfLine, 1, lineColor, backGroundColor); drawBox (xOfBox, y - i - 1, boxColor, backGroundColor); setPosOfElevator (TOP); end; if ((direction = DOWN) and (posOfElevator = TOP)) then begin if (boxVisible = VISIBLE) then getPosOfBox (xOfBox, yOfBox); for i := 0 to numOfSteps do begin drawHorizontalLine (x, y + i, lengthOfLine, 1, lineColor, backGroundColor); if (boxVisible = VISIBLE) then begin drawBox (xOfBox, y + i - 1, boxColor, backGroundColor); end; delay (speed); deleteChars (x, y + i, lengthOfLine + 1, backGroundColor); if (boxVisible = VISIBLE) then deleteChars (xOfBox, y + i - 1, 1, backGroundColor); end; drawHorizontalLine (x, y + i, lengthOfLine, 1, lineColor, backGroundColor); drawBox (xOfBox, y + i - 1, boxColor, backGroundColor); setPosOfElevator (BOTTOM); end; end; procedure showUserInterface; var line : stringType; i : byteType; begin clearScreen; drawFrame (02, 01, 79, 24, 2, CYAN, BLUE); drawHorizontalLine (03, 12, 75, 1, YELLOW, BLUE); drawColoredArea (03, 02, 14, 09, WHITE); drawColoredArea (02, 25, 78, 0, RED); showText (05, 03, 'B1', 0, BLACK, WHITE); showText (09, 03, 'B2', 0, BLACK, WHITE); showText (13, 03, 'B3', 0, BLACK, WHITE); showText (07, 06, 'B4', 0, BLACK, WHITE); showText (11, 06, 'B5', 0, BLACK, WHITE); showText (06, 09, 'NOT AUS', 0, BLACK, WHITE); showLamp (05, 04, OFF); showLamp (09, 04, OFF); showLamp (13, 04, OFF); showLamp (07, 07, OFF); showLamp (11, 07, OFF); showLamp (09, 10, ON); drawColoredArea (19, 02, 60, 09, CYAN); line := ''; for i := 1 to 60 do line := line + ' '; showText (19, 02, line, 0, 0, WHITE); showText (21, 02, 'Schalter', 0, YELLOW, WHITE); drawColoredArea (21, 04, 20, 06, WHITE); showText (21, 04, '1 -> B1 ', 0, BLACK, WHITE); showText (21, 05, '2 -> B2 ', 0, BLACK, WHITE); showText (21, 06, '3 -> B3 ', 0, BLACK, WHITE); showText (21, 07, '4 -> B4 ', 0, BLACK, WHITE); showText (21, 08, '5 -> B5 ', 0, BLACK, WHITE); showText (21, 10, '0 -> NOT AUS', 0, BLACK, WHITE); showText (50, 10, 'Schalter:', 0, BLACK, CYAN); drawColoredArea (03, 13, 76, 10, WHITE); drawHorizontalLine (15, 15, 20, 1, BLACK, WHITE); drawHorizontalLine (37, 22, 07, 1, BLACK, WHITE); drawHorizontalLine (46, 22, 20, 1, BLACK, WHITE); drawVerticalLine (36, 15, 07, 1, BLACK, WHITE); drawVerticalLine (45, 15, 07, 1, BLACK, WHITE); showText (56, 23, 'B1', 0, YELLOW, WHITE); showText (40, 23, 'B2', 0, YELLOW, WHITE); showText (46, 18, 'B3', 0, YELLOW, WHITE); showText (25, 16, 'B4', 0, YELLOW, WHITE); showText (34, 18, 'B5', 0, YELLOW, WHITE); end; (* +++++++++++++++++++ Initialization +++++++++++++++++++++++++++++++++++++ *) procedure initConveyor (number : byteType; name : text20Type; conveyorLength : lengthType; state : stateType; position : byteType; switchName : text20Type; switchState : stateType; lampName : text20Type; lampState : stateType); begin setConveyorNumber (number); setConveyorName (number, name); setConveyorLength (number, conveyorLength); setConveyorSwitchName (number, switchName); setConveyorSwitchName (number, switchName); setConveyorSwitchState (number, switchState); setConveyorLampName (number, lampName); setConveyorLampState (number, lampState); end; procedure initConveyorSystem; begin initConveyor (1, 'Band 1', 1.0, OFF, NONE, 'Schalter 1', OFF, 'Lampe 1', OFF); initConveyor (2, 'Band 2', 1.0, OFF, NONE, 'Schalter 2', OFF, 'Lampe 2', OFF); initConveyor (3, 'Band 3', 2.5, OFF, DOWN, 'Schalter 3', OFF, 'Lampe 3', OFF); initConveyor (4, 'Band 4', 5.0, OFF, NONE, 'Schalter 4', OFF, 'Lampe 4', OFF); initConveyor (5, 'Band 5', 2.5, OFF, DOWN, 'Schalter 5', OFF, 'Lampe 5', OFF); end; procedure initEmergencyStop; begin setEmergencyStopSwitchName ('Not Aus'); setEmergencyStopSwitchState (OFF); setEmergencyStopLampName ('Lampe Not-Aus'); setEmergencyStopLampState (OFF); end; procedure initPosOfBox; begin setPosOfBox (67, 21); end; procedure initPosOfElevator; begin setPosOfElevator (BOTTOM); end; procedure initValidSwitchSequence; var i : byteType; begin for i := 1 to MAX_NUMBER_OF_SWITCHES_IN_SEQUENCE do setValidSwitchSequence (i, 0); setValidSwitchSequence (1, 1); setValidSwitchSequence (2, 2); setValidSwitchSequence (3, 3); setValidSwitchSequence (4, 2); setValidSwitchSequence (5, 4); setValidSwitchSequence (6, 5); end; procedure initActualSequencePosition; begin setActualSequencePosition (0); end; procedure initGlobalVars; begin initConveyorSystem; initEmergencyStop; initPosOfBox; initPosOfElevator; initValidSwitchSequence; initActualSequencePosition; end; procedure initUserInterface; begin setForeGroundColor (YELLOW); setBackgroundColor (BLUE); clearScreen; end; procedure initializeSystem; begin initGlobalVars; initUserInterface; showUserInterface; drawBox (posOfBox.x, posOfBox.y, RED, WHITE); end; (* +++++++++++++++++++ Logic ++++++++++++++++++++++++++++++++++++++++++++++ *) procedure getUserInput ( charSet : charSetType; var key : charType); begin getCharFromKeyboard (60, 10, charSet, WHITE, key); showText (02, 25, key, 0, WHITE, RED); end; procedure checkSwitch ( switch : charType; var validSwitch : boolType); begin end; procedure showMovingBox; begin end; procedure showMessage (message : stringType); begin end; procedure doMain; const END_OF_PROGRAM = ESC_KEY; var switch : charType; validSwitch : boolType; begin initializeSystem; repeat (* getUserInput (VALID_KEYS, switch); checkSwitch (switch, validSwitch); if validSwitch then showMovingBox else showMessage ('Schalter nicht zul„sssig!'); *) getUserInput (VALID_KEYS, switch); drawBox (posOfBox.x, posOfBox.y, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x - 1, posOfBox.y, 20, LEFT, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x - 2, posOfBox.y, 07, UP , 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x, posOfBox.y, 07, LEFT, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x - 2, posOfBox.y, 20, LEFT, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x, posOfBox.y, 20, RIGHT, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x + 2, posOfBox.y, 07, DOWN, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x, posOfBox.y, 07, RIGHT, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawMovingBox (posOfBox.x + 2, posOfBox.y, 21, RIGHT, 100, RED, WHITE); deleteChars (posOfBox.x, posOfBox.y, 1, WHITE); drawBox (posOfBox.x + 1, posOfBox.y, RED, WHITE); drawMovingElevator (37, 22, 07, 07, UP, 400, VISIBLE, LEFT, BLACK, RED, WHITE); drawMovingElevator (37, 15, 07, 07, DOWN, 400, VISIBLE, RIGHT, BLACK, RED, WHITE); getUserInput (VALID_KEYS, switch); if (switch <> END_OF_PROGRAM) then begin initializeSystem; end; until (switch = END_OF_PROGRAM); end; begin doMain; end.