         result.found=true
         return false
       return (t-time) < period
+      
+    if not result.found
+      p = Cells.copy pattern
+      [dx, dy] = offsetToOrigin p, time
+      Cells.sortXY p
+      result.pos = [dx, dy, time]
+      result.rle = Cells.to_rle p
+      result.found = false
+      result.transform = [1,0,0,1]
     return result
     
 


#2-block
pattern2 = Cells.from_rle "$2o2$2o"
pattern1 = Cells.from_rle "o"

v2 = (determinePeriod rule, pattern2, 0).delta
v1 = (determinePeriod rule, pattern1, 0).delta

    
  console.log "#### colliding:"
  console.log "#### 1)  #{normalizedRle p1} at [0, 0, 0]"
  console.log "#### 2)  #{normalizedRle p2} at #{JSON.stringify offset}"
  console.log "####     collision at T=#{coll.time}  (give up at #{timeGiveUp})"
  collision.timeStart = coll.time
  collision.collision = true
  
  
  collision.products = finishCollision rule, coll.field, coll.time
  for product, i in collision.products
    console.log "####   #{i+1}) #{JSON.stringify product}"

  return collision

#Simulate 2 patterns until they collide.
