       y0 = Math.min(y0, y)
       y1 = Math.max(y1, y)
     [x0, y0, x1, y1]
-
   
   transform: (lst, tfm, need_normalize = true) ->
     #transform cell block: rotate or flip


    bestPatternSearch = new Maximizer @energy
    bestPatternSearch.put pattern
    
    #start search
    cycle_found = false
    for iter in [1 .. max_iters] by 1

    throw new Error "Impossible to rotate vector (#{dx},#{dy}) to the positive direction"


  

  analyze1: (pattern, rule, max_iters = 2048, stop_on_border_hit=true) ->
    throw new Error ("Pattern undefined")  unless pattern
    throw new Error ("Rule undefined")  unless rule
    #sort cells by Y, then by X
