# befunge

> Befunge-93 interpreter

Latest version **0.0.6** (published 2018-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install befunge
pnpm add befunge
yarn add befunge
bun add befunge
```

Provides the command `befunge`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2018-02-20 |
| First published | 2018-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 260.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ivan Greene |
| Maintainers | ivan.sh |
| Keywords | befunge, befunge-93, esoteric, interpreter |

## Links

- npm: https://www.npmjs.com/package/befunge
- Repository: https://github.com/ivangreene/befunge
- Homepage: https://github.com/ivangreene/befunge#readme
- Issues: https://github.com/ivangreene/befunge/issues
- npm.io page: https://npm.io/package/befunge

## Dependencies (1)

- [split](https://npm.io/package/split.md) ^1.0.1

## Recent versions

- 0.0.6 (latest) — 2018-02-20
- 0.0.5 — 2018-02-20
- 0.0.4 — 2018-02-20
- 0.0.3 — 2018-02-20
- 0.0.2 — 2018-02-16

## README

# befunge - Befunge-93 Interpreter in JS

This package is available from the npm registry:
```bash
npm install befunge
# or
yarn add befunge
```

## Usage

### `new Befunge(readStream, writeStream[, opts])`

```js
const Befunge = require('befunge');

let bef = new Befunge(process.stdin, process.stdout, { wsNoDestroy: true );
```

Options:
- `parsed`, `Function(Code)`: pass the parsed source code as an argument to
  this function whenever it is modified

- `position`, `Function(x, y)`: pass the xy coordinates of the program cursor
  to this function whenever it moves

- `stack`, `Function(Stack)`: pass the stack, as an Array, to this function
  whenever it is modified

- `step`, `Function(next)`: will call this function at each step of the
  program. Resume by calling `next()`. Useful to set a timeout. Omit this
  option for continuous run.

- `read`, `Function('int' || 'char')`: call this function when needing to read
  an int or char from the input stream, with a string describing the type

- `done`, `Function`: call this function when we encounter `@` in the program

- `wsNoDestroy`, `Boolean`: don't call `.destroy()` on the write stream (useful
  for stdin which will throw an error if we try to close it)

- `rsNoDestroy`, `Boolean`: don't call `.end()` on the read stream

### `Befunge.load(program)`: parse and load a Befunge program into memory

```js
bef.load('25*"!olleH",,,,,,,@');
```

### `Befunge.run()`: run the loaded program

### `Befunge.reset()`: return everything to a beginning state; will reparse from the last loaded program code, empty stack, move cursor to (0, 0), etc.

---
_Source: https://npm.io/package/befunge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
