diff options
author | Devine Lu Linvega <[email protected]> | 2018-11-09 13:26:31 +1300 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-11-09 13:26:31 +1300 |
commit | 8abf14068a0e420f95c9ed24b115a4550239ea3b (patch) | |
tree | e48a2fc55147fee410461ca80bb7d0cfa7ef38fc | |
parent | c7c28dcf38564f4fe880b21788a4910a68676b77 (diff) | |
download | Orca-8abf14068a0e420f95c9ed24b115a4550239ea3b.tar.gz Orca-8abf14068a0e420f95c9ed24b115a4550239ea3b.zip |
Implemented Until()
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | desktop/core/lib/u.js | 28 | ||||
-rw-r--r-- | desktop/package.json | 1 | ||||
-rw-r--r-- | desktop/sources/scripts/terminal.js | 20 |
4 files changed, 42 insertions, 13 deletions
@@ -28,7 +28,7 @@ - `R`, **raycast**(transport): Sends a bang to the nearest fn following the direction of the bang. - `S`, **south**(direction): Moves southward, or bangs. - `T`, **trigger**: Bangs southward in the presence of `1`, `N`, `S`, `W`, `E` or `Z` northward. -- `U`, **<missing name>**: Missing docs. +- `U`, **until**(list): Read character at position. - `V`, **<missing name>**: Missing docs. - `W`, **west**(direction): Moves westward, or bangs. - `X`, **split**: Bangs eastward when westward fn is 0, and southward when fn is 1. @@ -49,8 +49,8 @@ ### Functions(By Type) - **maths**: `a` `f` `m` `y`. -- **miscs**: `b` `d` `j` `o` `p` `Q` `t` `u` `v` `x` `z` `.` `*`. -- **lists**: `c` `l`. +- **miscs**: `b` `d` `j` `o` `p` `Q` `t` `v` `x` `z` `.` `*`. +- **lists**: `c` `l` `u`. - **directions**: `e` `n` `s` `w`. - **transports**: `g` `r`. - **stoppers**: `h`. diff --git a/desktop/core/lib/u.js b/desktop/core/lib/u.js index c6e3d91..8878f85 100644 --- a/desktop/core/lib/u.js +++ b/desktop/core/lib/u.js @@ -4,6 +4,34 @@ const FnBase = require('./_base') function FnU (pico, x, y, passive) { FnBase.call(this, pico, x, y, 'u', passive) + + this.type = 'list' + this.name = 'until' + this.info = 'Read character at position.' + this.ports.push({ x: -1, y: 0, input: true }, { x: 0, y: -1, input: true }, { x: 0, y: 1, output: true }) + + if (pico) { + this.lenCh = this.west() + this.len = this.lenCh ? pico.allowed.indexOf(this.lenCh.glyph) : 0 + this.valCh = this.north() + this.val = this.valCh ? pico.allowed.indexOf(this.valCh.glyph) : 0 + if (!this.len || this.len < 1 || this.val < 0) { return } + this.ports.push({ x: (this.val % this.len) + 1, y: 0, output: true }) + } + + this.haste = function () { + pico.lock(this.x - 1, this.y) + pico.lock(this.x, this.y - 1) + pico.lock(this.x, this.y + 1) + for (let x = 1; x <= this.len; x++) { + pico.lock(this.x + x, this.y) + } + } + + this.operation = function () { + if (!this.len || this.len < 1 || this.val < 0) { return } + pico.add(this.x, this.y + 1, pico.glyphAt(this.x + ((this.val) % this.len) + 1, this.y)) + } } module.exports = FnU diff --git a/desktop/package.json b/desktop/package.json index c10677f..60c4138 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -5,6 +5,7 @@ "scripts": { "start": "electron .", "time": "node time.js", + "docs": "node ../docs.js", "clean": "rm -r ~/Desktop/Pico-darwin-x64/ ; rm -r ~/Desktop/Pico-linux-x64/ ; rm -r ~/Desktop/Pico-win32-x64/ ; echo 'cleaned build location'", "build_osx": "electron-packager . Pico --platform=darwin --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.icns ; echo 'Built for OSX'", "build_linux": "electron-packager . Pico --platform=linux --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.ico ; echo 'Built for LINUX'", diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js index 8d95207..a47cc8c 100644 --- a/desktop/sources/scripts/terminal.js +++ b/desktop/sources/scripts/terminal.js @@ -7,7 +7,7 @@ function Terminal (pico) { this.qqq = new QQQ(this) this.cursor = new Cursor(this) this.controller = new Controller() - this.theme = new Theme({ background: '#111111', f_high: '#ffffff', f_med: '#333333', f_low: '#000000', f_inv: '#000000', b_high: '#ffb545', b_med: '#72dec2', b_low: '#444444', b_inv: '#ffffff' }) + this.theme = new Theme({ background: '#111111', f_high: '#ffffff', f_med: '#777777', f_low: '#333333', f_inv: '#000000', b_high: '#ffb545', b_med: '#72dec2', b_low: '#444444', b_inv: '#ffffff' }) this.pico = pico this.el = document.createElement('canvas') @@ -203,24 +203,24 @@ function Terminal (pico) { ctx.fillStyle = this.theme.active.b_inv ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) ctx.fillStyle = this.theme.active.f_inv - } else if (styles.isLocked) { - ctx.fillStyle = this.theme.active.background - ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) - ctx.fillStyle = this.theme.active.f_low } else if (styles.isPort) { - if (styles.isPort === 2) { - ctx.fillStyle = this.theme.active.b_high - ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) - ctx.fillStyle = this.theme.active.f_low - } else if (styles.isPort === 1) { + if (styles.isPort === 1) { ctx.fillStyle = this.theme.active.b_med ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) ctx.fillStyle = this.theme.active.f_med + } else if (styles.isPort === 2) { + ctx.fillStyle = this.theme.active.b_high + ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) + ctx.fillStyle = this.theme.active.f_low } else if (styles.isPort === 3) { ctx.fillStyle = this.theme.active.b_low ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) ctx.fillStyle = this.theme.active.f_high } + } else if (styles.isLocked) { + ctx.fillStyle = this.theme.active.background + ctx.fillRect(x * this.tile.w, (y) * this.tile.h, this.tile.w, this.tile.h) + ctx.fillStyle = this.theme.active.f_med } else { ctx.fillStyle = 'white' } |