
-----------------------------------
vahnx
Mon Jan 16, 2012 3:32 pm

Removing Extra Space From End of Text File
-----------------------------------
How do I prevent this code from creating a new line?


var id : int
open : id, "C:/hello.txt", put, mod
put : id, "hi"
close : id


If you go inside the file after it's created you can see there's a blank line on line 2. Reason this is an issue is my maze program craps out when I try to parse my mazes I build using the '+' button. You can manually go into the file after you save your maze and remove the last line and save again and it imports fine!

CTRL+f for %%% HERE %%% in the below file to see where I must delete the extra space... (or I must somehow ignore it during creation).


/*********************************************************************

 Maze Program - by vahnx
 2011 ? vahnx

 Completed:
 - Import mazes dynamically
 - Change maze wall font/color
 - Save/load settings

 To Do:
 - Save highscores for new maps (must delete settings.ini)
 - Have AI complete maze to make sure it's possible to
 reach the end.
 - Race AI?
 - Fix extra line appending magically

 *********************************************************************/

var debug : boolean := false                                                                            % Debugging mode
var fontSize : int := 9                                                                                 % Font size of maze wall
var charFont : int := Font.New ("Sans Serif:" + intstr (fontSize))                                      % Font of maze wall
var nameFont : int := Font.New ("Sans Serif:14")                                                        % Header font
var mazeFont : int := Font.New ("Comic Sans MS:20")                                                     % Debug maze font
var tempMazeFont : int := Font.New ("Comic Sans MS:50")                                                 % Debug maze temp font
var levelFontSize : int := 20                                                                           % Level number font size
var levelFont : int := Font.New ("Sans Serif:" + intstr (levelFontSize))                                % Level number font
var fontChrSelFont : int := Font.New ("Comic Sans MS:10")                                               % Maze wall character font select
var debugFont : int := Font.New ("Times New Roman:7")                                                   % Debugging font x,y axis
var keyFont : int := Font.New ("Times New Roman:15")

/* Counts the number of mazes */
var dir := Dir.Current                                                                                  % Current directory stored (same dir as this source file)
var fileName : string                                                                                   % Holds each filename in the directory
var stream : int := Dir.Open (dir)                                                                      % File stream
var counter : int := 0                                                                                  % Counts the number of files
var file : flexible array 1 .. 0 of string                                                              % Hold each filename
loop                                                                                                    % Loop through maze directory
    fileName := Dir.Get (stream)                                                                        % Obtains filename
    exit when fileName = ""                                                                             % Leaves directory when no more files exist
    if length (fileName) > 4 then                                                                       % Makes sure you don't compare with files shorter than extension
        if Str.Lower (fileName (length (fileName) - 3 .. length (fileName))) = ".txt" then              % Checks if file ends in .txt
            counter += 1                                                                                % Increase number of levels found
            new file, counter                                                                           % Dynamically resizes the array
            file (counter) := fileName                                                                  % Saves the level name
        end if
    end if
end loop
Dir.Close (stream)                                                                                      % Closes stream

/* Load data from all mazes into arrays */
var ch : char := ' '                                                                                    % Used to scan in characters from text file
var mazeFileID, settingsFileID : int                                                                    % Files for maze.txt and settings.ini
var row : int := 0                                                                                      % Default row position
var column : int := 0                                                                                   % Default column position

var numOfRows, numOfColumns : array 1 .. counter of int                                                 % 2D array to store x,y pos of maze
for i : 1 .. counter                                                                                    % Go through each file
    open : mazeFileID, file (i), get                                                                    % Open current file for counting
    loop                                                                                                % Loop through current file
        exit when eof (mazeFileID)                                                                      % Exit when reaches end of file
        get : mazeFileID, ch                                                                            % Obtain each character
        column += 1                                                                                     % Increase column count
        if ch = '\n' then                                                                               % Detects CRLF
            column := 0                                                                                 % Reposition column
            row += 1                                                                                    % Increase row count
        end if
    end loop
    close : mazeFileID                                                                                  % Close file
    row += 1                                                                                            % Increment row count

    numOfRows (i) := row                                                                                % Save number of rows in each maze
    numOfColumns (i) := column                                                                          % Save number of columns in each maze
    column := 0                                                                                         % Reset column counter
    row := 0                                                                                            % Reset row counter
end for

