开心网的“AI智能人”游戏的作弊程序
    
      开心网的“谁最牛”模块有一个叫“AI智能人”的Flash游戏。偶每次玩到第10关都被难住。哀叹自己智商如此低下之余,也十分好奇这关到底应该咋过呢?网上又没找到攻略秘籍,只好自己DIY一个作弊程序了。
 
游戏的地址为:http://xyx.kaixin.com/upload/detail.php?game=A_I, 游戏规则是每次可以命令任意一个机器人朝某个方向行进,只有遇到其它机器人才会停下来,如果没有其他机器人的阻挡,就会一直走到棋盘边缘并坠落,任务失败。使红色机器人停留在棋盘中心的紫色格子里则过关。有兴趣的话可以玩一下。
可以用一个矩阵来表示棋盘。0代表空白的方格,1代表灰色机器人,2代表红色机器人。上图中的棋盘就可以这样来表示:
m = [[1,0,0,0,0],
[0,0,0,1,0],
[0,0,1,0,0],
[0,0,0,0,0],
[1,1,0,2,0]]
算法的话就是直接递归穷举所有可能的走法。Ruby代码如下。

 文件名AI.rb
文件名AI.rb
 require 'pp'
require 'pp'
 require 'pp_extension'
require 'pp_extension'
 require 'mathn'
require 'mathn'
 
        
 def suc_state?(m)
def suc_state?(m)
 return m[2][2] == 2
  return m[2][2] == 2
 end
end

 # Returns a clone of a, a is a tow-dimension array
# Returns a clone of a, a is a tow-dimension array
 def clone_2d_array(a)
def clone_2d_array(a)
 result = []
  result = []
 a.each {|i| result<<i.clone }
  a.each {|i| result<<i.clone }
 return result
  return result
 end
end

 def get_possible_move(m, x, y)
def get_possible_move(m, x, y)
 result = []
  result = []
 
  
 m_up = clone_2d_array(m)
  m_up = clone_2d_array(m)
 (0
  (0 y).to_a.reverse.each { |i|
y).to_a.reverse.each { |i| 
 if(m_up[i][x] > 0) then
    if(m_up[i][x] > 0) then
 m_up[i+1][x], m_up[y][x] = m_up[y][x], m_up[i+1][x]
      m_up[i+1][x], m_up[y][x] = m_up[y][x], m_up[i+1][x]
 break
      break      
 end
    end
 }
  }
 
  
 m_down = clone_2d_array(m)
  m_down = clone_2d_array(m)
 (y+1..m.length-1).each { |i|
  (y+1..m.length-1).each { |i| 
 if(m_down[i][x] > 0) then
    if(m_down[i][x] > 0) then
 m_down[i-1][x], m_down[y][x] = m_down[y][x], m_down[i-1][x]
      m_down[i-1][x], m_down[y][x] = m_down[y][x], m_down[i-1][x]
 break
      break
 end
    end
 }
  }
 
  
 m_left = clone_2d_array(m)
  m_left = clone_2d_array(m)
 (0
  (0 x).to_a.reverse.each { |i|
x).to_a.reverse.each { |i|
 if(m_left[y][i] > 0) then
    if(m_left[y][i] > 0) then
 m_left[y][i+1], m_left[y][x] = m_left[y][x], m_left[y][i+1]
      m_left[y][i+1], m_left[y][x] = m_left[y][x], m_left[y][i+1]
 break
      break
 end
    end
 }
  }

 m_right = clone_2d_array(m)
  m_right = clone_2d_array(m)
 (x+1..m[y].length-1).each { |i|
  (x+1..m[y].length-1).each { |i|
 if(m_right[y][i] > 0) then
    if(m_right[y][i] > 0) then
 m_right[y][i-1], m_right[y][x] = m_right[y][x], m_right[y][i-1]
      m_right[y][i-1], m_right[y][x] = m_right[y][x], m_right[y][i-1]
 break
      break
 end
    end
 }
  }
 
    
 result << m_up if m != m_up
  result << m_up if m != m_up
 result << m_down if m != m_down
  result << m_down if m != m_down
 result << m_left if m != m_left
  result << m_left if m != m_left 
 result << m_right if m !=m_right
  result << m_right if m !=m_right
 
  
 return result
  return result
 end
end

 def get_possible_next_states(m)
def get_possible_next_states(m)
 result = []
  result = []
 m.each_index { |y|
  m.each_index { |y|
 m[y].each_index { |x|
    m[y].each_index { |x|
 result |= get_possible_move(m, x, y) if(m[y][x] > 0)
        result |= get_possible_move(m, x, y) if(m[y][x] > 0)
 }
    }
 }
  }
 
  
 return result
  return result
 end
end

 def eai(m, state_stack)
def eai(m, state_stack)
 # get all possible next states
  # get all possible next states
 next_states =  get_possible_next_states(m)
  next_states =  get_possible_next_states(m)
 
  
 next_states.each { |next_m|
  next_states.each { |next_m|
 if(suc_state?(next_m)) then
    if(suc_state?(next_m)) then
 @move_map << next_m
      @move_map << next_m
 return true
      return true
 else
    else
 if(state_stack.has_key?(next_m) == false) then
      if(state_stack.has_key?(next_m) == false) then
 state_stack[next_m] = 'exists'
        state_stack[next_m] = 'exists'
 suc = eai(next_m, state_stack)
        suc = eai(next_m, state_stack)
 if(suc==true) then
        if(suc==true) then
 @move_map << next_m
          @move_map << next_m
 return true
          return true
 end
        end
 end
      end
 end
    end
 }
  }
 end
end

 def root_eai(m)
def root_eai(m)
 next_states =  get_possible_next_states(m)
  next_states =  get_possible_next_states(m)
 next_states.each { |next_m|
  next_states.each { |next_m|
 @move_map=[]
    @move_map=[]
 
    
 if(suc_state?(next_m)) then
    if(suc_state?(next_m)) then
 @move_map << next_m
      @move_map << next_m
 return
      return
 else
    else
 state_stack=Hash.new
      state_stack=Hash.new
 state_stack[next_m] = 'exists'
      state_stack[next_m] = 'exists'
 
      
 suc = eai(next_m, state_stack)
      suc = eai(next_m, state_stack)
 if(suc==true) then
      if(suc==true) then
 @move_map << next_m
        @move_map << next_m
 @move_map << m
        @move_map << m
 return
        return
 end
      end
 end
    end
 }
  }
 end
