       down_right: level.read_pos(pos.down_right.m, pos.down_right.n)
         
     # up-right square
-    deadlocked_positions = @deadlocked_square(cell.up, cell.up_right, cell.right,
-                                              pos.up,  pos.up_right,  pos.right,
-                                              pos.box, deadlocked_positions)
+    deadlocked_positions = @deadlocked_square(cell.box, cell.up, cell.up_right, cell.right,
+                                              pos.box,  pos.up,  pos.up_right,  pos.right,
+                                              deadlocked_positions)
     
     # up-left square
-    deadlocked_positions = @deadlocked_square(cell.up, cell.up_left, cell.left,
-                                              pos.up,  pos.up_left,  pos.left,
-                                              pos.box, deadlocked_positions)
+    deadlocked_positions = @deadlocked_square(cell.box, cell.up, cell.up_left, cell.left,
+                                              pos.box,  pos.up,  pos.up_left,  pos.left,
+                                              deadlocked_positions)
                                               
     # down-right square
-    deadlocked_positions = @deadlocked_square(cell.down, cell.down_right, cell.right,
-                                              pos.down,  pos.down_right,  pos.right,
-                                              pos.box,   deadlocked_positions)
+    deadlocked_positions = @deadlocked_square(cell.box, cell.down, cell.down_right, cell.right,
+                                              pos.box,  pos.down,  pos.down_right,  pos.right,
+                                              deadlocked_positions)
     
     # down-left square
-    deadlocked_positions = @deadlocked_square(cell.down, cell.down_left, cell.left,
-                                              pos.down,  pos.down_left,  pos.left,
-                                              pos.box,   deadlocked_positions)
+    deadlocked_positions = @deadlocked_square(cell.box, cell.down, cell.down_left, cell.left,
+                                              pos.box,  pos.down,  pos.down_left,  pos.left,
+                                              deadlocked_positions)
                                               
     return deadlocked_positions
     

      down_right: { m:box_position.m+1, n:box_position.n+1 }

    cell =
      left:  level.read_pos(pos.left.m,  pos.left.n)
      right: level.read_pos(pos.right.m, pos.right.n)
      down:  level.read_pos(pos.down.m,  pos.down.n)

    #  #   #   #   #   ######   ######
    #  #####   #####
    
    # fig 1, upper box
    if cell.left == '#' and cell.down_right == '#'
      if (cell.box == '$' || cell.box == '*') and (cell.down == '$' || cell.down == '*')
        if not (cell.box == '*' and cell.down == '*') 
          if not @position_in_array(cell.box, deadlocked_positions)
            deadlocked_positions.push({ m:cell.box.m, n:cell.box.n })
          if not @position_in_array()
            deadlocked_positions.push({ m:cell.down.m, n:cell.down.n })
    
#    // fig 1, lower box
#    if(posRight == -1 && posUpLeft == -1
#        && boxesZone->readPos(posUp) == 1)