var maze : array 1 .. counter, 1 .. 99, 1 .. 99 of char                                                 % 3D array to store each maze square per level, max 99 chars by 99
var mazeX : array 1 .. 99 of int                                                                        % Save X axis per maze square
var mazeY : array 1 .. 99 of int                                                                        % Save Y axis per maze square

for i : 1 .. counter                                                                                    % Loop through each maze
    for y : 1 .. numOfRows (i)                                                                          % Y axis/rows
        for x : 1 .. numOfColumns (i)                                                                   % X axis/rows
            maze (i, x, y) := ' '                                                                       % Empties array
            mazeX (x) := x * fontSize + ((maxx div fontSize - numOfColumns (i)) * 3) + 10               % Increase x axis
            mazeY (y) := maxy - 250 - y * fontSize + (maxy div 4)                                       % Increase y axis
        end for
    end for
end for

var charX : int := 0                                                                                    % Keeps track of current chars X
var charY : int := 1                                                                                    % Keeps track of current chars Y

for i : 1 .. counter                                                                                    % Go through each maze again, multi-dimensional array resizing not possible
    open : mazeFileID, file (i), get                                                                    % Open current maze for reading
    loop                                                                                                % Loop through maze
        exit when eof (mazeFileID)                                                                      % Exit when reaches end of file
        get : mazeFileID, ch                                                                            % Obtain each character

        charX += 1                                                                                      % Increase character x position
        if ch = '\n' then                                                                               % If character is CRLF then
            charY += 1                                                                                  % Increase row count
            charX := 0                                                                                  % Reposition x
        else                                                                                            % If no CRLF then
            maze (i, charX, charY) := ch                                                                % Store maze character information
        end if

    end loop
    charX := 0                                                                                          % Reset x
    charY := 1                                                                                          % Reset y
    close : mazeFileID                                                                                  % Close current file
end for