end

 def set_mark(move_map)
def set_mark(move_map)
 result = move_map.reverse
  result = move_map.reverse
 result.each_index { |i|
  result.each_index { |i|
 if(i < result.length-1) then
    if(i < result.length-1) then
 state0 = result[i]
      state0 = result[i]
 state1 = result[i+1]
      state1 = result[i+1]
 start_x = -1
      start_x = -1
 start_y = -1
      start_y = -1
 end_x = -1
      end_x = -1
 end_y = -1
      end_y = -1
 
      
 state0.each_index { |y|
      state0.each_index { |y|
 state0[y].each_index { |x|
        state0[y].each_index { |x|
 p0 = state0[y][x]>=1? 1 : 0
          p0 = state0[y][x]>=1? 1 : 0
 p1 = state1[y][x]>=1? 1 : 0
          p1 = state1[y][x]>=1? 1 : 0
 if(p0 != p1 && p0>0) then
          if(p0 != p1 && p0>0) then
 start_x = x
            start_x = x
 start_y = y
            start_y = y
 end
          end
 if(p0 != p1 && p0==0) then
          if(p0 != p1 && p0==0) then
 end_x = x
            end_x = x
 end_y = y
            end_y = y
 end
          end
 }
        }
 }
      }
 state0[start_y][start_x] = '#'
      state0[start_y][start_x] = '#'
 state0[end_y][end_x] = '$'
      state0[end_y][end_x] = '$'
 #puts "(#{start_x},#{start_y}) To (#{end_x},#{end_y})"
      #puts "(#{start_x},#{start_y}) To (#{end_x},#{end_y})"
 end
    end
 }
  }
 return result
  return result
 end
end

 m = [[1,0,0,0,0],
m = [[1,0,0,0,0],
 [0,0,0,1,0],
        [0,0,0,1,0],
 [0,0,1,0,0],
        [0,0,1,0,0],
 [0,0,0,0,0],
        [0,0,0,0,0],
 [1,1,0,2,0]]
        [1,1,0,2,0]]
 
        
 root_eai(m)
root_eai(m)
 result = set_mark(@move_map)
result = set_mark(@move_map)
 result.each { |matrix|
  result.each { |matrix|
 matrix.each_index { |y|
  matrix.each_index { |y|
 matrix[y].each_index { |x|
    matrix[y].each_index { |x|
 matrix[y][x] = matrix[y][x].to_s
      matrix[y][x] = matrix[y][x].to_s
 }
    }
 }
  }
 }
}
代码写得很丑(真是书到用时方很少呀),真是对不起Ruby这么优雅的语言了,汗。其中的 “pp_extension” 在我的这篇文章里。 运行之后的效果:
 
按照右侧的输出的每一步把机器人从“#”移动到“$”即可。
程序已通过全部18关测试,看到自己的名字显示在前10以内,虚荣心真是小小地满足了一把,吼吼吼。
 
在一个地方被折磨了很久。就是AI.rb的地79行:
if(state_stack.has_key?(next_m) == false) then
s1 = [[1, 0, 0, 0, 0],
[1, 1, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 1, 2, 0, 0]]
 
s2 = [[1,0,0,0,0],
[1,1,0,0,0],
[0,1,2,0,0],
[0,0,1,0,0],
[0,0,0,0,0]]
s1.hash 和 s2.hash居然是相等的!都是3589,真是搞不懂。liangliangzai 和众位高手,请指点一二。
2008-1-14 更新
为了对得起Ruby,我又把这个程序重写了一遍,这回感觉好多了。代码:

 文件名 AI3.rb
文件名 AI3.rb
 require 'pp'
require 'pp'
 require 'pp_extension'
require 'pp_extension'
 require 'mathn'
require 'mathn'

 class Point
class Point
 attr_accessor :x
  attr_accessor :x
 attr_accessor :y
  attr_accessor :y
 attr_accessor :v
  attr_accessor :v  
 
  
 def initialize(x=0, y=0, v=0)
  def initialize(x=0, y=0, v=0)
 @x = x
    @x = x
 @y = y
    @y = y
 @v = v
    @v = v
 end
  end
 
  
 def to_s()
  def to_s()
 return "(#@x,#@y)=#@v"
    return "(#@x,#@y)=#@v"
 end
  end
 
  
 def pretty_print(q)
  def pretty_print(q)
 q.text(to_s)
    q.text(to_s)
 end
  end
 
  
 end
end
 
        
 def suc_state?(m)
def suc_state?(m)
 return m[2][2] == 2
  return m[2][2] == 2
 end
end

 def is_person?(v)
def is_person?(v)
 return v > 0
  return v > 0
 end
end

 def find_horizon_people_pair(m)
def find_horizon_people_pair(m)
 result = []
  result = []
 m.each_index do |y|
  m.each_index do |y|
 current_person = nil
    current_person = nil
 row = m[y]
    row = m[y]
 row.each_index do |x|
    row.each_index do |x|
 if is_person?(row[x]) then
      if is_person?(row[x]) then
 result << [current_person, Point.new(x, y, row[x])] unless current_person.nil?
        result << [current_person, Point.new(x, y, row[x])] unless current_person.nil?
 current_person = Point.new(x, y, row[x])
        current_person = Point.new(x, y, row[x])
 end
      end    
 end
    end
 end
  end
 return result
  return result
 end
end

 def get_next_states_from_horizon_people_pair(m, left_people, right_people)
