aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2018-12-11 11:09:11 +1200
committerDevine Lu Linvega <[email protected]>2018-12-11 11:09:11 +1200
commit31b23ff85c6fa8567c2177d1c894e96b2e9156aa (patch)
treeb98e51ceb2b0382806cbb0204a116d9cefce5716
parent82dd83d04439038e7a05d09ce0d74709154978b7 (diff)
downloadOrca-31b23ff85c6fa8567c2177d1c894e96b2e9156aa.tar.gz
Orca-31b23ff85c6fa8567c2177d1c894e96b2e9156aa.zip
Improved G operator, added design notes
-rw-r--r--DESIGN.md49
-rw-r--r--README.md2
-rw-r--r--desktop/core/library/g.js36
-rw-r--r--desktop/core/library/p.js5
-rw-r--r--desktop/core/library/q.js7
-rw-r--r--desktop/core/library/x.js3
-rw-r--r--examples/read+write.orca12
7 files changed, 97 insertions, 17 deletions
diff --git a/DESIGN.md b/DESIGN.md
new file mode 100644
index 0000000..21013f6
--- /dev/null
+++ b/DESIGN.md
@@ -0,0 +1,49 @@
+# Design
+
+| Families | Glyphs
+| ---------- | -----------
+| Directions | N S E W Z
+| Math | A I M R
+| Converters | B F
+| Timers | C D
+| Writers | X G P
+| Readers | O Q T
+| Jumpers | J Y
+| ---------- | -----------
+| Misc | H K L U V
+| Special | * ; : ! #
+
+# Attributes
+
+| Glyph | Rating | Force Passive | Outputs
+| ----- | ------ | ------------- | -------
+| A* | +++++ | | Any
+| B | +++ | | *
+| C* | +++++ | | Any
+| D* | +++++ | | *
+| E* | +++++ | |
+| F | ? | | ?
+| G | ++++ | X | Any(multi)(unlocked)
+| H* | +++++ | | Any
+| I* | +++++ | | Any
+| J* | +++ | | Any
+| K* | ++ | |
+| L | ++ | |
+| M* | +++++ | | Any
+| N* | +++++ | |
+| O* | ++++ | | Any
+| P* | ++++ | X | Any(unlocked)
+| Q* | ++++ | | Any(multi)
+| R* | +++++ | | Any
+| S* | +++++ | |
+| T* | ++++ | | Any
+| U* | +++++ | |
+| V | ? | | ?
+| W* | +++++ | |
+| X* | ++++ | X | Any(unlocked)
+| Y* | +++ | | Any
+| Z | + | |
+| : | +++++ | X |
+| ; | +++++ | X |
+
+* Stable Glyphs \ No newline at end of file
diff --git a/README.md b/README.md
index c12ac83..d330e8d 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ You can follow the [guide](GUIDE.md) to get started and play your first sounds.
- `D` **delay**('rate, offset): Bangs on a fraction of the runtime frame.
- `E` **east**: Moves eastward, or bangs.
- `F` **if**(a, b): Outputs `1` if inputs are equal, otherwise `0`.
-- `G` **generator**(val): Outputs the input southward.
+- `G` **generator**('x, 'y, 'len): Writes distant operators with offset.
- `H` **halt**('len): Stops southward operators from operating.
- `I` **increment**(min, max): Increments southward operator.
- `J` **jumper**(val): Outputs the northward operator.
diff --git a/desktop/core/library/g.js b/desktop/core/library/g.js
index 5ba47c8..0eb656a 100644
--- a/desktop/core/library/g.js
+++ b/desktop/core/library/g.js
@@ -3,18 +3,44 @@
const Operator = require('../operator')
function OperatorG (orca, x, y, passive) {
- Operator.call(this, orca, x, y, 'g', passive)
+ Operator.call(this, orca, x, y, 'g', true)
this.name = 'generator'
- this.info = 'Outputs the input southward.'
+ this.info = 'Writes distant operators with offset.'
- this.ports.input.val = { x: 1, y: 0 }
+ 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.output = { x: 0, y: 1, unlock: true }
+ this.haste = function () {
+ this.ports.input = []
+ this.len = clamp(this.listen(this.ports.haste.len, true), 1, 16)
+ const x = clamp(this.listen(this.ports.haste.x, true), 0, 24)
+ const y = clamp(this.listen(this.ports.haste.y, true) + 1, 1, 24)
+ for (let i = 0; i < this.len; i++) {
+ this.ports.input.push({ x: i + 1, y: 0 })
+ }
+ this.ports.output = { x: x, y: y, unlock: true }
+ }
+
this.run = function () {
- const res = this.listen(this.ports.input.val)
- this.output(`${res}`)
+ if (!this.bang() && !passive) { return }
+
+ this.draw = false
+
+ // Read
+ let str = ''
+ for (const id in this.ports.input) {
+ str += this.listen(this.ports.input[id])
+ }
+ // Write
+ for (let i = 0; i < str.length; i++) {
+ orca.write(this.x + this.ports.output.x + i, this.y + this.ports.output.y, str[i])
+ }
}
+
+ function clamp (v, min, max) { return v < min ? min : v > max ? max : v }
}
module.exports = OperatorG
diff --git a/desktop/core/library/p.js b/desktop/core/library/p.js
index c7760a2..4491c2e 100644
--- a/desktop/core/library/p.js
+++ b/desktop/core/library/p.js
@@ -11,7 +11,7 @@ function OperatorP (orca, x, y, passive) {
this.ports.haste.len = { x: -1, y: 0 }
this.ports.haste.key = { x: -2, y: 0 }
this.ports.input.val = { x: 1, y: 0 }
- this.ports.output = { x: 0, y: 1 }
+ this.ports.output = { x: 0, y: 1m unlock: true }
this.haste = function () {
this.len = clamp(this.listen(this.ports.haste.len, true), 1, 24)
@@ -24,6 +24,9 @@ function OperatorP (orca, x, y, passive) {
this.run = function () {
if (!this.bang() && !passive) { return }
+
+ this.draw = false
+
const res = this.listen(this.ports.input.val)
this.output(`${res}`)
}
diff --git a/desktop/core/library/q.js b/desktop/core/library/q.js
index 95265fd..bb99e01 100644
--- a/desktop/core/library/q.js
+++ b/desktop/core/library/q.js
@@ -7,7 +7,6 @@ function OperatorQ (orca, x, y, passive) {
this.name = 'query'
this.info = 'Reads distant operators with offset.'
- this.draw = false
this.ports.haste.x = { x: -3, y: 0 }
this.ports.haste.y = { x: -2, y: 0 }
@@ -17,10 +16,10 @@ function OperatorQ (orca, x, y, passive) {
this.haste = function () {
this.ports.input = []
this.len = clamp(this.listen(this.ports.haste.len, true), 1, 16)
- const _x = this.listen(this.ports.haste.x, true)
- const _y = this.listen(this.ports.haste.y, true)
+ const x = this.listen(this.ports.haste.x, true)
+ const y = this.listen(this.ports.haste.y, true)
for (let i = 1; i <= this.len; i++) {
- this.ports.input.push({ x: i + _x, y: _y })
+ this.ports.input.push({ x: i + x, y: y })
orca.lock(this.x + this.ports.output.x + i - this.len, this.y + 1)
}
}
diff --git a/desktop/core/library/x.js b/desktop/core/library/x.js
index f2ffcd9..79ef080 100644
--- a/desktop/core/library/x.js
+++ b/desktop/core/library/x.js
@@ -21,6 +21,9 @@ function OperatorX (orca, x, y, passive) {
this.run = function () {
if (!this.bang() && !passive) { return }
+
+ this.draw = false
+
const res = this.listen(this.ports.input.val)
this.output(`${res}`)
}
diff --git a/examples/read+write.orca b/examples/read+write.orca
index 72e1d6e..ff1fe0b 100644
--- a/examples/read+write.orca
+++ b/examples/read+write.orca
@@ -1,13 +1,13 @@
.........................................
.#.READ.WRITE.#..........................
.........................................
-.........C4..........C4..................
-.........30O1230.....34T1230.............
-...........0...........0.................
+...C4.........C2..........C4.............
+...20O1230...204Q.#1234#..24T1230........
+.....2.......5678.#5678#....2............
.........................................
.........................................
-.........C4.C4.......C4.C4...............
-.........30X3........34P7................
-.........................................
+...C4.C4......C2..........C4.C4..........
+...20X2......004G1234.....24P2...........
+.....1230...................1230.........
.........................................
......................................... \ No newline at end of file