var mainWindow := Window.Open ("graphics:800;600;offscreenonly,position:center;middle,nobuttonbar,nocursor, title:Emazizing") % Main window settings
var mouseX, mouseY, button, updown : int                                                                                    % Mouse information
var keys : array char of boolean                                                                                            % Keyboard input
var boxX, boxY : int := 0                                                                                                   % Level box selection area
var boxWidth, boxHeight : int                                                                                               % Size of the box
var mapX, mapY : int := 0                                                                                                   % Map maker grid
var mapSize : int := 10
var col : int                                                                                                               % Level font color
var wallCol : int := white                                                                                                  % Wall color
var borderCol : int := white                                                                                                % Wall border color
var floorCol : int := black                                                                                                 % Floor color
var rCol1, rCol2 : int                                                                                                      % Randomize color
var colorBoxSize : int := 30                                                                                                % Size of color pallet
var colorBoxX := 100                                                                                                        % Color pallet X
var colorBoxY := maxy - 100                                                                                                 % Color pallet Y
var heightY : int                                                                                                           % Level selection height
var debugText : string := ""                                                                                                % Debug toggle text
var topText : string := ""                                                                                                  % Text at the top of the screen
var topTextX : int := maxx div 2 - 60                                                                                       % X position of the top text
var highscoreX : int := maxx div 2 - 60                                                                                     % Highscore X position
var mazeWall : char := chr (35)                                                                                             % Default maze character (#)
var tempMazeWall : char := mazeWall                                                                                         % Temporary char selection
var currentChr : char := mazeWall                                                                                           % Currently selected char
var mazeFloor : char := ' '                                                                                                 % Maze floor character
var borderOn : boolean := false                                                                                              % White borders surround the wall
var firstTime : boolean := true                                                                                             % Used in debug
var hitESC : boolean := false                                                                                               % Needed to avoid ESC overwriting highscore
var changeClick : boolean := false                                                                                          % Wall char selection toggle
var outputID : int                                                                                                          % Debug text maze window ID
var wallSelectX : array 1 .. 6 of int := init (37, 86, 86, 690, 690, 86)                                                    % Speech bubble with char selection X co-ords
var wallSelectY : array 1 .. 6 of int := init (563, 491, 360, 360, 530, 530)                                                % Speech bubble with char selection Y co-ords
var fontChrSelX : int := wallSelectX (1)                                                                                    % Starting X pos to draw maze wall type
var fontChrSelY : int := wallSelectY (1)                                                                                    % Starting Y pos to draw maze wall type
var startX, endX : int                                                                                                      % Starting and ending spots of maze
var startXBool, endXBool : boolean := false                                                                                 % If start and end have been found
var playerX, playerY : int                                                                                                  % Used to hold player X/Y co-ords
var playerSteps : int := 3                                                                                                  % Number of steps a player takes
var aiX, aiY : int                                                                                                          % Used to hold AI X/Y co-ords
var saveNameCh : char                                                                                                       % Input save file name
var saveName : string := ""                                                                                                 % File savename
var xyFound, foundBottom : boolean := false                                                                                 % Locate the top left wall of a newly created map
var xStore, yStore : int                                                                                                    % Store x/y axis
var farRight, bottom : int := 0                                                                                         % Find far X and bottom left of new map
var lvlX : int := 0                                                                                                         % Align level numbering properly
var line : string                                                                                                           % Line read for file I/O
var timer : int := 0                                                                                                        % Score timer
var back : boolean := false                                                                                                 % Needed to go back and not X
var fileArray : flexible array 1 .. 0 of string                                                                             % Hold each file name
var lineCounter : int := 0                                                                                                  % Count number of rows in settings.ini
var score : array 1 .. counter of int                                                                                       % Store the score for each maze
var scoreCounter : int := 0                                                                                                 % Keep track of score id
for i : 1 .. upper (score)                                                                                                  % Loop through all scores
    score (i) := 0                                                                                                          % Default all scores to 0
end for

var maxMapX : int := 40
var maxMapY : int := 25
var mapXStore : array 1 .. maxMapX of int
var mapYStore : array 1 .. maxMapY of int
var mapClick : array 1 .. maxMapX, 1 .. maxMapY of boolean
mapY := 250
for y : 1 .. maxMapY
    for x : 1 .. maxMapX
        mapXStore (x) := mapX
        mapYStore (y) := mapY
        mapX += mapSize
        mapClick (x, y) := false
    end for
    mapY += mapSize
    mapX := 200
end for

Font.Draw (chr (26), 0, 0, keyFont, black)              % Draw initial arrow (facing right)
var rightArrow, leftArrow, upArrow, downArrow : int
rightArrow := Pic.New (0, 0, 10, 10)                    % Right arrow
downArrow := Pic.Rotate (rightArrow, 270, 5, 5)         % Down arrow
leftArrow := Pic.Rotate (rightArrow, 180, 5, 5)         % Left arrow
upArrow := Pic.Rotate (rightArrow, 90, 5, 5)            % Up arrow
Mouse.ButtonChoose ("multibutton")
var leftClick, middleClick, rightClick : int

% Delete extra width of maze
%%%% SHRINK MAZE SPACE WIDTH BY 1 BLOCK %%%
%%%% THEN END OF LOOP INCREASE AGAIN    %%%
%%%% TEMP ARRAY???                      %%%
for i : 1 .. counter
    for y : 1 .. numOfRows (i)
        for x : 1 .. numOfColumns (i)
            if maze (i, x, y) = ' ' then
                %maze (i, x+1, y) := mazeWall
            end if
        end for
    end for
end for

function contains (wordCompare : string, lookup : string) : int
    var start : int
    for i : 1 .. length (wordCompare)
        if wordCompare (i .. i + length (lookup) - 1) = lookup then
            result i
        else
            if i > length (wordCompare) - length (lookup) then
                result - 1
            end if
        end if
    end for
end contains

if not File.Exists ("settings.ini") then
    open : settingsFileID, "settings.ini", put
    put : settingsFileID, "char=", mazeWall
    put : settingsFileID, "wall=", wallCol
    put : settingsFileID, "floor=", floorCol
    for i : 1 .. counter
        put : settingsFileID, file (i), "=", 0
    end for
    close : settingsFileID
else
    open : settingsFileID, "settings.ini", get
    loop
        exit when eof (settingsFileID)
        get : settingsFileID, line : *
        if length (line) > 5 then
            if line (1 .. 5) = "char=" then
                mazeWall := line (6)
            end if
        end if
        if contains (line, "wall=") not= -1 then
            wallCol := strint (line (6 .. length (line)))
        end if
        if contains (line, "floor=") not= -1 then
            floorCol := strint (line (7 .. length (line)))
        end if
        if contains (line, ".TXT=") not= -1 then
            scoreCounter := scoreCounter + 1
            score (scoreCounter) := strint (line (contains (line, ".TXT=") + 5 .. length (line)))
        end if
    end loop
    close : settingsFileID
end if

procedure Refresh
    Draw.FillBox (0, 0, maxx, maxy, black)
    Draw.FillBox (0, maxy - 50, maxx, maxy, blue)

    if debug then
        Draw.FillBox (10, maxy - 40, 40, maxy - 10, green)
        Draw.Box (10, maxy - 40, 40, maxy - 10, brightred)
        Font.Draw (mazeWall, 14, maxy - 35, mazeFont, white)
    else
        Draw.FillBox (10, maxy - 40, 40, maxy - 10, wallCol)
        Draw.Box (10, maxy - 40, 40, maxy - 10, white)
    end if
    Draw.Line (0, 250, maxx, 250, white)

    Font.Draw (topText, topTextX, maxy - 32, nameFont, white)
end Refresh

procedure KeyPress
    if keys ('a') then
        Draw.FillBox (150, 15, 175, 40, yellow)
    else
        Draw.FillBox (150, 15, 175, 40, white)
    end if
    if keys ('s') then
        Draw.FillBox (180, 15, 205, 40, yellow)
    else
        Draw.FillBox (180, 15, 205, 40, white)
    end if
    if keys ('d') then
        Draw.FillBox (210, 15, 235, 40, yellow)
    else
        Draw.FillBox (210, 15, 235, 40, white)
    end if
    if keys ('w') then
        Draw.FillBox (180, 45, 205, 70, yellow)
    else
        Draw.FillBox (180, 45, 205, 70, white)
    end if
    Font.Draw ("A", 156, 22, keyFont, black)
    Font.Draw ("S", 188, 22, keyFont, black)
    Font.Draw ("D", 217, 22, keyFont, black)
    Font.Draw ("W", 184, 50, keyFont, black)


    if keys (KEY_LEFT_ARROW) then
        Draw.FillBox (550, 15, 575, 40, yellow)
    else
        Draw.FillBox (550, 15, 575, 40, white)
    end if
    if keys (KEY_DOWN_ARROW) then
        Draw.FillBox (580, 15, 605, 40, yellow)
    else
        Draw.FillBox (580, 15, 605, 40, white)
    end if
    if keys (KEY_RIGHT_ARROW) then
        Draw.FillBox (610, 15, 635, 40, yellow)
    else
        Draw.FillBox (610, 15, 635, 40, white)
    end if
    if keys (KEY_UP_ARROW) then
        Draw.FillBox (580, 45, 605, 70, yellow)
    else
        Draw.FillBox (580, 45, 605, 70, white)
    end if
    Pic.Draw (leftArrow, 556, 22, picMerge)
    Pic.Draw (downArrow, 588, 17, picMerge)
    Pic.Draw (rightArrow, 617, 22, picMerge)
    Pic.Draw (upArrow, 588, 52, picMerge)
end KeyPress

loop
    Mouse.Where (mouseX, mouseY, button)
    Input.KeyDown (keys)
    Refresh
    KeyPress
    topText := "Select a Level"
    topTextX := maxx div 2 - 80
    hitESC := false

    heightY := 220
    boxX := -50

    if wallCol = white then
        borderCol := black
    else
        borderCol := white
    end if

    for i : 1 .. counter

        if boxX > maxx - 100 then
            boxX := -50
            heightY -= 50
        end if
        boxX += 50

        if mouseX >= 20 + boxX and mouseX = heightY - 10 and mouseY  playerY and button = 1)*/ then
                        if debug then
                            playerY += fontSize - 3
                        else
                            if not whatdotcolor (playerX + 2, playerY + 10) = wallCol or (borderOn and whatdotcolor (playerX + 2, playerY + 10) = white) then
                                playerY += fontSize - 3
                            end if
                        end if
                    end if
                    if keys ('s') or keys (KEY_DOWN_ARROW)     /*or (mouseY < playerY and button = 1)*/ then
                        if debug then
                            playerY -= fontSize - 3
                        else
                            if not whatdotcolor (playerX + 2, playerY - 5) = wallCol or (borderOn and whatdotcolor (playerX + 2, playerY - 5) = white) then
                                playerY -= fontSize - 3
                            end if
                        end if
                    end if
                    if keys ('a') or keys (KEY_LEFT_ARROW)     /*or (mouseX < playerX and button = 1)*/ then
                        if debug then
                            playerX -= fontSize - 3
                        else
                            if not whatdotcolor (playerX - 5, playerY + 2) = wallCol or (borderOn and whatdotcolor (playerX - 5, playerY + 2) = white) then
                                playerX -= fontSize - 3
                            end if
                        end if
                    end if
                    if keys ('d') or keys (KEY_RIGHT_ARROW)     /*or (mouseX > playerX and button = 1)*/ then
                        if debug then
                            playerX += fontSize - 3
                        else
                            if not whatdotcolor (playerX + 10, playerY + 2) = wallCol or (borderOn and whatdotcolor (playerX + 10, playerY + 2) = white) then
                                playerX += fontSize - 3
                            end if
                        end if
                    end if
                    if keys (KEY_ESC) then
                        startXBool := false
                        endXBool := false
                        hitESC := true
                        timer := 0
                        exit
                    end if

                    if playerY > maxy - 105 then
                        playerY -= fontSize - 3
                    end if

                    if playerY < maxy - 105 - numOfRows (i) * 9 then
                        startXBool := false
                        endXBool := false
                        playerY := 0
                        playerX := 0
                        exit
                    end if

                    for y : 1 .. numOfRows (i)
                        for x : 1 .. numOfColumns (i)
                            %if playerX >
                            %end if
                        end for
                    end for

                    if debug then
                        Draw.Line (startX, maxy - 100, startX + 14, maxy - 100, brightgreen)
                        Draw.Line (endX, maxy - 105 - numOfRows (i) * 9, endX + 14, maxy - 105 - numOfRows (i) * 9, brightred)
                    else
                        Draw.Line (startX + 2, maxy - 100, startX + 16, maxy - 100, brightgreen)
                        Draw.Line (endX + 2, maxy - 105 - numOfRows (i) * 9, endX + 16, maxy - 105 - numOfRows (i) * 9, brightred)
                    end if

                    Draw.FillBox (playerX, playerY, playerX + fontSize - 4, playerY + fontSize - 4, yellow)
                    Draw.Box (playerX, playerY, playerX + fontSize - 4, playerY + fontSize - 4, black)
                    View.Update
                    delay (50)
                    timer += 1
                end loop

                if debug then
                    Window.Close (outputID)
                end if

                % SAVE SCORE HERE
                if not hitESC then
                    open : settingsFileID, "settings.ini", put, get, mod

                    lineCounter := 0

                    loop
                        exit when eof (settingsFileID)
                        get : settingsFileID, line
                        lineCounter += 1
                        new fileArray, lineCounter
                        fileArray (lineCounter) := line

                        if length (line) > 5 then
                            for j : 1 .. length (line)
                                if line (j) = "." then
                                    if Str.Lower (line (j .. j + 4)) = ".txt=" then
                                        if Str.Lower (line (1 .. j - 1) + ".txt") = Str.Lower (file (i)) then
                                            if contains (line, ".TXT=") not= -1 then
                                                if timer < score (i) or score (i) = 0 then
                                                    score (i) := timer
                                                    fileArray (lineCounter) := line (1 .. length (line) - length (line (contains (line, ".TXT=") + 5 .. length (line)))) + intstr (score (i))
                                                end if
                                            end if
                                            exit
                                        end if
                                    end if
                                end if
                            end for
                        end if
                    end loop
                    close : settingsFileID

                    open : settingsFileID, "settings.ini", put
                    %put : settingsFileID, "char=", mazeWall
                    %put : settingsFileID, "wall=", wallCol
                    %put : settingsFileID, "floor=", wallCol
                    for j : 1 .. upper (fileArray)
                        put : settingsFileID, fileArray (j)
                    end for
                    close : settingsFileID

                end if
            end if
        else
            col := white
        end if

        Draw.FillBox (20 + boxX, heightY - 10, 50 + boxX, heightY + 20, blue)
        Draw.Box (20 + boxX, heightY - 10, 50 + boxX, heightY + 20, brightred)
        lvlX := 0
        if i < 10 then
            lvlX -= 6
        end if
        Font.Draw (intstr (i), boxX + 20 - lvlX, heightY - 5, levelFont, col)

        if i = counter then            % Add a + button to add custom map
            if boxX > maxx - 100 then
                boxX := -50
                heightY -= 50
            end if
            Draw.FillBox (boxX + 70, heightY - 10, 100 + boxX, heightY + 20, green)
            Draw.Box (boxX + 70, heightY - 10, 100 + boxX, heightY + 20, brightblue)
            Font.Draw ("+", boxX + 77, heightY - 5, levelFont, brightred)

            if mouseX > boxX + 70 and mouseX < 100 + boxX and mouseY > heightY - 10 and mouseY < heightY + 20 then
                topText := "Add a new map"
                if button = 1 then
                    loop
                        Mouse.Where (mouseX, mouseY, button)
                        Draw.FillBox (0, 0, maxx, maxy, black)
                        Draw.Box (maxx - 50, maxy - 40, maxx - 80, maxy - 10, white)   % Save floppy disk
                        Font.Draw ("S", maxx - 73, maxy - 35, levelFont, white)
                        if mouseX > maxx - 80 and mouseX < maxx - 50 and mouseY > maxy - 40 and mouseY < maxy - 10 then
                            topTextX := 330
                            topText := "Click to save map"
                            Font.Draw (topText, topTextX, maxy - 32, nameFont, white)
                            if button = 1 then
                                Draw.FillBox (0, maxy, maxx - 100, maxy - 100, black)
                                topText := "Enter a map name (try to be consistant ie: MAZE8) and hit enter"
                                topTextX := 150
                                Font.Draw (topText, topTextX, maxy - 32, nameFont, white)
                                Input.Flush
                                delay (250)
                                for y : 1 .. 25
                                    for x : 1 .. 40
                                        if mapClick (x, y) then
                                            Draw.FillBox (mapXStore (x), mapYStore (y), mapXStore (x) + mapSize, mapYStore (y) + mapSize, brightred)
                                        else
                                            Draw.Box (mapXStore (x), mapYStore (y), mapXStore (x) + mapSize, mapYStore (y) + mapSize, white)
                                        end if
                                        %Font.Draw (intstr (y), mapXStore (x), mapYStore (y), defFontID, white)
                                    end for
                                end for
                                View.Update
                                saveName := ""
                                loop
                                    saveNameCh := getchar
                                    exit when saveNameCh = '\n'
                                    saveName += saveNameCh
                                    Font.Draw (saveName, maxx div 2 - 100, maxy - 80, nameFont, white)
                                    View.Update
                                end loop

                                % SAVE OUT MAP FILE HERE
                                new file, upper (file) + 1
                                file (upper (file)) := saveName + ".TXT"

                                for y : 1 .. 25
                                    for x : 1 .. 40
                                        if mapClick (x, y) then   % FOUND BOTTOM OF MAP
                                            foundBottom := true
                                            if foundBottom then
                                                bottom := y
                                            end if

                                            %put "First X: ", x, " Y: ", y, " from bottom left to top right"
                                            for y2 : y .. 25
                                                if not mapClick (x, y2) then
                                                    %put "2nd X: ", x, " Y: ", y2 - 1, " on the left side"
                                                    xStore := x
                                                    yStore := y
                                                    xyFound := true

                                                    % Look for far right
                                                    for decreasing x2 : 40 .. 1
                                                        if mapClick (x2, y) then
                                                            farRight := x2
                                                            %put x2
                                                            %quit
                                                            exit
                                                        end if
                                                    end for

                                                end if
                                            end for
                                            exit when xyFound
                                        end if
                                    end for
                                end for



                                for decreasing y : yStore .. 1
                                    for x : xStore .. farRight
                                        if mapClick (x, y) then
                                            %put ' ' ..
                                        else
                                            %put '0' ..
                                        end if
                                    end for

                                    %put "END"
                                end for
                                %put yStore
                                %quit


                                open : mazeFileID, saveName + ".TXT", put, mod
                                %put : mazeFileID, yStore
                                for decreasing y : yStore .. 1
                                    %put : mazeFileID, y, " ", bottom, " " ..
                                    exit when not mapClick (xStore, y)
                                    for x : xStore .. farRight
                                        if mapClick (x, y) then
                                            put : mazeFileID, '?' ..
                                        else
                                            put : mazeFileID, ' ' ..
                                        end if
                                    end for
                                    put : mazeFileID, ""
                                end for
                                close : mazeFileID
                                
                                %%% HERE %%%

                                back := true
                                exit
                            end if
                        end if

                        Draw.Box (maxx - 40, maxy - 40, maxx - 10, maxy - 10, white)     % Back button
                        Font.Draw ("