objects.nv
· 2.1 KiB · Text
Originalformat
Playground
||'@include' (https://gist.casuallyblue.dev/wryl/d3c64c1df98e48cbaff3b3dcdc189e3f/raw/HEAD/map.nv lib/rpn.nv)
|::(/* */)|
|::(/* $x)| :: /*
||::(
/* Now we can add comments to what we are doing. */
/*
.. but maybe not too many?
*/
)
||:fresh ID: 0
|:: next ID :@rpn data: $id|
:fresh ID: $id
|:: next ID? :fresh ID: $id|
:@rpn: ($id 1 +)
|:: {}| :: ({ })
|:: { :fresh ID: $id?|
:self: $id
:: next ID
|:: } :self: $ :parent: $parent :field: $field|
:@map: set
:@map.key: $parent $field
:@map.value: $
|:: } :self: $ :field: $field|
:@map: set
:@map.key: $field
:@map.value: $
|:: } :self: $|
:data: $
|:: ($x = {})| :: ($x = { })
|:: ($x = {) :self: $?|
:: { :parent: $ :field: $x
|:: ($x = {)|
:: { :field: $x
|:: ($x = $y) :self: $?|
:@map: set
:@map.key: $ $x
:@map.value: $y
|:: $x :self: $?|
:@map: set
:@map.key: $ $x
:@map.value:
||::(
world = {
kitchen = {
table
chairs = {
/* Should probably add some way to do lists.. */
[chair 1] [chair 2] [chair 3] [chair 4]
}
players = {
0 = {
name = [Wryl Gardner]
position = {
x = 10
y = 20
}
inventory = {
sword shield gold = { amount = 300 }
}
}
1 = {
name = [A Brave Adventurer]
position = {
x = 100
y = 200
}
inventory = {
[a stick] [some weird bag of herbs]
}
}
}
}
}
[to-do list] = {
[somehow, build some cool string support using this system.]
[write an accessor library, so we can actually traverse these objects.]
[demonstrate their usage/interplay with math expressions, rules, etc.]
}
)
|: comment section :| ##"
(wryl) This was really, really fun to work on. Took very little brain power.
"
| 1 | ||'@include' (https://gist.casuallyblue.dev/wryl/d3c64c1df98e48cbaff3b3dcdc189e3f/raw/HEAD/map.nv lib/rpn.nv) |
| 2 | |
| 3 | |::(/* */)| |
| 4 | |::(/* $x)| :: /* |
| 5 | ||::( |
| 6 | /* Now we can add comments to what we are doing. */ |
| 7 | /* |
| 8 | .. but maybe not too many? |
| 9 | */ |
| 10 | ) |
| 11 | |
| 12 | ||:fresh ID: 0 |
| 13 | |:: next ID :@rpn data: $id| |
| 14 | :fresh ID: $id |
| 15 | |:: next ID? :fresh ID: $id| |
| 16 | :@rpn: ($id 1 +) |
| 17 | |
| 18 | |:: {}| :: ({ }) |
| 19 | |:: { :fresh ID: $id?| |
| 20 | :self: $id |
| 21 | :: next ID |
| 22 | |:: } :self: $ :parent: $parent :field: $field| |
| 23 | :@map: set |
| 24 | :@map.key: $parent $field |
| 25 | :@map.value: $ |
| 26 | |:: } :self: $ :field: $field| |
| 27 | :@map: set |
| 28 | :@map.key: $field |
| 29 | :@map.value: $ |
| 30 | |:: } :self: $| |
| 31 | :data: $ |
| 32 | |
| 33 | |:: ($x = {})| :: ($x = { }) |
| 34 | |:: ($x = {) :self: $?| |
| 35 | :: { :parent: $ :field: $x |
| 36 | |:: ($x = {)| |
| 37 | :: { :field: $x |
| 38 | |:: ($x = $y) :self: $?| |
| 39 | :@map: set |
| 40 | :@map.key: $ $x |
| 41 | :@map.value: $y |
| 42 | |:: $x :self: $?| |
| 43 | :@map: set |
| 44 | :@map.key: $ $x |
| 45 | :@map.value: |
| 46 | |
| 47 | ||::( |
| 48 | world = { |
| 49 | kitchen = { |
| 50 | table |
| 51 | chairs = { |
| 52 | /* Should probably add some way to do lists.. */ |
| 53 | [chair 1] [chair 2] [chair 3] [chair 4] |
| 54 | } |
| 55 | players = { |
| 56 | 0 = { |
| 57 | name = [Wryl Gardner] |
| 58 | position = { |
| 59 | x = 10 |
| 60 | y = 20 |
| 61 | } |
| 62 | inventory = { |
| 63 | sword shield gold = { amount = 300 } |
| 64 | } |
| 65 | } |
| 66 | 1 = { |
| 67 | name = [A Brave Adventurer] |
| 68 | position = { |
| 69 | x = 100 |
| 70 | y = 200 |
| 71 | } |
| 72 | inventory = { |
| 73 | [a stick] [some weird bag of herbs] |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | [to-do list] = { |
| 80 | [somehow, build some cool string support using this system.] |
| 81 | [write an accessor library, so we can actually traverse these objects.] |
| 82 | [demonstrate their usage/interplay with math expressions, rules, etc.] |
| 83 | } |
| 84 | ) |
| 85 | |
| 86 | |: comment section :| ##" |
| 87 | (wryl) This was really, really fun to work on. Took very little brain power. |
| 88 | " |