def get_next_states_from_horizon_people_pair(m, left_people, right_people)
 result = []
  result = []
 y = left_people.y
  y = left_people.y

 next_state1 = m.collect { |x| x.collect } # deep copy
  next_state1 = m.collect { |x| x.collect } # deep copy
 next_state1[y][left_people.x+1], next_state1[y][right_people.x] = next_state1[y][right_people.x], next_state1[y][left_people.x+1]
  next_state1[y][left_people.x+1], next_state1[y][right_people.x] = next_state1[y][right_people.x], next_state1[y][left_people.x+1]

 next_state2 = m.collect { |x| x.collect } # deep copy
  next_state2 = m.collect { |x| x.collect } # deep copy
 next_state2[y][right_people.x-1], next_state2[y][left_people.x] = next_state2[y][left_people.x], next_state2[y][right_people.x-1]
  next_state2[y][right_people.x-1], next_state2[y][left_people.x] = next_state2[y][left_people.x], next_state2[y][right_people.x-1]
 
  
 result << next_state1 if next_state1 != m
  result << next_state1 if next_state1 != m
 result << next_state2 if next_state2 != m
  result << next_state2 if next_state2 != m
 return result
  return result
 end
end

 def get_next_states(m)
def get_next_states(m)
 result = []
  result = []
 # get horizion next states
  # get horizion next states
 people_pairs = find_horizon_people_pair(m)
  people_pairs = find_horizon_people_pair(m)
 people_pairs.each do |people_pair|
  people_pairs.each do |people_pair|
 result.concat(get_next_states_from_horizon_people_pair(m, *people_pair))
    result.concat(get_next_states_from_horizon_people_pair(m, *people_pair))
 end
  end
 # get vertical next states
  # get vertical next states
 mt = Matrix[*m].transpose.to_a
  mt = Matrix[*m].transpose.to_a
 people_pairs = find_horizon_people_pair(mt)
  people_pairs = find_horizon_people_pair(mt)
 people_pairs.each do |people_pair|
  people_pairs.each do |people_pair|
 result.concat(get_next_states_from_horizon_people_pair(mt, *people_pair).collect! { |x| Matrix[*x].transpose.to_a } )
    result.concat(get_next_states_from_horizon_people_pair(mt, *people_pair).collect! { |x| Matrix[*x].transpose.to_a } ) 
 end
  end
 return result
  return result
 end
end

 def eai(m, state_stack)
def eai(m, state_stack)
 state_stack << m
  state_stack << m
 return true if(suc_state?(m))
  return true if(suc_state?(m)) 
 
  
 next_states =  get_next_states(m)
  next_states =  get_next_states(m)
 next_states.each do |next_m|
  next_states.each do |next_m|
 unless(state_stack.include?(next_m)) then
    unless(state_stack.include?(next_m)) then
 suc = eai(next_m, state_stack)
      suc = eai(next_m, state_stack)
 return true if suc
      return true if suc
 end
    end
 end
  end
 state_stack.pop
  state_stack.pop
 return false
  return false
 end
end

 def set_mark(m_array)
def set_mark(m_array)
 result = m_array.collect { |m| m.collect { |x| x.collect }  } # deep copy
  result = m_array.collect { |m| m.collect { |x| x.collect }  } # deep copy
 
  
 (1
  (1 m_array.length).each do |i|
m_array.length).each do |i|
 m_array[i].each_index do |y|
    m_array[i].each_index do |y|
 m_array[i][y].each_index do |x|
        m_array[i][y].each_index do |x|
 if(m_array[i-1][y][x] == m_array[i][y][x]) then
          if(m_array[i-1][y][x] == m_array[i][y][x]) then
 result[i][y][x] = '|'
            result[i][y][x] = '|'
 else
          else
 result[i][y][x] = m_array[i][y][x].to_s
            result[i][y][x] = m_array[i][y][x].to_s
 end
          end
 end
        end
 end
      end
 end
  end
 
  
 return result
  return result
 end
end

 m = [[1,0,0,1,0],
m = [[1,0,0,1,0],
 [0,0,0,0,0],
        [0,0,0,0,0],
 [0,0,0,2,0],
        [0,0,0,2,0],
 [0,0,0,0,0],
        [0,0,0,0,0],
 [1,1,0,0,1]]
        [1,1,0,0,1]]

 result = []
result = []
 suc = eai(m, result)
suc = eai(m, result)

 roads = set_mark(result)
roads = set_mark(result)
 roads.each_index do |i|
roads.each_index do |i|
 puts "---#{i}---"
  puts "---#{i}---"
 pp roads[i]
  pp roads[i]
 end
end
比较难的几关的攻略:

 第9关
第9关
 ---0---
