← 都来码 / Dolaima← 例程索引basic/app/hurkle.bas原文

basic/app/hurkle.bas · 22368 字节 · 下载原文

' ═══════════════════════════════════════════════════════════════════════

' HURKLE —— 由 scripts/basic-port.py 从老 BASIC 源码**机械转换**而来

' HURKLE -- **mechanically converted** from the old BASIC source by scripts/basic-port.py

'

' 原始来源:hurkle.bas

' Original source: hurkle.bas

' 版权:David Ahl《BASIC Computer Games》合集已进入**公有领域**(UNLICENSE),

' License: the David Ahl "BASIC Computer Games" collection is in the **public domain** (UNLICENSE),

'       可随包分发 —— 与 gorilla/nibbles 那些"只参考玩法、代码自己写"的不同。

'       so it may be redistributed with the package -- unlike gorilla/nibbles, which only borrow the gameplay and write their own code.

'

' 转换保留:**行号、GOTO、GOSUB、FOR/NEXT 的原结构**(逐行对应)

' What the conversion keeps: **the original line numbers, GOTO, GOSUB and FOR/NEXT structure** (one to one)

' 转换改的:PRINT→ttyP(本平台 PRINT 在游戏窗口里不可见)、INPUT→ttyAsk(手机上不敲键盘)、

' What the conversion changes: PRINT→ttyP (PRINT is invisible inside the game window on this platform), INPUT→ttyAsk (no typing on a phone),

'           CLS/LOCATE/COLOR→垫层(它们写的是被宿主关掉的 VGA 显存)、INT(n*RND(1))→ui_math_rand(n)

'           CLS/LOCATE/COLOR→the shim (they write the VGA video memory that the host turns off), INT(n*RND(1))→ui_math_rand(n)

' 垫层说明见 _tty.bas 头部。重新生成请跑:

' The shim is documented at the top of _tty.bas. To regenerate, run:

'     python3 scripts/basic-port.py <原始.bas> <本文件> --title "HURKLE"

'     python3 scripts/basic-port.py <original.bas> <this-file> --title "HURKLE"

' ═══════════════════════════════════════════════════════════════════════


' ═══════════════════════════════════════════════════════════════════════

' 文本控制台垫层(_tty.bas)—— 给 1970~80 年代那批"打字机式"老 BASIC 程序用

' Text console shim (_tty.bas) -- for the "typewriter style" old BASIC programs of the 1970s-80s

'

' **为什么需要它**:老程序的输出模型是「`PRINT` 顺序打字 + `INPUT` 读一行」,

' **Why it is needed**: an old program's output model is "`PRINT` types in order + `INPUT` reads one line",

' 而本平台这两条在手机上都不成立(都是实测过的,不是推测):

' and on this platform neither of those holds on a phone (both measured, not guessed):

'   · `PRINT` 走 stdout,而窗口化运行时 stdout 被宿主重定向进内存缓冲

'   · `PRINT` goes to stdout, and under the windowed runtime the host redirects stdout into a memory buffer

'     ⇒ **游戏窗口里一个字都看不见**

'     ⇒ **not one character is visible inside the game window**

'   · `LOCATE`/`COLOR`/`CLS` 写的是 `0xB8000` 那段 VGA 文本显存,宿主把 VGA

'   · `LOCATE`/`COLOR`/`CLS` write the VGA text video memory at `0xB8000`, and the host squashes VGA

'     压成 1×1 ⇒ 同样不可见

'     down to 1×1 ⇒ equally invisible

'   · `INPUT` 在窗口路径下 `ReadString()` 返回空串、`ReadInt()` 返回 0

'   · `INPUT` on the window path: `ReadString()` returns an empty string and `ReadInt()` returns 0

'

' 这层用 `ui_*` 重建一个**等宽字符网格**,把老程序那三件事接管掉,

' This layer rebuilds a **monospaced character grid** with `ui_*` and takes those three jobs over,

' 于是老源码可以**保留行号 + GOTO + GOSUB + FOR/NEXT 的原结构**直接跑。

' so the old source can run as-is with **its line numbers + GOTO + GOSUB + FOR/NEXT structure intact**.

'

' ◆ 设计:**不缓冲,即时上屏**

' ◆ Design: **no buffering, paint straight to the screen**

'   第一版用字符串数组做屏缓,整个失效 —— 实测是两个前端缺陷叠加:

'   The first version used a string array as the screen buffer and failed outright -- measured as two frontend bugs stacked:

'     · `cases/31`:字符串数组在 **SUB 内**"写后即读"读到的是**旧值**

'     · `cases/31`: a string array written and then read **inside a SUB** reads back a **stale value**

'     · `cases/29`:字符串数组元素**直接进表达式**被读成整数(地址)

'     · `cases/29`: a string array element **used directly in an expression** is read as an integer (an address)

'   两个都只影响 SUB 内的读写(顶层是好的),而垫层的缓冲逻辑按定义全在 SUB 里。

'   Both only affect reads/writes inside a SUB (the top level is fine), and the shim's buffer logic is by definition all inside SUBs.

'   ⇒ 改成**不缓冲**:`ttyP` 画完立刻 `ui_2d_text` 上屏,只用一个行号计数器。

'   ⇒ switched to **no buffering**: `ttyP` paints with `ui_2d_text` right away, with only a line counter.

'   代价是**没有回滚历史**(超屏就清屏重来)—— 对本批"一屏装得下"的老游戏无影响。

'   The cost is **no scrollback history** (past the last row it clears and starts over) -- harmless for this batch of old games, which fit on one screen.

'

' ◆ 用法(见同目录 hurkle.bas)

' ◆ Usage (see hurkle.bas in the same directory)

'     ttyOpen("HURKLE", 0, 0, 20)   ' 标题 / 旋转 / 手柄 / 字号

'     ttyOpen("HURKLE", 0, 0, 20)   ' title / rotation / gamepad / font size

'     ttyCls

'     ttyP("A HURKLE IS HIDING...")

'     x = ttyAsk("X 坐标 (0-9)", 0, 9)

'     x = ttyAsk("X coordinate (0-9)", 0, 9)

'

' ◆ 三条硬约束(第三条是这类老代码的通行雷;①② 当年是本前端的约束,**2026-10-04 复验都已修好**)

' ◆ Three hard constraints (the third is a common trap in this kind of legacy code; ① and ② were constraints of this frontend back then and **were re-checked fixed on 2026-10-04**)

'   ① ~~`NATIVE SUB/FUNCTION` 必须带**空体**~~(✅ 已不必 —— 链接期会认领库侧符号,实测不写 `NATIVE`

'   ① ~~`NATIVE SUB/FUNCTION` must carry an **empty body**~~ (✅ no longer needed — the linker claims the library-side symbol; measured: without

'      `NATIVE` 的 `FUNCTION ui_scr_get_w()` 照样拿到真值 480)。本文件**照旧**按老写法写(能跑就别动)。

'      `NATIVE`, `FUNCTION ui_scr_get_w()` still returns the real value 480). This file **still** uses the old form (if it runs, leave it alone).

'   ② ~~形参名不能是 BASIC 关键字~~(✅ 已修好 —— 实测 `NATIVE SUB ui_grid_set(i AS INTEGER, on AS INTEGER)`

'   ② ~~a parameter name must not be a BASIC keyword~~ (✅ fixed — measured `NATIVE SUB ui_grid_set(i AS INTEGER, on AS INTEGER)`

'      写 42 读回 42)。本文件**照旧**避开关键字(能跑就别动)。

'      writes 42 and reads back 42). This file **still** avoids keywords (if it runs, leave it alone).

'   ③ **`ELSEIF` 分支的最后一条不能是单行 `IF … THEN <语句>`** —— 它会把下一行

'   ③ **the last statement of an `ELSEIF` branch must not be a single-line `IF … THEN <statement>`** -- it swallows the next line

'      吞进自己的 THEN 分支 ⇒ 块永不闭合 ⇒ **其后整个文件被静默丢弃**。

'      into its own THEN branch ⇒ the block never closes ⇒ **the entire rest of the file is silently dropped**.

'      `cases/30` 是最小复现;转换层遇到这种形态要展开成三行块。

'      `cases/30` is the minimal reproduction; the conversion layer must expand this shape into a three-line block.

' ═══════════════════════════════════════════════════════════════════════


' ── UI 接口:引用**库侧**的声明文件(原先这里是一屏 NATIVE 声明)────────────────

' ── UI interface: include the **library-side** declaration file (this used to be a screenful of NATIVE declarations)

'$INCLUDE: 'vml_ui.bas'


