   ])
   battle_field.add_terrain(HomeTerrain, 240, 480)
 
+  document.battle_field = battle_field
+
   ui = new UI(battle_field)
   # ui.reset_zindex()
 


class Terrain extends BattleFieldObject
  enterable: (battle_field_object) -> false
  destroyable: (missile) -> false

class BrickTerrain extends Terrain
  destroyable: (missile) -> missile.power >= 1
  type: -> "brick"

class IronTerrain extends Terrain
  destroyable: (missile) -> missile.power >= 2
  type: -> "iron"

class WaterTerrain extends Terrain

  space_collide: (x1, y1, x2, y2) ->
    [x3, y3, x4, y4] = @space()
    return false if (x4 <= x1 or y4 <= y1 or x3 >= x2 or y3 >= y2)
    @_insect(x1, y1, x2, y2, x3, y3, x4, y4)
  joint: (x1, y1, x2, y2) ->
    [x3, y3, x4, y4] = @space()
    [_.max(x1, x3), _.max(y1, y3), _.min(x2, x4), _.min(y2, y4)]
  space_sub: (x1, y1, x2, y2) ->
    [x3, y3, x4, y4] = @space()
    [x5, y5, x6, y6] = @joint(x1, y1, x2, y2)
    candidates = [
      [x3, y3, x4, y5],
      [x3, y6, x4, y4],
      [x3, y5, x5, y6],
      [x6, y5, x4, y6]
    ]
    _.reject(candidates, (sub_space) ->
      [x1, y1, x2, y2] = sub_space
      x1 == x2 or y1 == y2
    )
  set_display_object: (@display_object) ->
  update: () ->
  integration: (delta_time) ->
  handle_destroy: () ->
    @battle_field.remove_battle_field_object(this)
  on_hit_missile: (missile, destroy_area) -> 0

class MovableBattleFieldObject extends BattleFieldObject
  x: () ->
