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

SCM Repository

[diderot] View of /tests/lamont-tests/life2.diderot
ViewVC logotype

View of /tests/lamont-tests/life2.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 10 months ago) by glk
File size: 1504 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
input int iterMax = 10;

//int sizeX = 31; int sizeY = 13;
//field#0(2)[] init = tent ⊛ image("twinbeesshuttle.nrrd");

int sizeX = 8;
int sizeY = 9;
field#0(2)[] init = tent ⊛ image("data/glider.nrrd");

real rr = sqrt(2)+0.001;

strand cell (int id0, vec2 pos0, int val0) {
   vec2 pos = pos0;
   output int val = val0;
   int iter = 0;
   int id = id0;

   update {
      if (iter == iterMax) {
         stabilize;
      }
      if (iter == iterMax-1 && 0 == id) {
         print("------------------------- iter ", iter, "\n");
      }
      if (iter == iterMax-1) {
         print(id, ": ", val, " @ [", pos[0], ",", pos[1], "]\n");
      }
      int nn = 0;
      int totnn = 0;
      foreach (cell c in sphere(rr)) {
         totnn += 1;
         nn += 1 if (c.val > 0.5) else 0;
         if (iter == iterMax-1) {
            print("     ", c.id, ": ", c.val, " @ [", c.pos[0], ",", c.pos[1], "]; nn --> ", nn, "\n");
         }
      }
      if (pos[0] > 0.1 && pos[1] > 0.1 && pos[0] < sizeX-1.1 && pos[1] < sizeY-1.1) {
         if (8 != totnn) {
            print("   HEY HEY tot # neighbors ", totnn, " != 8 !!!!\n");
         }
      }
      val = (1 if (3 == nn) else
             (val if (2 == nn) else
              0));
      if (iter == iterMax-1) {
         print("  --> ", val, "\n");
      }
      iter += 1;
   }
}

initially [ cell(ii + sizeX*jj,
                 [ii, jj],
                 1 if init([ii,jj]) > 0.5 else 0)
             | jj in 0..sizeY-1, ii in 0..sizeX-1 ];

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