' 界面语言:0 = 中文 / 1 = 英文(跟随系统语言,见 Lib/basic/vml_ui.bas 的 ui_scr_get_language)

' UI language: 0 = Chinese / 1 = English (follows the system language, see ui_scr_get_language in Lib/basic/vml_ui.bas)

DIM LANG AS INTEGER
DIM sOk AS STRING

' ── 状态(全部是模块级标量:不用数组,见头部说明)─────────────────────

' ── State (all module-level scalars: no arrays, see the header)─────────────────────

DIM ttyW AS INTEGER
DIM ttyH AS INTEGER
DIM ttyFont AS INTEGER
DIM ttyLH AS INTEGER
DIM ttyCharW AS INTEGER
DIM ttyCols AS INTEGER
DIM ttyRows AS INTEGER
DIM ttyTop AS INTEGER
DIM ttyLeft AS INTEGER
DIM ttyBarTop AS INTEGER
DIM ttyR AS INTEGER
DIM ttyC AS INTEGER
DIM ttyBarOn AS INTEGER
DIM ttyM AS INTEGER
DIM ttyA AS INTEGER
DIM ttyB AS INTEGER
DIM ttyK AS INTEGER
DIM ttyVal AS INTEGER
DIM ttyLo AS INTEGER
DIM ttyHi AS INTEGER
DIM ttyI AS INTEGER
DIM ttyBg AS INTEGER
DIM ttyFg AS INTEGER
DIM ttyDim AS INTEGER
DIM ttyAccent AS INTEGER
DIM ttyBarBg AS INTEGER
DIM ttyNum AS STRING
DIM ttyPrompt AS STRING

SUB ttyOpen(title AS STRING, rot AS INTEGER, pad AS INTEGER, font AS INTEGER)
    DIM r AS INTEGER
    ' 开局查一次系统语言,之后按它取文案(`ui_scr_get_language` 是 syscall,别每次绘制都调)

    ' Query the system language once at startup, then pick the strings by it (`ui_scr_get_language` is a syscall, do not call it on every paint)

    LANG = ui_scr_get_language()
    IF LANG = 0 THEN sOk = "确定" ELSE sOk = "OK"
    ttyFont = font
    ttyBg = &HFF101018
    ttyFg = &HFFD8D8E0
    ttyDim = &HFF8888A0
    ttyAccent = &HFF7CC4FF
    ttyBarBg = &HFF1C1C28
    ttyCharW = ttyFont / 2
    r = ui_win_open_ex(title, 0, 0, rot, pad)
    ui_scr_set_keep_on(1)
    ttyW = ui_scr_get_w()
    ttyH = ui_scr_get_h()
    ttyLH = ttyFont + 8
    ttyCols = ttyW / ttyCharW
    IF ttyCols > 88 THEN
        ttyCols = 88
    END IF
    ttyBarTop = ttyH - 150
    ttyRows = (ttyBarTop - 12) / ttyLH
    IF ttyRows > 40 THEN
        ttyRows = 40
    END IF
    IF ttyRows < 6 THEN
        ttyRows = 6
    END IF
    ttyTop = 10
    ttyLeft = 10
    ttyBarOn = 0
    ttyCls
END SUB

SUB ttyShow()
    ui_2d_present
END SUB

SUB ttyCls()
    ui_2d_clear(ttyBg)
    ttyR = 0
    ttyC = 0
    ttyBarOn = 0
    ui_2d_present
END SUB

' 擦掉提示条(回到"只有正文"的画面)

' Erase the prompt bar (back to a "body text only" picture)

SUB ttyBarClear()
    IF ttyBarOn = 0 THEN
        EXIT SUB
    END IF
    ui_2d_rect(0, ttyBarTop - 6, ttyW, ttyH - ttyBarTop + 6, ttyBg, 1, 0, 0)
    ttyBarOn = 0
END SUB

' 行号推进;超屏就清屏重来(不缓冲 ⇒ 没有回滚历史,见头部说明)

' Advance the line number; past the last row it clears and starts over (no buffering ⇒ no scrollback history, see the header)

SUB ttyNl()
    ttyR = ttyR + 1
    ttyC = 0
    IF ttyR >= ttyRows THEN
        ttyCls
    END IF
END SUB

SUB ttyScrollCheck()
    IF ttyR >= ttyRows THEN
        ttyCls
    END IF
END SUB

