# pipes-lang

> Interpreter for PIPES 2D image programming language

Latest version **1.1.0** (published 2018-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install pipes-lang
pnpm add pipes-lang
yarn add pipes-lang
bun add pipes-lang
```

Provides the command `pipes`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-04-17 |
| First published | 2018-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 18.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | XBagon |
| Maintainers | xbagon |
| Keywords | esoteric, programming, language, image, 2-dimensional |

## Links

- npm: https://www.npmjs.com/package/pipes-lang
- Repository: https://github.com/XBagon/PIPES
- Homepage: https://github.com/XBagon/PIPES#readme
- Issues: https://github.com/XBagon/PIPES/issues
- npm.io page: https://npm.io/package/pipes-lang

## Dependencies (2)

- [pngjs](https://npm.io/package/pngjs.md) ^3.3.2
- [commander](https://npm.io/package/commander.md) ^2.15.1

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-04-17
- 1.0.5 — 2018-04-16
- 1.0.4 — 2018-04-15
- 1.0.3 — 2018-04-15
- 1.0.2 — 2018-04-15
- 1.0.1 — 2018-04-15
- 1.0.0 — 2018-04-15

## README

# PIPES
PIPES is a image-based 2D programming "language". It follows "pipes" and executes operations when reaching pipes with specific colors.
Most operations work on the stack, but you can save and load from memory.

## Features
* Drawing programs
* No more writing programs
* Input characters
* Output numbers and characters
* Basic arithmetic operations
* Comparisons
* Saving and loading to/from memory

## Planned
* Better input processing
* Custom palettes
* Better debugging
* Better editing (custom IDE?)

## Install PIPES:  
```shell
$ npm install pipes-lang -g
```

You can use this [palette file](https://github.com/XBagon/PIPES/blob/master/PATH_PALETTE.txt) for Paint.NET.

# Usage

```shell
  Usage: pipes [options]

  Options:

    -V, --version       output the version number
    -d, --debug         Debug mode
    -s, --strict        Strict mode
    -i, --input [args]  Input arguments
    -p, --stepwise      NOT YET IMPLEMENTED! Stepwise execution
    -h, --help          output usage information
```


## Pipes

**The program will always try to go _straight_, then _right_ and then _left_**.

**Pipes aren't allowed to touch the image borders!**

This is the standard palette, in the future I want to make it easy to use custom palettes.


### Meta Pipes
|Color|Code|Name|Meaning|
|-|-|-|-|
|White|0,0,0|background|is ignored|
|Black|255,255,255|default pipe|guides program|
|Grey|127,127,127|blockade|low priority(only enters if there's no other way)|
|Green|0,255,0|entry|program starts here|
|Red|255,0,0|exit|program stops here|

### Stack Operation Pipes
|Color|Code|Name|Meaning|
|-|-|-|-|
|Blue|0,0,255|push|the only pipe that needs an parameter *afterwards*, pushes the following pixel color number to the stack|
|Yellow|255,255,0|remove|removes the top element from the stack|
|Gray|127,127,127|blockade|low priority(only enters if there's no other way)|
|Spring Green|0,255,144|stack to memory|saves the second element on the stack to the adress provided by the first element, the first element is removed|
|Cyan|0,225,255|memory to stack|pushes the element at the adress provided by the top element on the stack and removes the adress element|
|Malibu|127,127,255|duplicate|duplicates the top element on the stack|
|Electric Violet|178,0,255|swap|swaps the top two elements|

### Arithmetic Pipes
|Color|Code|Name|Meaning|
|-|-|-|-|
|Japanese Laurel|37,127,0|add|removes E1, E2 and pushes E1+E2|
|Pigment Indigo|87,0,124|subtract|removes E1, E2 and pushes E2-E1|
|Cedar Wood Finish|124,24,0|multiply|removes E1, E2 and pushes E1*E2|
|Orient|37,127,0|divide|removes E1, E2 and pushes E2/E1|

### Control Flow Pipes
|Color|Code|Name|Meaning|
|-|-|-|-|
|Pumpkin Skin|168,97,11|compare|compares E2 to E1, and changes direction depending on the result. equal: straight, greater: right, less: left|
|Blue Chalk|248,214,255|teleport absolute|program jumps to position x = E2 y = E1|
|Baja White|255,251,214|teleport relative|program jumps on position x = x+E2 y = y+E1|

### I/O Pipes
|Color|Code|Name|Meaning|
|-|-|-|-|
|School Bus Yellow|255,216,0|input|no effect (yet)|
|Blaze Orange|255,106|output|removes the top element from the stack and prints it|
|Chardonnay|255,206,127|char output|removes the top element from the stack and prints the char with the char code provided|

All the color names are only the names of the nearest named colors.

## Examples

(Please tell me how I can set images to display pixelated, this is awful.)

# Basic I/O

<img src="https://github.com/XBagon/PIPES/blob/master/examples/IO.png?raw=true" width="48">

When you input "r" it will output "right",
when you input "l" it will output "left,
otherwise it will return "-1".

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