Home My Page Projects Code Snippets Project Openings diderot
 Summary Activity Tracker Tasks SCM

# SCM Repository

[diderot] View of /tests/new-tests/steps.pdid
 [diderot] / tests / new-tests / steps.pdid

# View of /tests/new-tests/steps.pdid

Revision 4768 - (download) (annotate)
Mon Oct 17 16:50:57 2016 UTC (2 years, 8 months ago) by glk
File size: 5598 byte(s)
`fixing unclosed comment`
```#version 2 // (v2) NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!! Not a valid Diderot file! !!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!  This will be !!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!! processed by "./go-steps.sh" !!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL

/* Timeline of how this program goes:
| means active
o means "stabilize"
: means stable (idle)
x means "die"
n means "new"
4  3  2  1  0 <--idx
step 0     |  |  |  |
step 1     |  |  |  x
step 2     |  |  |
step 3     |  |  o
step 4     |  |  :
step 5    n4  |  :
step 6  |  |  |  :
step 7  |  x  o  :
step 8  |     :  :
step 9  o     :  :
after  :     :  :
*/

int step = 0;
input bool dosee = true;
input bool flip = false;

strand digit (int idx_) {
int idx = idx_;
vec2 pos = idx*[0.888,-1.333];
output real id = pow(10,idx);
real active = id;
real updated = 0;
real idle = 0;
real initialized = 0; // (v2) NOTv1 NOTvL
real started = 0;     // (v2) NOTv1 NOTvL
initialize {          // (v2) NOTv1 NOTvL
initialized = id;  // (v2) NOTv1 NOTvL
}                     // (v2) NOTv1 NOTvL
start {               // (v2) NOTv1 NOTvL
started = id;      // (v2) NOTv1 NOTvL
}                     // (v2) NOTv1 NOTvL
update {
updated = id;
if (dosee) {
real seen = 0;
real poserr = 0;
foreach (digit d in sphere(100)) {
seen += d.id;
poserr += |d.pos - d.idx*[0.888,-1.333]|;
}
print(step, " Strand ", idx, ":  hello; see ", 800000 + seen, " !!BAD!! pos error !!" if poserr != 0 else "", "\n");
}
if (1 == step) {
if (0 == idx) {
print(step, " Strand ", idx, ": ******** dying\n"); die;
}
}
if (3 == step) {
if (1 == idx) {
print(step, " Strand ", idx, ": ******** stabilizing\n"); idle = id; stabilize;
}
}
if (5 == step) {
if (3 == idx) {
print(step, " Strand ", idx, ": ******** new digit(4)\n");
new digit(4);
}
}
if (7 == step) {
if (2 == idx) {
print(step, " Strand ", idx, ": ******** stabilizing\n"); idle = id; stabilize;
}
if (3 == idx) {
print(step, " Strand ", idx, ": ******** dying\n"); die;
}
}
if (9 == step) {
print(step, " Strand ", idx, ": ******** stabilizing\n"); idle = id; stabilize;
}
}
}

/* // NOTv2 (v1) (vL)
start {
real Dall = 800000 + sum { d.id | d in digit.all };
real Dupdated = 800000 + sum { d.updated | d in digit.all };
real Dactive = 800000 + sum { d.id | d in digit.active };
real Dstable = 800000 + sum { d.id | d in digit.stable };
real Didle = 800000 + sum { d.idle | d in digit.all };
real Dinitialized = 800000 + sum { d.initialized | d in digit.all }; // (v2) NOTv1 NOTvL
real Dstarted = 800000 + sum { d.started | d in digit.all };         // (v2) NOTv1 NOTvL
print("/ global (start): all=", Dall,
"; active=", Dactive,
"; updated=", Dupdated,
"; stable=", Dstable,
"; idle=", Didle,
"; initialized=", Dinitialized,                                // (v2) NOTv1 NOTvL
"; started=", Dstarted,                                        // (v2) NOTv1 NOTvL
"\n");
/* next line is also supported in version1, but want to simplify comparison to Lamont's branch */         // (v2) NOTv1 NOTvL
print ("/ global (start): numActive=", numActive(), ";                   numStable=", numStable(), "\n"); // (v2) NOTv1 NOTvL
}
*/ // NOTv2 (v1) (vL)

global // NOTv2 (v1) (vL)
update // (v2) NOTv1 NOTvL
{
real Dall = 800000 + sum { d.id | d in digit.all };
real Dupdated = 800000 + sum { d.updated | d in digit.all };
real Dactive = 800000 + sum { d.id | d in digit.active };
real Dstable = 800000 + sum { d.id | d in digit.stable };
real Didle = 800000 + sum { d.idle | d in digit.all };
real Dinitialized = 800000 + sum { d.initialized | d in digit.all }; // (v2) NOTv1 NOTvL
real Dstarted = 800000 + sum { d.started | d in digit.all };         // (v2) NOTv1 NOTvL
print(step, " global -------: all=", Dall,
"; active=", Dactive,
"; updated=", Dupdated,
"; stable=", Dstable,
"; idle=", Didle,
"; initialized=", Dinitialized,                                // (v2) NOTv1 NOTvL
"; started=", Dstarted,                                        // (v2) NOTv1 NOTvL
"\n");
print (step, " global ~                  numActive=", numActive(), ";                   numStable=", numStable(), "\n"); // (v2) NOTv1 NOTvL
step += 1;
if (20 == step) {
print("WHOA! stopping\n");
stabilize;
}
}
initially // NOTv2 (v1) (vL)
create_collection // (v2) NOTv1 NOTvL
{ digit(3-i if flip else i) | i in 0..3 }
; // NOTv2 (v1) (vL)
```

 root@smlnj-gforge.cs.uchicago.edu ViewVC Help Powered by ViewVC 1.0.0