' 在当前行追加一段(不换行)

' Append a run to the current line (no line break)

SUB ttyPn(s AS STRING)
    DIM x AS INTEGER
    IF LEN(s) = 0 THEN
        EXIT SUB
    END IF
    ttyBarClear
    ttyScrollCheck
    x = ttyLeft + ttyC * ttyCharW
    ui_2d_text(x, ttyTop + ttyR * ttyLH, s, ttyFg, ttyFont, VML_ANCHOR_LEFT)
    ttyC = ttyC + LEN(s)
    IF ttyC >= ttyCols THEN
        ttyNl
    END IF
    ui_2d_present
END SUB

' 打一整行(老 BASIC 的 `PRINT "..."` 对应这个)

' Print a whole line (this is the old BASIC `PRINT "..."`)

SUB ttyP(s AS STRING)
    ttyPn(s)
    ttyNl
END SUB

' 居中打一行 —— 老 BASIC 的 `TAB(n)` 在等宽 80 列下就是"居中",

' Print one line centered -- an old BASIC `TAB(n)` under 80 monospaced columns just means "centered",

' 而 `TAB` 在本平台**编译期就没有实现**:`PRINT TAB(10); "B"` 报「未定义的函数 'func_tab'」

' while `TAB` **has no implementation at all at compile time** on this platform: `PRINT TAB(10); "B"` reports 「undefined function 'func_tab'」

' (2026-10-04 实测。⚠ 从前这里写的是"静默失效的空实现、不移动光标",与实测**不符**)。

' (measured 2026-10-04. ⚠ This used to say "a silent no-op stub that does not move the cursor", which the measurement does **not** support.)

' ⇒ **别依赖 `TAB`**;转换层按 `scripts/basic-port.py` 的 `conv_print` 那样把它**改写掉**。

' => **Do not rely on `TAB`**; the conversion layer **rewrites it away** the way `conv_print` in `scripts/basic-port.py` does.

' ⚠ 本 SUB 的**形状**是对着 `ttyPn` 抄的,不是随便写的:

' ⚠ The **shape** of this SUB is copied from `ttyPn` on purpose, not written at random:

'   · 开头有 `IF LEN(s) = 0 THEN EXIT SUB` 早退(与 ttyPn 一致)

'   · it early-returns with `IF LEN(s) = 0 THEN EXIT SUB` at the top (same as ttyPn)

'   · 先算进**局部变量 x**,再拿 x 去调 `ui_2d_text`(不把表达式直接当实参)

'   · it computes into the **local variable x** first and then passes x to `ui_2d_text` (no expression as a direct argument)

' 实测(2026-09-21):缺这两条的写法**编译全绿、函数确实被调用(插 PRINT 探针能打出来)、

' Measured (2026-09-21): a version missing these two points **compiles all green and the function really is called (a PRINT probe prints),

' 但整屏一个字都不显示**,而且**连它之后的 ttyP 也一起不显示**。

' yet not one character appears on screen**, and **even the ttyP calls after it stop showing**.

' 逐条排除过:EXIT SUB 在多行 IF 里 ✅、局部变量与形参同名 ✅、`#include` ✅、

' Ruled out one by one: EXIT SUB inside a multi-line IF ✅, a local variable sharing the parameter's name ✅, `#include` ✅,

' 实参传表达式 ✅(顶层与 SUB 内都测过)、`LEN(参数)` ✅、ttyRows/ttyR 数值全对 ✅。

' passing an expression as the argument ✅ (tested at top level and inside a SUB), `LEN(parameter)` ✅, ttyRows/ttyR values all correct ✅.

' 改成同形之后正常。**机制没查清** —— 所以这条按"已知可用的写法"钉住,别再改回去。

' It works once the shape matches. **The mechanism was never pinned down** -- so this is held as "the known-good shape", do not change it back.

SUB ttyPc(s AS STRING)
    DIM x AS INTEGER
    DIM ind AS INTEGER
    IF LEN(s) = 0 THEN
        EXIT SUB
    END IF
    ttyBarClear
    ttyScrollCheck
    ind = (ttyCols - LEN(s)) / 2
    IF ind < 0 THEN
        ind = 0
    END IF
    x = ttyLeft + ind * ttyCharW
    ui_2d_text(x, ttyTop + ttyR * ttyLH, s, ttyFg, ttyFont, VML_ANCHOR_LEFT)
    ttyNl
    ui_2d_present
