def calc_area friends, enemies
- friends.each.with_index(1).with_object(Set.new){|((r, c), i), area_unit|
+ friends.each.with_index(1).with_object(Set.new){|((r, c), index), area_unit|
# 自分のy座標より大きいy座標の値を持ち、かつ同じx座標を持つ自陣営の駒を集める
- next unless y = friends[i..-1].select{|_,d|d == c}.map{|s,_|s}
+ next unless y = friends[index..-1].select{|_,d|d == c}.map{|s,_|s}
# 自分のx座標より大きいx座標の値を持ち、かつ同じy座標を持つ自陣営の駒を集める
- next unless x = friends[i..-1].select{|s,_|s == r}.map{|_,d|d}
+ next unless x = friends[index..-1].select{|s,_|s == r}.map{|_,d|d}
# 自陣営の中から上で集めたx,y座標と一致する駒を抜き出す
- z = get_opposite_angle friends, enemies, i, y, x
+ z = get_opposite_angle friends, enemies, index, y, x