Jump to content

regart

Members
  • Content count

    2
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

Everything posted by regart

  1. Hi there, I'm quite new to vex and try to build a simple loop to implement the set of rules of the "game of life" by Conway. The code seems to work for the first iteration, but then stops working as I would expect. In my example I use a grid with 5 points to be having a attrib value of 1, which is called i@life the others are set to 0. This goes into a point wrangle: int count = chi("count"); int life = i@life; int adj[] = array(); int alive = 0; adj = nearpoints(0, @P, 10, 9); removeindex(adj, 0); i[]@adj = adj; for(int i = 0; i < count; i++){ alive = 0; for(int p = 0; p < len(adj); p++){ int iter = adj[p]; alive += point(0, "life", iter); } if(life == 1){ if(alive < 2 || alive == 8) life = 0; } else if(alive == 3) life = 1; i@life = life; } I would very much apprecciate any help on that! vex_gameOfLife.hiplc
  2. simple vex code for Conway's game of life

    Thank you Fred! within a sop solver it works fine! I don't get though, why it wouldn't work without it just with the loop. And thank you for the links, they are very useful!
×