n = 77
len m[] n * n
m[n * n div 2 + 1] = 10000
# 
proc show . .
   sc = 100 / n
   for r range0 n
      for c range0 n
         move c * sc r * sc
         p = r * n + c + 1
         color 222 * m[p]
         rect sc sc
      .
   .
   sleep 0
.
proc run . .
   repeat
      mp[] = m[]
      stable = 1
      for p to len mp[]
         if mp[p] >= 4
            stable = 0
            m[p] -= 4
            m[p - n] += 1
            m[p + 1] += 1
            m[p + n] += 1
            m[p - 1] += 1
         .
      .
      show
      until stable = 1
   .
.
run