---0---
 [[1, 0, 0, 0, 0],
[[1, 0, 0, 0, 0],
 [0, 0, 0, 1, 0],
 [0, 0, 0, 1, 0],
 [0, 0, 1, 0, 0],
 [0, 0, 1, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [1, 1, 0, 2, 0]]
 [1, 1, 0, 2, 0]]
 ---1---
---1---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "1", "|", "|"]]
 ["|", "0", "1", "|", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "0", "|", "|"]]
 ["|", "1", "0", "|", "|"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"]]
 ["|", "|", "|", "0", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "2", "0", "|"],
 ["|", "|", "2", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]

 第10关
第10关
 ---0---
---0---
 [[0, 2, 0, 0, 0],
[[0, 2, 0, 0, 0],
 [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1],
 [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [1, 1, 1, 0, 0]]
 [1, 1, 1, 0, 0]]
 ---1---
---1---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "|", "1", "|"],
 ["|", "0", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "1", "|", "|", "|"]]
 ["0", "1", "|", "|", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "1", "0", "|"],
 ["|", "|", "1", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---9---
---9---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "0", "|", "|"],
 ["|", "1", "0", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---10---
---10---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---11---
---11---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---12---
---12---
 [["|", "0", "|", "|", "|"],
[["|", "0", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---13---
---13---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---14---
---14---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---15---
---15---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "1", "|", "|", "|"],
 ["0", "1", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---16---
---16---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "2", "|", "|"],
 ["|", "|", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]

 第11关
第11关
 ---0---
---0---
 [[1, 2, 0, 0, 0],
[[1, 2, 0, 0, 0],
 [0, 0, 0, 1, 0],
 [0, 0, 0, 1, 0],
 [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0],
 [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1],
 [0, 0, 1, 0, 0]]
 [0, 0, 1, 0, 0]]
 ---1---
---1---
 [["0", "|", "|", "|", "|"],
[["0", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["0", "|", "1", "|", "|"],
 ["0", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---9---
---9---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---10---
---10---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "0", "|", "|"],
 ["|", "1", "0", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---11---
---11---
 [["|", "0", "|", "|", "|"],
[["|", "0", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---12---
---12---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---13---
---13---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---14---
---14---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "2", "|", "|"],
 ["|", "|", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]

 第13关
第13关
 ---0---
---0---
 [[1, 0, 0, 0, 2],
[[1, 0, 0, 0, 2],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [1, 0, 1, 0, 1]]
 [1, 0, 1, 0, 1]]
 ---1---
---1---
 [["0", "|", "|", "1", "|"],
[["0", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "0", "|", "|"]]
 ["|", "1", "0", "|", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "1", "|"]]
 ["|", "0", "|", "1", "|"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"]]
 ["|", "|", "|", "0", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "0"],
[["|", "|", "|", "|", "0"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "2"],
 ["|", "|", "|", "|", "2"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "0"]]
 ["|", "1", "|", "|", "0"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "|", "|", "1", "|"],
 ["0", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---9---
---9---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---10---
---10---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---11---
---11---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---12---
---12---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---13---
---13---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---14---
---14---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "2", "0"],
 ["|", "|", "|", "2", "0"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---15---
---15---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---16---
---16---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "2", "0", "|"],
 ["|", "|", "2", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]

 第14关
第14关
 ---0---
---0---
 [[1, 0, 0, 0, 2],
[[1, 0, 0, 0, 2],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [1, 0, 1, 0, 1]]
 [1, 0, 1, 0, 1]]
 ---1---
---1---
 [["0", "|", "|", "1", "|"],
[["0", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "0", "|", "|"]]
 ["|", "1", "0", "|", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "1", "|"]]
 ["|", "0", "|", "1", "|"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"]]
 ["|", "|", "|", "0", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "0"],
[["|", "|", "|", "|", "0"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "2"],
 ["|", "|", "|", "|", "2"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "0"]]
 ["|", "1", "|", "|", "0"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "|", "|", "1", "|"],
 ["0", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---9---
---9---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---10---
---10---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---11---
---11---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---12---
---12---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---13---
---13---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---14---
---14---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "2", "0"],
 ["|", "|", "|", "2", "0"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---15---
---15---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---16---
---16---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "2", "0", "|"],
 ["|", "|", "2", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 >Exit code: 0
>Exit code: 0
 >ruby AI3.rb
>ruby AI3.rb
 ---0---
---0---
 [[1, 0, 0, 0, 0],
[[1, 0, 0, 0, 0],
 [0, 0, 0, 1, 1],
 [0, 0, 0, 1, 1],
 [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [2, 0, 0, 1, 0]]
 [2, 0, 0, 1, 0]]
 ---1---
---1---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"]]
 ["|", "1", "|", "0", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["2", "|", "|", "|", "|"],
 ["2", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "0"],
 ["|", "|", "1", "|", "0"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["0", "2", "|", "|", "|"],
 ["0", "2", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---9---
---9---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "1", "|"],
 ["|", "0", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---10---
---10---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---11---
---11---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]

 第15关
第15关
---0---
[[1, 1, 0, 0, 1],
[0, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[0, 0, 0, 0, 1],
[0, 2, 0, 0, 0]]
---1---
[["|", "|", "1", "|", "0"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---2---
[["|", "|", "|", "|", "|"],
["1", "|", "|", "|", "|"],
["0", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---3---
[["|", "0", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---4---
[["0", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---5---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "|", "1", "|"],
["|", "|", "|", "|", "|"]]
---6---
[["|", "0", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---7---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "1", "0", "|"],
["|", "|", "|", "|", "|"]]
---8---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "1", "0"],
["|", "|", "|", "|", "|"]]
---9---
[["|", "|", "|", "|", "|"],
["|", "|", "1", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "0", "|", "|"],
["|", "|", "|", "|", "|"]]
---10---
[["|", "|", "|", "|", "|"],
["|", "1", "0", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---11---
[["|", "|", "|", "|", "|"],
["|", "0", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---12---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "1", "|", "|"],
["|", "|", "|", "|", "|"]]
---13---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "2", "|", "|", "|"],
["|", "0", "|", "|", "|"]]
---14---
[["|", "|", "|", "|", "|"],
["|", "|", "1", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "0", "|", "|"],
["|", "|", "|", "|", "|"]]
---15---
[["|", "|", "|", "|", "|"],
["0", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---16---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "2", "|", "|"],
["|", "|", "|", "|", "|"]]
---17---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "2", "|", "|"],
["|", "|", "0", "|", "|"],
["|", "|", "|", "|", "|"]]

 第16关
第16关
 ---0---
---0---
 [[0, 1, 0, 0, 1],
[[0, 1, 0, 0, 1],
 [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0],
 [2, 0, 0, 1, 1]]
 [2, 0, 0, 1, 1]]
 ---1---
---1---
 [["|", "|", "1", "|", "0"],
[["|", "|", "1", "|", "0"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---2---
---2---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "1", "|", "0", "|"]]
 ["|", "1", "|", "0", "|"]]
 ---3---
---3---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "0"]]
 ["|", "|", "1", "|", "0"]]
 ---4---
---4---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---5---
---5---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "|", "1", "|"],
 ["|", "0", "|", "1", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---6---
---6---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["0", "2", "|", "|", "|"]]
 ["0", "2", "|", "|", "|"]]
 ---7---
---7---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]]
 ---8---
---8---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "1", "0", "|"],
 ["|", "|", "1", "0", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---9---
---9---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---10---
---10---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---11---
---11---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 ---12---
---12---
 [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"],
 ["|", "|", "2", "|", "|"],
 ["|", "|", "2", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]

 第18关
第18关
---0---
[[1, 0, 0, 1, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 2, 0],
[0, 0, 0, 0, 0],
[1, 1, 0, 0, 1]]
---1---
[["|", "1", "|", "0", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---2---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "1", "|", "0"]]
---3---
[["0", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["1", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---4---
[["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "|", "|", "|"]]
---5---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "0", "|", "|"]]
---6---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "|", "|", "|"]]
---7---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "2", "0", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
     
 

游戏的地址为:http://xyx.kaixin.com/upload/detail.php?game=A_I, 游戏规则是每次可以命令任意一个机器人朝某个方向行进,只有遇到其它机器人才会停下来,如果没有其他机器人的阻挡,就会一直走到棋盘边缘并坠落,任务失败。使红色机器人停留在棋盘中心的紫色格子里则过关。有兴趣的话可以玩一下。
可以用一个矩阵来表示棋盘。0代表空白的方格,1代表灰色机器人,2代表红色机器人。上图中的棋盘就可以这样来表示:
m = [[1,0,0,0,0],
[0,0,0,1,0],
[0,0,1,0,0],
[0,0,0,0,0],
[1,1,0,2,0]]
算法的话就是直接递归穷举所有可能的走法。Ruby代码如下。

 文件名AI.rb
文件名AI.rb require 'pp'
require 'pp' require 'pp_extension'
require 'pp_extension' require 'mathn'
require 'mathn' 
         def suc_state?(m)
def suc_state?(m) return m[2][2] == 2
  return m[2][2] == 2 end
end
 # Returns a clone of a, a is a tow-dimension array
# Returns a clone of a, a is a tow-dimension array def clone_2d_array(a)
def clone_2d_array(a) result = []
  result = [] a.each {|i| result<<i.clone }
  a.each {|i| result<<i.clone } return result
  return result end
end
 def get_possible_move(m, x, y)
def get_possible_move(m, x, y) result = []
  result = [] 
   m_up = clone_2d_array(m)
  m_up = clone_2d_array(m) (0
  (0 y).to_a.reverse.each { |i|
y).to_a.reverse.each { |i|  if(m_up[i][x] > 0) then
    if(m_up[i][x] > 0) then m_up[i+1][x], m_up[y][x] = m_up[y][x], m_up[i+1][x]
      m_up[i+1][x], m_up[y][x] = m_up[y][x], m_up[i+1][x] break
      break       end
    end }
  } 
   m_down = clone_2d_array(m)
  m_down = clone_2d_array(m) (y+1..m.length-1).each { |i|
  (y+1..m.length-1).each { |i|  if(m_down[i][x] > 0) then
    if(m_down[i][x] > 0) then m_down[i-1][x], m_down[y][x] = m_down[y][x], m_down[i-1][x]
      m_down[i-1][x], m_down[y][x] = m_down[y][x], m_down[i-1][x] break
      break end
    end }
  } 
   m_left = clone_2d_array(m)
  m_left = clone_2d_array(m) (0
  (0 x).to_a.reverse.each { |i|
x).to_a.reverse.each { |i| if(m_left[y][i] > 0) then
    if(m_left[y][i] > 0) then m_left[y][i+1], m_left[y][x] = m_left[y][x], m_left[y][i+1]
      m_left[y][i+1], m_left[y][x] = m_left[y][x], m_left[y][i+1] break
      break end
    end }
  }
 m_right = clone_2d_array(m)
  m_right = clone_2d_array(m) (x+1..m[y].length-1).each { |i|
  (x+1..m[y].length-1).each { |i| if(m_right[y][i] > 0) then
    if(m_right[y][i] > 0) then m_right[y][i-1], m_right[y][x] = m_right[y][x], m_right[y][i-1]
      m_right[y][i-1], m_right[y][x] = m_right[y][x], m_right[y][i-1] break
      break end
    end }
  } 
     result << m_up if m != m_up
  result << m_up if m != m_up result << m_down if m != m_down
  result << m_down if m != m_down result << m_left if m != m_left
  result << m_left if m != m_left  result << m_right if m !=m_right
  result << m_right if m !=m_right 
   return result
  return result end
end
 def get_possible_next_states(m)
def get_possible_next_states(m) result = []
  result = [] m.each_index { |y|
  m.each_index { |y| m[y].each_index { |x|
    m[y].each_index { |x| result |= get_possible_move(m, x, y) if(m[y][x] > 0)
        result |= get_possible_move(m, x, y) if(m[y][x] > 0) }
    } }
  } 
   return result
  return result end
end
 def eai(m, state_stack)
def eai(m, state_stack) # get all possible next states
  # get all possible next states next_states =  get_possible_next_states(m)
  next_states =  get_possible_next_states(m) 
   next_states.each { |next_m|
  next_states.each { |next_m| if(suc_state?(next_m)) then
    if(suc_state?(next_m)) then @move_map << next_m
      @move_map << next_m return true
      return true else
    else if(state_stack.has_key?(next_m) == false) then
      if(state_stack.has_key?(next_m) == false) then state_stack[next_m] = 'exists'
        state_stack[next_m] = 'exists' suc = eai(next_m, state_stack)
        suc = eai(next_m, state_stack) if(suc==true) then
        if(suc==true) then @move_map << next_m
          @move_map << next_m return true
          return true end
        end end
      end end
    end }
  } end
end
 def root_eai(m)
def root_eai(m) next_states =  get_possible_next_states(m)
  next_states =  get_possible_next_states(m) next_states.each { |next_m|
  next_states.each { |next_m| @move_map=[]
    @move_map=[] 
     if(suc_state?(next_m)) then
    if(suc_state?(next_m)) then @move_map << next_m
      @move_map << next_m return
      return else
    else state_stack=Hash.new
      state_stack=Hash.new state_stack[next_m] = 'exists'
      state_stack[next_m] = 'exists' 
       suc = eai(next_m, state_stack)
      suc = eai(next_m, state_stack) if(suc==true) then
      if(suc==true) then @move_map << next_m
        @move_map << next_m @move_map << m
        @move_map << m return
        return end
      end end
    end }
  } end
end
 def set_mark(move_map)
def set_mark(move_map) result = move_map.reverse
  result = move_map.reverse result.each_index { |i|
  result.each_index { |i| if(i < result.length-1) then
    if(i < result.length-1) then state0 = result[i]
      state0 = result[i] state1 = result[i+1]
      state1 = result[i+1] start_x = -1
      start_x = -1 start_y = -1
      start_y = -1 end_x = -1
      end_x = -1 end_y = -1
      end_y = -1 
       state0.each_index { |y|
      state0.each_index { |y| state0[y].each_index { |x|
        state0[y].each_index { |x| p0 = state0[y][x]>=1? 1 : 0
          p0 = state0[y][x]>=1? 1 : 0 p1 = state1[y][x]>=1? 1 : 0
          p1 = state1[y][x]>=1? 1 : 0 if(p0 != p1 && p0>0) then
          if(p0 != p1 && p0>0) then start_x = x
            start_x = x start_y = y
            start_y = y end
          end if(p0 != p1 && p0==0) then
          if(p0 != p1 && p0==0) then end_x = x
            end_x = x end_y = y
            end_y = y end
          end }
        } }
      } state0[start_y][start_x] = '#'
      state0[start_y][start_x] = '#' state0[end_y][end_x] = '$'
      state0[end_y][end_x] = '$' #puts "(#{start_x},#{start_y}) To (#{end_x},#{end_y})"
      #puts "(#{start_x},#{start_y}) To (#{end_x},#{end_y})" end
    end }
  } return result
  return result end
end
 m = [[1,0,0,0,0],
m = [[1,0,0,0,0], [0,0,0,1,0],
        [0,0,0,1,0], [0,0,1,0,0],
        [0,0,1,0,0], [0,0,0,0,0],
        [0,0,0,0,0], [1,1,0,2,0]]
        [1,1,0,2,0]] 
         root_eai(m)
root_eai(m) result = set_mark(@move_map)
result = set_mark(@move_map) result.each { |matrix|
  result.each { |matrix| matrix.each_index { |y|
  matrix.each_index { |y| matrix[y].each_index { |x|
    matrix[y].each_index { |x| matrix[y][x] = matrix[y][x].to_s
      matrix[y][x] = matrix[y][x].to_s }
    } }
  } }
}代码写得很丑(真是书到用时方很少呀),真是对不起Ruby这么优雅的语言了,汗。其中的 “pp_extension” 在我的这篇文章里。 运行之后的效果:

按照右侧的输出的每一步把机器人从“#”移动到“$”即可。
程序已通过全部18关测试,看到自己的名字显示在前10以内,虚荣心真是小小地满足了一把,吼吼吼。

在一个地方被折磨了很久。就是AI.rb的地79行:
if(state_stack.has_key?(next_m) == false) then
        state_stack[next_m] = 'exists'
本来我写的是
 if(state_stack.has_key?(next_m.hash) == false) then
        state_stack[next_m.hash] = 'exists'
s1 = [[1, 0, 0, 0, 0],
[1, 1, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 1, 0, 0],
[0, 1, 2, 0, 0]]
s2 = [[1,0,0,0,0],
[1,1,0,0,0],
[0,1,2,0,0],
[0,0,1,0,0],
[0,0,0,0,0]]
s1.hash 和 s2.hash居然是相等的!都是3589,真是搞不懂。liangliangzai 和众位高手,请指点一二。
2008-1-14 更新
为了对得起Ruby,我又把这个程序重写了一遍,这回感觉好多了。代码:

 文件名 AI3.rb
文件名 AI3.rb require 'pp'
require 'pp' require 'pp_extension'
require 'pp_extension' require 'mathn'
require 'mathn'
 class Point
class Point attr_accessor :x
  attr_accessor :x attr_accessor :y
  attr_accessor :y attr_accessor :v
  attr_accessor :v   
   def initialize(x=0, y=0, v=0)
  def initialize(x=0, y=0, v=0) @x = x
    @x = x @y = y
    @y = y @v = v
    @v = v end
  end 
   def to_s()
  def to_s() return "(#@x,#@y)=#@v"
    return "(#@x,#@y)=#@v" end
  end 
   def pretty_print(q)
  def pretty_print(q) q.text(to_s)
    q.text(to_s) end
  end 
   end
end 
         def suc_state?(m)
def suc_state?(m) return m[2][2] == 2
  return m[2][2] == 2 end
end
 def is_person?(v)
def is_person?(v) return v > 0
  return v > 0 end
end
 def find_horizon_people_pair(m)
def find_horizon_people_pair(m) result = []
  result = [] m.each_index do |y|
  m.each_index do |y| current_person = nil
    current_person = nil row = m[y]
    row = m[y] row.each_index do |x|
    row.each_index do |x| if is_person?(row[x]) then
      if is_person?(row[x]) then result << [current_person, Point.new(x, y, row[x])] unless current_person.nil?
        result << [current_person, Point.new(x, y, row[x])] unless current_person.nil? current_person = Point.new(x, y, row[x])
        current_person = Point.new(x, y, row[x]) end
      end     end
    end end
  end return result
  return result end
end
 def get_next_states_from_horizon_people_pair(m, left_people, right_people)
def get_next_states_from_horizon_people_pair(m, left_people, right_people) result = []
  result = [] y = left_people.y
  y = left_people.y
 next_state1 = m.collect { |x| x.collect } # deep copy
  next_state1 = m.collect { |x| x.collect } # deep copy next_state1[y][left_people.x+1], next_state1[y][right_people.x] = next_state1[y][right_people.x], next_state1[y][left_people.x+1]
  next_state1[y][left_people.x+1], next_state1[y][right_people.x] = next_state1[y][right_people.x], next_state1[y][left_people.x+1]
 next_state2 = m.collect { |x| x.collect } # deep copy
  next_state2 = m.collect { |x| x.collect } # deep copy next_state2[y][right_people.x-1], next_state2[y][left_people.x] = next_state2[y][left_people.x], next_state2[y][right_people.x-1]
  next_state2[y][right_people.x-1], next_state2[y][left_people.x] = next_state2[y][left_people.x], next_state2[y][right_people.x-1] 
   result << next_state1 if next_state1 != m
  result << next_state1 if next_state1 != m result << next_state2 if next_state2 != m
  result << next_state2 if next_state2 != m return result
  return result end
end
 def get_next_states(m)
def get_next_states(m) result = []
  result = [] # get horizion next states
  # get horizion next states people_pairs = find_horizon_people_pair(m)
  people_pairs = find_horizon_people_pair(m) people_pairs.each do |people_pair|
  people_pairs.each do |people_pair| result.concat(get_next_states_from_horizon_people_pair(m, *people_pair))
    result.concat(get_next_states_from_horizon_people_pair(m, *people_pair)) end
  end # get vertical next states
  # get vertical next states mt = Matrix[*m].transpose.to_a
  mt = Matrix[*m].transpose.to_a people_pairs = find_horizon_people_pair(mt)
  people_pairs = find_horizon_people_pair(mt) people_pairs.each do |people_pair|
  people_pairs.each do |people_pair| result.concat(get_next_states_from_horizon_people_pair(mt, *people_pair).collect! { |x| Matrix[*x].transpose.to_a } )
    result.concat(get_next_states_from_horizon_people_pair(mt, *people_pair).collect! { |x| Matrix[*x].transpose.to_a } )  end
  end return result
  return result end
end
 def eai(m, state_stack)
def eai(m, state_stack) state_stack << m
  state_stack << m return true if(suc_state?(m))
  return true if(suc_state?(m))  
   next_states =  get_next_states(m)
  next_states =  get_next_states(m) next_states.each do |next_m|
  next_states.each do |next_m| unless(state_stack.include?(next_m)) then
    unless(state_stack.include?(next_m)) then suc = eai(next_m, state_stack)
      suc = eai(next_m, state_stack) return true if suc
      return true if suc end
    end end
  end state_stack.pop
  state_stack.pop return false
  return false end
end
 def set_mark(m_array)
def set_mark(m_array) result = m_array.collect { |m| m.collect { |x| x.collect }  } # deep copy
  result = m_array.collect { |m| m.collect { |x| x.collect }  } # deep copy 
   (1
  (1 m_array.length).each do |i|
m_array.length).each do |i| m_array[i].each_index do |y|
    m_array[i].each_index do |y| m_array[i][y].each_index do |x|
        m_array[i][y].each_index do |x| if(m_array[i-1][y][x] == m_array[i][y][x]) then
          if(m_array[i-1][y][x] == m_array[i][y][x]) then result[i][y][x] = '|'
            result[i][y][x] = '|' else
          else result[i][y][x] = m_array[i][y][x].to_s
            result[i][y][x] = m_array[i][y][x].to_s end
          end end
        end end
      end end
  end 
   return result
  return result end
end
 m = [[1,0,0,1,0],
m = [[1,0,0,1,0], [0,0,0,0,0],
        [0,0,0,0,0], [0,0,0,2,0],
        [0,0,0,2,0], [0,0,0,0,0],
        [0,0,0,0,0], [1,1,0,0,1]]
        [1,1,0,0,1]]
 result = []
result = [] suc = eai(m, result)
suc = eai(m, result)
 roads = set_mark(result)
roads = set_mark(result) roads.each_index do |i|
roads.each_index do |i| puts "---#{i}---"
  puts "---#{i}---" pp roads[i]
  pp roads[i] end
end比较难的几关的攻略:

 第9关
第9关 ---0---
---0--- [[1, 0, 0, 0, 0],
[[1, 0, 0, 0, 0], [0, 0, 0, 1, 0],
 [0, 0, 0, 1, 0], [0, 0, 1, 0, 0],
 [0, 0, 1, 0, 0], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [1, 1, 0, 2, 0]]
 [1, 1, 0, 2, 0]] ---1---
---1--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "1", "|", "|"]]
 ["|", "0", "1", "|", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "0", "|", "|"]]
 ["|", "1", "0", "|", "|"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]] ---5---
---5--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "2", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"]]
 ["|", "|", "|", "0", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "2", "0", "|"],
 ["|", "|", "2", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 第10关
第10关 ---0---
---0--- [[0, 2, 0, 0, 0],
[[0, 2, 0, 0, 0], [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1], [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [1, 1, 1, 0, 0]]
 [1, 1, 1, 0, 0]] ---1---
---1--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "|", "|", "|", "|"],
 ["0", "|", "|", "|", "|"], ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "|", "1", "|"],
 ["|", "0", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "1", "|", "|", "|"]]
 ["0", "1", "|", "|", "|"]] ---5---
---5--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "1", "0", "|"],
 ["|", "|", "1", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "1", "0"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---9---
---9--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "0", "|", "|"],
 ["|", "1", "0", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---10---
---10--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---11---
---11--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---12---
---12--- [["|", "0", "|", "|", "|"],
[["|", "0", "|", "|", "|"], ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---13---
---13--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---14---
---14--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---15---
---15--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "1", "|", "|", "|"],
 ["0", "1", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---16---
---16--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "2", "|", "|"],
 ["|", "|", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 第11关
第11关 ---0---
---0--- [[1, 2, 0, 0, 0],
[[1, 2, 0, 0, 0], [0, 0, 0, 1, 0],
 [0, 0, 0, 1, 0], [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0], [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1], [0, 0, 1, 0, 0]]
 [0, 0, 1, 0, 0]] ---1---
---1--- [["0", "|", "|", "|", "|"],
[["0", "|", "|", "|", "|"], ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["0", "|", "1", "|", "|"],
 ["0", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "1", "0"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---5---
---5--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---9---
---9--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---10---
---10--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "0", "|", "|"],
 ["|", "1", "0", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---11---
---11--- [["|", "0", "|", "|", "|"],
[["|", "0", "|", "|", "|"], ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---12---
---12--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---13---
---13--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---14---
---14--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "2", "|", "|"],
 ["|", "|", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 第13关
第13关 ---0---
---0--- [[1, 0, 0, 0, 2],
[[1, 0, 0, 0, 2], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [1, 0, 1, 0, 1]]
 [1, 0, 1, 0, 1]] ---1---
---1--- [["0", "|", "|", "1", "|"],
[["0", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "0", "|", "|"]]
 ["|", "1", "0", "|", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "1", "|"]]
 ["|", "0", "|", "1", "|"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"]]
 ["|", "|", "|", "0", "|"]] ---5---
---5--- [["|", "|", "|", "|", "0"],
[["|", "|", "|", "|", "0"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "2"],
 ["|", "|", "|", "|", "2"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "0"]]
 ["|", "1", "|", "|", "0"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"], ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "|", "|", "1", "|"],
 ["0", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---9---
---9--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---10---
---10--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---11---
---11--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---12---
---12--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---13---
---13--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---14---
---14--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "2", "0"],
 ["|", "|", "|", "2", "0"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---15---
---15--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "2", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---16---
---16--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "2", "0", "|"],
 ["|", "|", "2", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 第14关
第14关 ---0---
---0--- [[1, 0, 0, 0, 2],
[[1, 0, 0, 0, 2], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [1, 0, 1, 0, 1]]
 [1, 0, 1, 0, 1]] ---1---
---1--- [["0", "|", "|", "1", "|"],
[["0", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "0", "|", "|"]]
 ["|", "1", "0", "|", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "1", "|"]]
 ["|", "0", "|", "1", "|"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"]]
 ["|", "|", "|", "0", "|"]] ---5---
---5--- [["|", "|", "|", "|", "0"],
[["|", "|", "|", "|", "0"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "2"],
 ["|", "|", "|", "|", "2"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "0"]]
 ["|", "1", "|", "|", "0"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["1", "|", "|", "|", "|"],
 ["1", "|", "|", "|", "|"], ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "|", "|", "1", "|"],
 ["0", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---9---
---9--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---10---
---10--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---11---
---11--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---12---
---12--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "1", "|", "|"],
 ["|", "0", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---13---
---13--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "|"],
 ["|", "|", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---14---
---14--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "2", "0"],
 ["|", "|", "|", "2", "0"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---15---
---15--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "2", "|"],
 ["|", "|", "|", "2", "|"], ["|", "|", "|", "0", "|"],
 ["|", "|", "|", "0", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---16---
---16--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "2", "0", "|"],
 ["|", "|", "2", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] >Exit code: 0
>Exit code: 0 >ruby AI3.rb
>ruby AI3.rb ---0---
---0--- [[1, 0, 0, 0, 0],
[[1, 0, 0, 0, 0], [0, 0, 0, 1, 1],
 [0, 0, 0, 1, 1], [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [2, 0, 0, 1, 0]]
 [2, 0, 0, 1, 0]] ---1---
---1--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"]]
 ["|", "1", "|", "0", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["2", "|", "|", "|", "|"],
 ["2", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "|", "|", "|", "|"]]
 ["0", "|", "|", "|", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"],
 ["|", "1", "|", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "0"],
 ["|", "|", "1", "|", "0"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---5---
---5--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["0", "2", "|", "|", "|"],
 ["0", "2", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---9---
---9--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "1", "|"],
 ["|", "0", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---10---
---10--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"],
 ["|", "0", "|", "|", "|"], ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---11---
---11--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 第15关
第15关---0---
[[1, 1, 0, 0, 1],
[0, 0, 0, 0, 0],
[1, 0, 0, 0, 0],
[0, 0, 0, 0, 1],
[0, 2, 0, 0, 0]]
---1---
[["|", "|", "1", "|", "0"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---2---
[["|", "|", "|", "|", "|"],
["1", "|", "|", "|", "|"],
["0", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---3---
[["|", "0", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---4---
[["0", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---5---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "|", "1", "|"],
["|", "|", "|", "|", "|"]]
---6---
[["|", "0", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---7---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "1", "0", "|"],
["|", "|", "|", "|", "|"]]
---8---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "1", "0"],
["|", "|", "|", "|", "|"]]
---9---
[["|", "|", "|", "|", "|"],
["|", "|", "1", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "0", "|", "|"],
["|", "|", "|", "|", "|"]]
---10---
[["|", "|", "|", "|", "|"],
["|", "1", "0", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---11---
[["|", "|", "|", "|", "|"],
["|", "0", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---12---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "1", "|", "|"],
["|", "|", "|", "|", "|"]]
---13---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "2", "|", "|", "|"],
["|", "0", "|", "|", "|"]]
---14---
[["|", "|", "|", "|", "|"],
["|", "|", "1", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "0", "|", "|"],
["|", "|", "|", "|", "|"]]
---15---
[["|", "|", "|", "|", "|"],
["0", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---16---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "2", "|", "|"],
["|", "|", "|", "|", "|"]]
---17---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "2", "|", "|"],
["|", "|", "0", "|", "|"],
["|", "|", "|", "|", "|"]]

 第16关
第16关 ---0---
---0--- [[0, 1, 0, 0, 1],
[[0, 1, 0, 0, 1], [0, 0, 0, 0, 1],
 [0, 0, 0, 0, 1], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0], [2, 0, 0, 1, 1]]
 [2, 0, 0, 1, 1]] ---1---
---1--- [["|", "|", "1", "|", "0"],
[["|", "|", "1", "|", "0"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---2---
---2--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "1", "|", "0", "|"]]
 ["|", "1", "|", "0", "|"]] ---3---
---3--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "0"]]
 ["|", "|", "1", "|", "0"]] ---4---
---4--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "1", "|", "|", "|"],
 ["|", "1", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---5---
---5--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "|", "1", "|"],
 ["|", "0", "|", "1", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---6---
---6--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["0", "2", "|", "|", "|"]]
 ["0", "2", "|", "|", "|"]] ---7---
---7--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "2", "|", "|", "|"],
 ["|", "2", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "0", "|", "|", "|"]]
 ["|", "0", "|", "|", "|"]] ---8---
---8--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "1", "0", "|"],
 ["|", "|", "1", "0", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---9---
---9--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "|", "1", "0"],
 ["|", "|", "|", "1", "0"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---10---
---10--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "1", "|", "|"],
 ["|", "|", "1", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---11---
---11--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "0", "2", "|", "|"],
 ["|", "0", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]] ---12---
---12--- [["|", "|", "|", "|", "|"],
[["|", "|", "|", "|", "|"], ["|", "|", "0", "|", "|"],
 ["|", "|", "0", "|", "|"], ["|", "|", "2", "|", "|"],
 ["|", "|", "2", "|", "|"], ["|", "|", "|", "|", "|"],
 ["|", "|", "|", "|", "|"], ["|", "|", "|", "|", "|"]]
 ["|", "|", "|", "|", "|"]]
 第18关
第18关---0---
[[1, 0, 0, 1, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 2, 0],
[0, 0, 0, 0, 0],
[1, 1, 0, 0, 1]]
---1---
[["|", "1", "|", "0", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---2---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "1", "|", "0"]]
---3---
[["0", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["1", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]
---4---
[["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "|", "|", "|"]]
---5---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "0", "|", "|"]]
---6---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "1", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "0", "|", "|", "|"]]
---7---
[["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "2", "0", "|"],
["|", "|", "|", "|", "|"],
["|", "|", "|", "|", "|"]]

 
                     
                    
                 
                    
                 
 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号