aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-04-03 11:23:44 +0900
committerDevine Lu Linvega <[email protected]>2019-04-03 11:23:44 +0900
commit98d65c9c57dc533754910cb4e7a5e3f768a7ad9a (patch)
tree40d3bde90d9eeeec4b55bdbc79aa92308f528873
parent06fef3117393c179304fd254f54bb59fd79fd8dc (diff)
downloadOrca-98d65c9c57dc533754910cb4e7a5e3f768a7ad9a.tar.gz
Orca-98d65c9c57dc533754910cb4e7a5e3f768a7ad9a.zip
Fixed issues with Q and G
-rw-r--r--desktop/core/library/b.js4
-rw-r--r--desktop/core/library/g.js9
-rw-r--r--desktop/core/library/j.js4
-rw-r--r--desktop/core/library/p.js1
-rw-r--r--desktop/core/library/q.js11
-rw-r--r--desktop/core/library/t.js1
-rw-r--r--desktop/core/library/y.js4
-rw-r--r--examples/benchmark.orca11
8 files changed, 29 insertions, 16 deletions
diff --git a/desktop/core/library/b.js b/desktop/core/library/b.js
index 5603551..70bc7b2 100644
--- a/desktop/core/library/b.js
+++ b/desktop/core/library/b.js
@@ -8,11 +8,11 @@ function OperatorB (orca, x, y, passive) {
this.name = 'bool'
this.info = 'Bangs if input is not empty, or 0.'
- this.ports.input.val = { x: 1, y: 0, unlock: true }
+ this.ports.haste.val = { x: -1, y: 0 }
this.ports.output = { x: 0, y: 1 }
this.run = function () {
- const val = this.listen(this.ports.input.val)
+ const val = this.listen(this.ports.haste.val)
const res = val !== '.' && val !== '0' ? '*' : '.'
this.output(`${res}`)
}
diff --git a/desktop/core/library/g.js b/desktop/core/library/g.js
index 3d1a9bd..0013ee1 100644
--- a/desktop/core/library/g.js
+++ b/desktop/core/library/g.js
@@ -12,6 +12,13 @@ function OperatorG (orca, x, y, passive) {
this.ports.haste.y = { x: -2, y: 0 }
this.ports.haste.len = { x: -1, y: 0 }
+ 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)
+ }
+ }
+
this.run = function () {
const len = this.listen(this.ports.haste.len, true, 1)
const x = this.listen(this.ports.haste.x, true)
@@ -20,7 +27,7 @@ function OperatorG (orca, x, y, passive) {
for (let i = 0; i < len; i++) {
this.ports.input[`val${i}`] = { x: i + 1, y: 0 }
const res = this.listen(this.ports.input[`val${i}`])
- this.ports.output = { x: x + i, y: y, unlock: true }
+ this.ports.output = { x: x + i, y: y }
this.output(`${res}`, true)
this.ports.output.x -= len - 1
}
diff --git a/desktop/core/library/j.js b/desktop/core/library/j.js
index bb66795..1cea27e 100644
--- a/desktop/core/library/j.js
+++ b/desktop/core/library/j.js
@@ -8,7 +8,7 @@ function OperatorJ (orca, x, y, passive) {
this.name = 'jumper'
this.info = 'Outputs the northward operator.'
- this.ports.input.val = { x: 0, y: -1 }
+ this.ports.haste.val = { x: 0, y: -1 }
this.ports.output = { x: 0, y: 1 }
this.haste = function () {
@@ -16,7 +16,7 @@ function OperatorJ (orca, x, y, passive) {
}
this.run = function () {
- const val = this.listen(this.ports.input.val)
+ const val = this.listen(this.ports.haste.val)
this.output(val)
}
}
diff --git a/desktop/core/library/p.js b/desktop/core/library/p.js
index 58d840c..21befed 100644
--- a/desktop/core/library/p.js
+++ b/desktop/core/library/p.js
@@ -15,7 +15,6 @@ 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 4bf1526..ecb0605 100644
--- a/desktop/core/library/q.js
+++ b/desktop/core/library/q.js
@@ -12,6 +12,15 @@ function OperatorQ (orca, x, y, passive) {
this.ports.haste.y = { x: -2, y: 0 }
this.ports.haste.len = { x: -1, y: 0 }
+ 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)
+ for (let i = 1; i <= len; i++) {
+ orca.lock(this.x + x + i, this.y + y)
+ }
+ }
+
this.run = function () {
const len = this.listen(this.ports.haste.len, true, 1)
const x = this.listen(this.ports.haste.x, true)
@@ -19,9 +28,7 @@ function OperatorQ (orca, x, y, passive) {
for (let i = 1; i <= len; i++) {
this.ports.input[`val${i}`] = { x: x + i, y: y }
- orca.lock(this.x + x + i, this.y + y)
this.ports.output = { x: i - len, y: 1, unlock: true }
-
const res = this.listen(this.ports.input[`val${i}`])
this.output(`${res}`, true)
}
diff --git a/desktop/core/library/t.js b/desktop/core/library/t.js
index 177536c..2bee74c 100644
--- a/desktop/core/library/t.js
+++ b/desktop/core/library/t.js
@@ -15,7 +15,6 @@ 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/desktop/core/library/y.js b/desktop/core/library/y.js
index 1ddac05..7394cea 100644
--- a/desktop/core/library/y.js
+++ b/desktop/core/library/y.js
@@ -8,7 +8,7 @@ function OperatorY (orca, x, y, passive) {
this.name = 'jymper'
this.info = 'Outputs the westward operator.'
- this.ports.input.val = { x: -1, y: 0 }
+ this.ports.haste.val = { x: -1, y: 0 }
this.ports.output = { x: 1, y: 0 }
this.haste = function () {
@@ -16,7 +16,7 @@ function OperatorY (orca, x, y, passive) {
}
this.run = function () {
- const val = this.listen(this.ports.input.val)
+ const val = this.listen(this.ports.haste.val)
this.output(val)
}
}
diff --git a/examples/benchmark.orca b/examples/benchmark.orca
index 40a3a8e..73a20a5 100644
--- a/examples/benchmark.orca
+++ b/examples/benchmark.orca
@@ -1,13 +1,14 @@
.........................................
.#.BENCHMARK.#...........................
.........................................
-.4C4......C4.............................
-..24T012..04T012.........................
-..aV2.....bV0............................
+.5C5........C5...........................
+..15T012C...25T012C......................
+..aV1.......bV2..........................
.........................................
.2Kab..2Kab..2Kab..2Kab..2Kab............
-..A20...F20...I20...M20...R20............
-..2...........1.....0.....1..............
+..A12...F12...I12...M12...R12............
+..3...........1.....1.....1..............
+.........................................
.........................................
.........................................
.........................................