aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-03-16 16:06:25 +0900
committerDevine Lu Linvega <[email protected]>2019-03-16 16:06:25 +0900
commitca1f2e5068cd65182afe98222ab932bdaa6ea961 (patch)
treeebf0f851da7df34473848fafeb32319abb47aa06
parent4a34e7366d432c6b430ee7fc3a39e1ed5886e80f (diff)
downloadOrca-ca1f2e5068cd65182afe98222ab932bdaa6ea961.tar.gz
Orca-ca1f2e5068cd65182afe98222ab932bdaa6ea961.zip
Standardized G & Q
-rw-r--r--desktop/core/library/g.js15
-rw-r--r--desktop/core/library/p.js2
-rw-r--r--desktop/core/library/q.js2
-rw-r--r--desktop/core/library/t.js2
-rw-r--r--examples/read+write.orca4
5 files changed, 16 insertions, 9 deletions
diff --git a/desktop/core/library/g.js b/desktop/core/library/g.js
index 4ecde87..06192a5 100644
--- a/desktop/core/library/g.js
+++ b/desktop/core/library/g.js
@@ -12,16 +12,23 @@ function OperatorG (orca, x, y, passive) {
this.ports.haste.y = { x: -2, y: 0 }
this.ports.haste.len = { x: -1, y: 0 }
- this.run = function () {
+ this.haste = function () {
const len = this.listen(this.ports.haste.len, true, 1)
const x = this.listen(this.ports.haste.x, true)
const y = this.listen(this.ports.haste.y, true) + 1
for (let i = 0; i < len; i++) {
- const port = { x: i + 1, y: 0, unlock: true }
- this.ports.input[`val${i}`] = port
+ this.ports.input[`val${i}`] = { x: i + 1, y: 0 }
+ }
+ }
- const res = this.listen(port)
+ this.run = function () {
+ const len = this.listen(this.ports.haste.len, true, 1)
+ const x = this.listen(this.ports.haste.x, true)
+ const y = this.listen(this.ports.haste.y, true) + 1
+
+ for (let i = 0; i < len; i++) {
+ const res = this.listen(this.ports.input[`val${i}`])
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/p.js b/desktop/core/library/p.js
index 2596383..58d840c 100644
--- a/desktop/core/library/p.js
+++ b/desktop/core/library/p.js
@@ -15,7 +15,7 @@ function OperatorP (orca, x, y, passive) {
this.haste = function () {
const len = this.listen(this.ports.haste.len, true, 1)
-
+
for (let x = 0; x < len; x++) {
orca.lock(this.x + x, this.y + 1)
}
diff --git a/desktop/core/library/q.js b/desktop/core/library/q.js
index 86b7b0c..c7d0226 100644
--- a/desktop/core/library/q.js
+++ b/desktop/core/library/q.js
@@ -28,7 +28,7 @@ function OperatorQ (orca, x, y, passive) {
const y = this.listen(this.ports.haste.y, true)
for (let i = 1; i <= len; i++) {
- const res = this.listen({ x: x + i, y: y })
+ const res = this.listen(this.ports.input[`val${i}`])
this.ports.output = { x: i - len, y: 1, unlock: true }
this.output(`${res}`, true)
}
diff --git a/desktop/core/library/t.js b/desktop/core/library/t.js
index f959737..177536c 100644
--- a/desktop/core/library/t.js
+++ b/desktop/core/library/t.js
@@ -15,7 +15,7 @@ function OperatorT (orca, x, y, passive) {
this.haste = function () {
const len = this.listen(this.ports.haste.len, true, 1)
-
+
for (let x = 1; x <= len; x++) {
orca.lock(this.x + x, this.y)
}
diff --git a/examples/read+write.orca b/examples/read+write.orca
index 8dd1374..c5f6778 100644
--- a/examples/read+write.orca
+++ b/examples/read+write.orca
@@ -3,13 +3,13 @@
................................lV2......
.C8...........Cg...........Vl............
.30O01234567..38T01234567..202Q01234567..
-...3............3............23..........
+.........................................
.........................................
.#.WRITE.#.....................Vl........
...............................2.Vl......
.C8.C8........Cg.C8........Vl2.JA21......
.30X3.........38P3.........202G23........
-...01234567.....01234567......01234567...
+.........................................
.........................................
.........................................
.........................................