Learn R Programming

brassica (version 1.0.2)

RUN: Run BASIC Programs

Description

Loads and runs BASIC programs.

Usage

RUN(program = NULL, ttx = 0, tty = 0, up = FALSE)

Value

Returns an invisible NULL, after printing to standard output.

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 TRUE forces all BASIC output to upper case.

Details

List of bundled example programs (from the references):

Animalby Arthur Luehrmann(decision trees)
Camelby the Heath Users Group(random walk)
Chaseby Mac Oglesby(robots)
Elizaby Jeff Shrager(language processing)
Even Winsby Eric Peters(machine learning)
Flipby John S. James(machine learning)
Four in a Rowby James L. Murphy(artificial intelligence)
Guess-Itby Gerard Kierman(bluffing)
Hammurabiby David H. Ahl(resource management)
Hexapawnby R. A. Kaapke(machine learning)
Inkblotby Scott Costello(projection)
Lifeby Clark Baker(cellular automata)
Mazeby Richard Schaal(depth-first search)
Not Oneby Robert Puopolo(expectation values)
Sea Battleby Vincent Erickson(monsters)
Super Star Trekby Richard Leedon(vector space)
Wumpusby Gregory Yob(graph topology)

All of these are in the public domain.

References

  1. David H. Ahl & Steve North, BASIC Computer Games (1978)

  2. David H. Ahl & Steve North, More BASIC Computer Games (1979)

See Also

LIST

Examples

Run this code
if (FALSE) {
# 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()
}

Run the code above in your browser using DataLab