END SUB

' ── 输入:数字步进条 ──────────────────────────────────────────────────

' ── Input: numeric stepper bar ──────────────────────────────────────────────────

' 老游戏的 `INPUT X` 在这里变成「− / + 调数 + 确定」。

' The old game's `INPUT X` becomes "− / + to change the number + confirm" here.

' 注意**不调 ui_2d_clear** —— 正文要留在屏上,只重画底部那一条。

' Note it does **not call ui_2d_clear** -- the body text must stay on screen, only the bottom bar is repainted.

FUNCTION ttyAsk(prompt AS STRING, lo AS INTEGER, hi AS INTEGER) AS INTEGER
    DIM bw AS INTEGER
    DIM bh AS INTEGER
    DIM bx1 AS INTEGER
    DIM bx2 AS INTEGER
    DIM bx3 AS INTEGER
    DIM by AS INTEGER
    DIM quit AS INTEGER
    DIM lab AS STRING
    ttyVal = lo
    ttyLo = lo
    ttyHi = hi
    ttyPrompt = prompt
    bw = 104
    bh = 72
    by = ttyH - 96
    bx1 = 16
    bx3 = ttyW - 16 - bw
    bx2 = (ttyW - 140) / 2
    quit = 0
    WHILE quit = 0
        ui_sfx_tick
        lab = STR$(ttyVal)
        ui_2d_rect(0, ttyBarTop - 6, ttyW, ttyH - ttyBarTop + 6, ttyBarBg, 1, 0, 0)
        ui_2d_text(ttyW / 2, ttyBarTop + 4, ttyPrompt, ttyFg, ttyFont, VML_ANCHOR_CENTER)
        ui_2d_text(ttyW / 2, ttyBarTop + 34, lab, ttyAccent, ttyFont + 12, VML_ANCHOR_CENTER)
        ui_2d_rect(bx1, by, bw, bh, &HFF303048, 1, 0, 10)
        ui_2d_text(bx1 + bw / 2, by + 22, "-", &HFFFFFFFF, ttyFont + 10, VML_ANCHOR_CENTER)
        ui_2d_rect(bx2, by, 140, bh, &HFF2A6E3A, 1, 0, 10)
        ui_2d_text(bx2 + 70, by + 22, sOk, &HFFFFFFFF, ttyFont, VML_ANCHOR_CENTER)
        ui_2d_rect(bx3, by, bw, bh, &HFF303048, 1, 0, 10)
        ui_2d_text(bx3 + bw / 2, by + 22, "+", &HFFFFFFFF, ttyFont + 10, VML_ANCHOR_CENTER)
        ttyBarOn = 1
        ui_2d_present
        ttyM = ui_msg_fetch_wait(0)
        IF ttyM = 10 THEN
            ui_win_close
            quit = 1
        ELSEIF ttyM = 6 THEN
            ttyA = ui_msg_get_a()
            ttyB = ui_msg_get_b()
            IF ttyB >= by THEN
                IF ttyB <= by + bh THEN
                    IF ttyA >= bx1 THEN
                        IF ttyA <= bx1 + bw THEN
                            ttyVal = ttyVal - 1
                            IF ttyVal < ttyLo THEN
                                ttyVal = ttyLo
                            END IF
                            ui_sfx_add 0, 67, 0, 1, 40, 3   ' 减

                            ' decrement

                        END IF
                    END IF
                    IF ttyA >= bx3 THEN
                        IF ttyA <= bx3 + bw THEN
                            ttyVal = ttyVal + 1
                            IF ttyVal > ttyHi THEN
                                ttyVal = ttyHi
                            END IF
                            ui_sfx_add 0, 72, 0, 1, 40, 3   ' 加

                            ' increment

                        END IF
                    END IF
                    IF ttyA >= bx2 THEN
                        IF ttyA <= bx2 + 140 THEN
                            quit = 1
                            ui_sfx_add 1, 84, 0, 2, 65, 1   ' 确定

                            ' confirm

                        END IF
                    END IF
                END IF
            END IF
        ELSEIF ttyM = 1 THEN
            ttyK = ui_msg_get_a()
            IF ttyK = 37 THEN
                ttyVal = ttyVal - 1
                IF ttyVal < ttyLo THEN
                    ttyVal = ttyLo
                END IF
            ELSEIF ttyK = 39 THEN
                ttyVal = ttyVal + 1
                IF ttyVal > ttyHi THEN
                    ttyVal = ttyHi
                END IF
            ELSEIF ttyK = 13 THEN
                quit = 1
            ELSEIF ttyK = 65 THEN
                quit = 1
            END IF
        END IF
    WEND
    ttyBarClear
    ttyAsk = ttyVal
    ttyPn("> ")
    lab = STR$(ttyVal)
    ttyP(lab)
