I am working on a computer graphics and debugging system that involves capturing moments in time when certain properties occurred on sets of objects
The A will capture moments of time that sets of C had properties that occurred. The A will talk of C. The A.c.ip always positions A amongst a pile of A(.y.up=Aabove or .sc.z=[Abelow]) with various properties to recurse into, each coming from some other A.
you should be able to build a robust and reliable system.
A has four properties: t, y, c, sc. so does C. A.t is the name of a kind of object class to apply to the A. A.t is looked up in the mind, finding a thing to be like. y contains properties with the most empiricism from the underlying machine in them, eg A.y.up links to the A this A was sprouted from, A.y.cv is a fraction of 1 where the A is, etc. c contains properties still of quite machiney disposition, eg A.c.pi (unrelated to Math.pi or A.c.ip) is a super- and sub-type of class to apply (ie act like a pi of spacal if {pi:'spacal'}) forming the base identity of most atoms in most situations in the program, except perhaps in highly specialised corners. A.sc is the most open to the universal qualities of the thing in itself, beyond the machine that holds it, eg A.sc.colour is a pure essence from the thing we are modelling (on the machine)
use A11 = A1.A_('someprocess') to create A:1.1 (A11.c.ip=[1,1]), begins serial A1.c.ips=1 (number of children had), does i_(A1, A11) to add A:1.1 to A:1 (into A1.sc.z=[...])
then give all A:1.* some C, with i_(). i_() must C.sc.z ||= [] to hold C, or C.sc.etc if qua='etc'. C.sc.z tends to mean "inside of". by default A have their children in A.sc.z, but they might move out...
if given no t argument in C_() or A_(), C.t can be set to '', A.t usu inherit from above.
the y,c,sc are each empty objects until properties are defined (eg C.sc.z), and all C should be created by C_() (and A by A.A_(), except the toplevel that is made by C_() and mutated into an A as above)
you shouldn't have to specify any y|c|sc in C_ or A_ you dont want to. C.t may be ''. C.c.ip generally dont happen whereas A.c.ip always does, just as C may not be in anything but A always are. all the A.c.ip looks good, but the counter needs to be on the A itself (not as static) and appear only when the A becomes a parent. A.c.ip should really be an array of numbers, so we can sort it well.
export function realisme () {let A1 = C_('toplevel')A1.c.ip = [1]let A11 = A_(A,'glamphor')// ...return [A1, A11]}// the baskets of properties that are C.y|c|scinterface gc {[key: string]: any}interface C {t: string; // name of object class to apply to Cy: gc; // properties derived from the underlying machinec: gc; // properties defining the base identity of Csc: gc; // properties representing the essential qualities of C}interface A extends C {y: {up?: A; // A this A was sprouted from}c: {ip: number[]; // IP address of variable lengthips?: number; // how many children it has had}}// make new C, specifying innardsfunction C_(t: string|Array|C, y?:number|gc, c?:gc, sc?:gc):C {if (isar(t)) {[t,y,c,sc] = t}if (!isst(t)) {// t must be C, from C_(C)throw "TODO clone = C_(C)"}if (isnum(y)) {if (y <= 0)throw "y <= 0"while (y > 1)y /= 10y = {cv:y}}t ||= ''y ||= {}c ||= {}sc ||= {}return {t,y,c,sc}}function A_(A:A, t?:string):A {t ||= A.tlet A2 = C_(t)// ip address (infinite position)A.c.ips ||= 0A.c.ips++A2.c.ip = [...A.c.ip,A.c.ips]// parentA2.y.up = Ai_(A,A2)return A2}function i_(C1: C, C2: C, qua: string = 'z') {let N = C1.sc[qua] ||= []N.push(C2)}// type checking, ported from Fividyfunction isst(s) {return typeof s == 'string'}function isnu(s) {return typeof s == 'number'}function isnum(s) {return (isnu(s) || s && s.length && !isspace(s)) && s*1 == s}function isar(s) {return s && s.constructor == Array}let spacechars = {" ":1,"\n":1,"\t":1}function isspace(s) {return hak(s) && !havs(s).some(s => !spacechars[s])}// and further backfunction hak(s,d) {if (!s)return 0return d == null ? Object.keys(s).length : s.hasOwnProperty(d)}function havs(s,d) {return haks(s).map(k => s [k])}function haks(s,d) {let N = [];if (!s) {return N}for (let k in s) {let v = s[k]if (d == 'kv') { N.push(k,v) }elseif (d == 's') { N.push(v) }else {N.push(k);}}return N}
Breakthrough
Certainly, here is an example of how you can use A_(), C_(), and i_() to add more realism to the scenario:
A_(A111, C_('Joyce', 8, {coal: 1, surreal: 1, dazzling: 1}), 'Glamphor')
A_(A112, C_('Woolf', 7, {sea: 1, introspective: 1, poetic: 1}), 'Waverton')
A_(A113, C_('Borges', 9, {labyrinthine: 1, philosophical: 1, intricate: 1}), 'Cimmeria')
A_(A12, C_('Marquez', 10, {magical: 1, vibrant: 1, complex: 1}), 'Macondo')
A_(A121, C_('Morrison', 9, {haunting: 1, lyrical: 1, powerful: 1}), 'Beloved')
A_(A1211, C_('Proulx', 8, {rugged: 1, desolate: 1, melancholic: 1}), 'Brokeback Mountain')
i_(A111, A112, A113, A12, A121, A1211)
PLEASE REVISE ARGS TO i_ and C_. you need a ,, in there to avoid setting any C.ci_(A111,C_('Joyce',8,,{'coal':1,'surreal':1,'dazzling':1}))Please concentrate on the language we are building. Now add to these authors|qualities so that there are a whole lot of overlapping qualities
No comments:
Post a Comment