diff options
author | Devine Lu Linvega <[email protected]> | 2019-03-15 16:33:08 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-03-15 16:33:08 +0900 |
commit | 95dc8f1ed979cedffb1d3011e68bfdbe03acc504 (patch) | |
tree | 3a7a474ab8a677244b19e325b700f4353171b601 | |
parent | ff3d5489a6bd33fe491b40d4a79007c8df332a77 (diff) | |
download | Orca-95dc8f1ed979cedffb1d3011e68bfdbe03acc504.tar.gz Orca-95dc8f1ed979cedffb1d3011e68bfdbe03acc504.zip |
Fixes #51
-rw-r--r-- | desktop/core/library/g.js | 6 | ||||
-rw-r--r-- | desktop/core/library/o.js | 7 | ||||
-rw-r--r-- | desktop/core/library/q.js | 10 | ||||
-rw-r--r-- | desktop/sources/scripts/terminal.js | 2 | ||||
-rw-r--r-- | examples/read+write.orca | 22 |
5 files changed, 26 insertions, 21 deletions
diff --git a/desktop/core/library/g.js b/desktop/core/library/g.js index 4e1f73a..4ecde87 100644 --- a/desktop/core/library/g.js +++ b/desktop/core/library/g.js @@ -18,9 +18,13 @@ function OperatorG (orca, x, y, passive) { const y = this.listen(this.ports.haste.y, true) + 1 for (let i = 0; i < len; i++) { - const res = this.listen({ x: i + 1, y: 0 }) + const port = { x: i + 1, y: 0, unlock: true } + this.ports.input[`val${i}`] = port + + const res = this.listen(port) this.ports.output = { x: x + i, y: y, unlock: true } this.output(`${res}`, true) + this.ports.output.x -= 1 } } } diff --git a/desktop/core/library/o.js b/desktop/core/library/o.js index 9cde14d..66a1942 100644 --- a/desktop/core/library/o.js +++ b/desktop/core/library/o.js @@ -14,11 +14,10 @@ function OperatorO (orca, x, y, passive) { this.ports.output = { x: 0, y: 1 } this.run = function () { - const x = this.listen(this.ports.haste.x, true) + 1 + const x = this.listen(this.ports.haste.x, true) const y = this.listen(this.ports.haste.y, true) - - this.ports.input.val = { x: x, y: y } - + this.ports.input.val = { x: x + 1, y: y } + orca.lock(this.x + this.ports.input.val.x, this.y + this.ports.input.val.y) const res = this.listen(this.ports.input.val) this.output(`${res}`, true) } diff --git a/desktop/core/library/q.js b/desktop/core/library/q.js index d488965..f73ec77 100644 --- a/desktop/core/library/q.js +++ b/desktop/core/library/q.js @@ -11,8 +11,6 @@ function OperatorQ (orca, x, y, passive) { this.ports.haste.x = { x: -3, y: 0 } this.ports.haste.y = { x: -2, y: 0 } this.ports.haste.len = { x: -1, y: 0 } - this.ports.input.val = { x: 1, y: 0 } - this.ports.output = { x: 0, y: 1 } this.run = function () { const len = this.listen(this.ports.haste.len, true, 1) @@ -20,10 +18,14 @@ function OperatorQ (orca, x, y, passive) { const y = this.listen(this.ports.haste.y, true) for (let i = 1; i <= len; i++) { - this.ports.input.val = { x: x + i, y: y, unlock: true } - const res = this.listen(this.ports.input.val) + const port = { x: x + i, y: 0, unlock: true } + this.ports.input[`val${i}`] = port + orca.lock(this.x + port.x, this.y + port.y) + const res = this.listen(this.ports.input[`val${i}`]) + this.ports.output = { x: i - len, y: 1, unlock: true } this.output(`${res}`, true) } + this.ports.output = { x: 0, y: 1, unlock: true } } } diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js index bd8464b..e7e9a07 100644 --- a/desktop/sources/scripts/terminal.js +++ b/desktop/sources/scripts/terminal.js @@ -88,7 +88,7 @@ function Terminal () { this.reset = function () { this.theme.reset() } - + this.prevFrame = function () { this.orca.f -= 2 this.stop() diff --git a/examples/read+write.orca b/examples/read+write.orca index b16d746..8dd1374 100644 --- a/examples/read+write.orca +++ b/examples/read+write.orca @@ -1,17 +1,17 @@ +...............................2C4....... +.#.READ.#.......................14T0246.. +................................lV2...... +.C8...........Cg...........Vl............ +.30O01234567..38T01234567..202Q01234567.. +...3............3............23.......... ......................................... -.#.READ.#................................ +.#.WRITE.#.....................Vl........ +...............................2.Vl...... +.C8.C8........Cg.C8........Vl2.JA21...... +.30X3.........38P3.........202G23........ +...01234567.....01234567......01234567... ......................................... -.C8..........C8...........C8............. -.50O01234567.501Q01234567.58T01234567.... -.oV5..........qV5.........tV5............ ......................................... -.#.WRITE.#............................... ......................................... -.C8.C8.......C8..C8.......C8.C8.......... -.50X5........501G5........58P5........... -...01234567.....01234567....01234567..... ......................................... -......................................... -.3Koqt.C8................................ -...555.5................................. .........................................
\ No newline at end of file |