     
   console.log "#### colliding:"
   console.log "#### 1)  #{normalizedRle p1} at [0, 0, 0]"
-  console.log "#### 2)  #{normalizedRle p2} at {JSON.stringify offset}"
+  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
-  timeCollisionStart = coll.time
-  
-  fld1 = fld2 = null #They are not needed anymore
+  
   
   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.

  # together, waiting while interaction occurs
  timeGiveUp = params.tcoll + waitForCollision #when to stop waiting for some interaction
  coll = simulateUntilCollision rule, fld1, fld2, time, timeGiveUp
  
  if not coll.collided
    #console.log "#### No interaction detected until T=#{timeGiveUp}. Give up."

  if parts.length is 1
    console.log "#### only one part, try more time"
    return finishCollision rule, field, time
    
  results = []
  for part, i in parts
    #now analyze this part
    res = analyzeFragment rule, part, time
    for r in res
      results.push r
  return results

analyzeFragment = (rule, pattern, time, options={})->
  analysys = determinePeriod rule, pattern, time, options
  if analysys.cycle
    #console.log "####      Pattern analysys: #{JSON.stringify analysys}"
    res = library.classifyPattern pattern, time, analysys.delta...
    [res]
  else
    console.log "####      Pattern not decomposed completely: #{normalizedRle pattern} #{time}"
    finishCollision rule, pattern, time
      
#detect periodicity in pattern
# Returns :
#   cycle::bool - is cycle found
