RUN {brassica} | R Documentation |
Run BASIC Programs
Description
Loads and runs BASIC programs.
Usage
RUN(program = NULL, ttx = 0, tty = 0, up = FALSE)
Arguments
program |
A character string, containing the name or file path of a BASIC program. Omitting this re-runs the currently-loaded program. |
ttx |
Aesthetic teletype option. A delay, of not more than 200 milliseconds, to be applied after printing each character. In practice, the actual delay will be this time plus however long it takes to flush the console, plus interpreter overheads. Depending on the model, a real teletype could manage around ten characters per second. Making this negative imposes no delay, but flushes the console after each completed line (not after each character). |
tty |
Aesthetic teletype option. A delay, of not more than 2000 milliseconds, to be applied after each line of printing. Making this negative imposes no delay, but still flushes the console after each completed line. |
up |
Aesthetic teletype option.
Making this |
Details
List of bundled example programs (from the references):
Animal | by Arthur Luehrmann | (decision trees) |
Camel | by the Heath Users Group | (random walk) |
Chase | by Mac Oglesby | (robots) |
Eliza | by Jeff Shrager | (language processing) |
Even Wins | by Eric Peters | (machine learning) |
Flip | by John S. James | (machine learning) |
Four in a Row | by James L. Murphy | (artificial intelligence) |
Guess-It | by Gerard Kierman | (bluffing) |
Hammurabi | by David H. Ahl | (resource management) |
Hexapawn | by R. A. Kaapke | (machine learning) |
Inkblot | by Scott Costello | (projection) |
Life | by Clark Baker | (cellular automata) |
Maze | by Richard Schaal | (depth-first search) |
Not One | by Robert Puopolo | (expectation values) |
Sea Battle | by Vincent Erickson | (monsters) |
Super Star Trek | by Richard Leedon | (vector space) |
Wumpus | by Gregory Yob | (graph topology) |
All of these are in the public domain.
Value
Returns an invisible NULL
, after printing to standard output.
Note
Many BASIC programs ask for user input after printing a custom prompt.
When ttx
is greater than zero, some R sessions may incorrectly position
the cursor at the beginning of the line, or on the next.
Neither occurrence is fatal.
Known to be affected: Windows R terminal (‘R’ and ‘Rterm’, but the
‘Rgui’ console is fine), Mac R console (but the Bash terminal is fine),
RStudio.
Additionally, double buffering, or the like, may interfere with the effect at
higher speeds (Mac R console, again).
References
David H. Ahl & Steve North, BASIC Computer Games (1978)
David H. Ahl & Steve North, More BASIC Computer Games (1979)
See Also
Examples
## Not run:
# Load and run 'Wumpus'.
RUN("wumpus")
# Load and run 'Chase', flushing the
# console after every line of output.
RUN("chase", -1)
# Load and run 'Camel', with full
# retro-style teletypewriter effects.
RUN("camel", 20, 300, TRUE)
# Load and run your program.
RUN("myprogram.bas")
# Re-run the last program
# (without re-loading it).
RUN()
## End(Not run)