END FUNCTION

' ── 输入:等一个键 / 一次点击(老程序的「按任意键继续」)──────────────

' ── Input: wait for one key / one tap (the old programs' "press any key to continue")──────────────

FUNCTION ttyKey() AS INTEGER
    DIM got AS INTEGER
    got = 0
    ttyKey = 0
    WHILE got = 0
        ui_sfx_tick
        ttyM = ui_msg_fetch_wait(0)
        IF ttyM = 10 THEN
            ui_win_close
            got = 1
        ELSEIF ttyM = 1 THEN
            ttyKey = ui_msg_get_a()
            got = 1
        ELSEIF ttyM = 6 THEN
            ttyKey = 32
            got = 1
        END IF
    WEND
END FUNCTION

SUB ttyWait()
    ttyI = ttyKey()
END SUB

ttyOpen("HURKLE", 0, 0, 20)

10 ttyPc("HURKLE")
20 ttyPc("CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY")
30 ttyP("")
ttyP("")
ttyP("")
110 N=5
120 G=10
210 ttyP("")
220 ttyP("A HURKLE IS HIDING ON A" + " " + STR$(G) + " " + "BY" + " " + STR$(G) + " " + "GRID. HOMEBASE")
230 ttyP("ON THE GRID IS POINT 0,0 IN THE SOUTHWEST CORNER,")
235 ttyP("AND ANY POINT ON THE GRID IS DESIGNATED BY A")
240 ttyP("PAIR OF WHOLE NUMBERS SEPERATED BY A COMMA. THE FIRST")
245 ttyP("NUMBER IS THE HORIZONTAL POSITION AND THE SECOND NUMBER")
246 ttyP("IS THE VERTICAL POSITION. YOU MUST TRY TO")
250 ttyP("GUESS THE HURKLE'S GRIDPOINT. YOU GET" + " " + STR$(N) + " " + "TRIES.")
260 ttyP("AFTER EACH TRY, I WILL TELL YOU THE APPROXIMATE")
270 ttyP("DIRECTION TO GO TO LOOK FOR THE HURKLE.")
280 ttyP("")
285 A=ui_math_rand(G)
286 B=ui_math_rand(G)
310 FOR K=1 TO N
320 ttyPn("GUESS #" + " " + STR$(K) + " ")
330 X = ttyAsk("X=", 0, 9)
IF ui_win_is_closed() <> 0 THEN GOTO 99998
Y = ttyAsk("Y=", 0, 9)
IF ui_win_is_closed() <> 0 THEN GOTO 99998
340 IF ABS(X-A)+ABS(Y-B)=0 THEN
    GOTO 500
END IF
350 REM PRINT INFO
360 GOSUB 610
370 ttyP("")
380 NEXT K
410 ttyP("")
420 ttyP("SORRY, THAT'S" + " " + STR$(N) + " " + "GUESSES.")
430 ttyP("THE HURKLE IS AT " + " " + STR$(A) + " " + "," + " " + STR$(B) + " ")
440 ttyP("")
450 ttyP("LET'S PLAY AGAIN, HURKLE IS HIDING.")
460 ttyP("")
470 GOTO 285
500 REM
510 ttyP("")
520 ttyP("YOU FOUND HIM IN" + " " + STR$(K) + " " + "GUESSES!")
540 GOTO 440
610 ttyPn("GO ")
620 IF Y=B THEN
    GOTO 670
END IF
630 IF Y<B THEN
    GOTO 660
END IF
640 ttyPn("SOUTH")
650 GOTO 670
660 ttyPn("NORTH")
670 IF X=A THEN
    GOTO 720
END IF
680 IF X<A THEN
    GOTO 710
END IF
690 ttyPn("WEST")
700 GOTO 720
710 ttyPn("EAST")
720 ttyP("")
730 RETURN
999 ui_sfx_panic
999 END

99998 END