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

SCM Repository

[diderot] View of /branches/lamont/test/particle.diderot
ViewVC logotype

View of /branches/lamont/test/particle.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2083 - (download) (annotate)
Thu Nov 8 18:42:05 2012 UTC (6 years, 11 months ago) by lamonts
File size: 645 byte(s)
added grid code and dot notation
int worldWidth = 500;
int worldHeight = 500;
int particleRadius = 4; 

// Particle(x,y) 
strand Particle (int x, int y) {
    vec2 pos = [real(x),real(y)]; 
    int id = x * worldWidth + y;  
    vec4 neighbor = [0.0, 0.0, 0.0, 0.0];
  //  output vec4 neighbors = [0.0, 0.0, 0.0, 0.0];
    output int neighborCount = 0;  

    update {
         int t = 3; 
         int count = 0;
         foreach(Particle p in sphere(5)){ 
            t = p.id; 
            count = count + 1  + t; 
          }
         neighborCount = count; 
         stabilize; 
    }
}

initially [ Particle(ui, vi) | vi in 0..(worldHeight-1), ui in 0..(worldWidth-1) ];

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