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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4745 - (download) (annotate)
Thu Oct 13 16:50:37 2016 UTC (2 years, 9 months ago) by glk
File size: 3717 byte(s)
for debugging state transition semantics
#version 2 // (v2) NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!! DO NOT EDIT !!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!! DO NOT EDIT !!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!! processed by ./go-steps.sh !!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!! DO NOT EDIT !!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!! DO NOT EDIT !!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                               NOTv2 NOTv1 NOTvL

int step = 0;
input bool dosee = true;

strand digit (int idx_) {
    int idx = idx_;
    vec2 pos = [idx,idx];
    output real id = pow(10,idx);
    real active = id;
    real updated = 0;
    real idle = 0;
    update {
        updated = id;
        if (dosee) { real seen = 0; foreach (digit d in sphere(10)) { seen += d.id; } print("   idx ", idx, " (step ", step, "): hello; see ", 800000 + seen, "\n"); }
        if (0 == step) {
	}
        if (1 == step) {
            if (0 == idx) {
               print("   -- idx ", idx, " (step ", step, "): bye\n"); die;
            }
	}
        if (2 == step) {
        }
        if (3 == step) {
            if (1 == idx) {
               print("   -- idx ", idx, " (step ", step, "): stabilizing\n"); idle = id; stabilize;
            }
        }
        if (4 == step) {
        }
	if (5 == step) {
            if (3 == idx) {
               print("   -- idx ", idx, " (step ", step, "): new digit(4)\n");
               new digit(4);
            }
        }
	if (6 == step) {
        }
	if (7 == step) {
            if (2 == idx) {
               print("   -- idx ", idx, ": stabilizing\n"); idle = id; stabilize;
            }
            if (3 == idx) {
               print("   -- idx ", idx, " (step ", step, "): bye\n"); die;
            }
        }
	if (8 == step) {
        }
	if (9 == step) {
            print("   -- idx ", idx, " (step ", step, "): stabilizing\n"); idle = id; stabilize;
        }
    }
}

/* // NOTv2 (v1) (vL)
start {
    real Dall = 800000 + sum { d.id | d in digit.all };
    real Dupd = 800000 + sum { d.updated | d in digit.all };
    real Dact = 800000 + sum { d.id | d in digit.active };
    real Dstb = 800000 + sum { d.id | d in digit.stable };
    real Didl = 800000 + sum { d.idle | d in digit.all };
    print ("start: all=", Dall, "; active=", Dact, "; updated=", Dupd, "; stable=", Dstb, "; idle=", Didl, "\n");
    print ("                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 Dupd = 800000 + sum { d.updated | d in digit.all };
    real Dact = 800000 + sum { d.id | d in digit.active };
    real Dstb = 800000 + sum { d.id | d in digit.stable };
    real Didl = 800000 + sum { d.idle | d in digit.all };
    print("(g) ", step, ": all=", Dall, "; active=", Dact, "; updated=", Dupd, "; stable=", Dstb, "; idle=", Didl, "\n");
    print ("                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(i) | i in 0..3 }
; // NOTv2 (v1) (vL)

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