Nogan is the virtual machine that contains and runs the node-based language behind Arroost.
const nogan = createNogan()
You can make cells in it.
const nogan = createNogan()
const cell = createCell(nogan)
You can fire cells.
const nogan = createNogan()
const cell = createCell(nogan)
fireCell(nogan, {id: cell.id})
You can peak at a cell to check if it's firing.
const nogan = createNogan()
const cell = createCell(nogan)
const before = getPeak(nogan, {id: cell.id})
print(before.result) //false
fireCell(nogan, {id: cell.id})
const after = getPeak(nogan, {id: cell.id})
print(after.result) //true
You can connect cells together with wires.
const nogan = createNogan()
const source = createCell(nogan)
const target = createCell(nogan)
createWire(nogan, {source: source.id, target: target.id})
When a cell fires, it fires what it points to.
const nogan = createNogan()
const source = createCell(nogan)
const target = createCell(nogan)
createWire(nogan, {source: source.id, target: target.id})
fireCell(nogan, {id: source.id})
const peak = getPeak(nogan, {id: target.id})
print(peak.result) //true
As time advances, all fires end.
const nogan = createNogan()
const cell = createCell(nogan)
fireCell(nogan, {id: cell.id})
const before = getPeak(nogan, {id: cell.id})
print(before.result) //true
const {advanced} = getAdvanced(nogan)
const after = getPeak(advanced, {id: cell.id})
print(after.result) //false
You can peak into the future.
const nogan = createNogan()
const cell = createCell(nogan)
fireCell(nogan, {id: cell.id})
const before = getPeak(nogan, {id: cell.id})
print(before.result) //true
const after = getPeak(nogan, {id: cell.id, timing: 1})
print(after.result) //false
Wires can have a delay, so that they fire their target one beat later.
const nogan = createNogan()
const source = createCell(nogan)
const target = createCell(nogan)
createWire(nogan, {source: source.id, target: target.id, timing: 1})
fireCell(nogan, {id: source.id})
const before = getPeak(nogan, {id: target.id})
print(before.result) //false
const after = getPeak(nogan, {id: target.id, timing: 1})
print(after.result) //true
Wires can have a negative delay, so that they fire their target one beat earlier.
const nogan = createNogan()
const source = createCell(nogan)
const middle = createCell(nogan)
const target = createCell(nogan)
createWire(nogan, {source: source.id, target: middle.id, timing: 1})
createWire(nogan, {source: middle.id, target: target.id, timing: -1})
fireCell(nogan, {id: source.id})
const peak = getPeak(nogan, {id: target.id})
print(peak.result) //true