   }
 }
 
-sizes = {
+presetSizes = {
   'small': {
     'x':80
     'y':68


  randomizeThangs: (presetName, presetSize) ->
    preset = presets[presetName]
    presetSize = sizes[presetSize]
    @thangs = []
    @randomizeFloor preset, presetSize
    @randomizeBorder preset, presetSize
    @randomizeDecorations preset, presetSize

  randomizeFloor: (preset, presetSize) ->
    for i in _.range(0, presetSize.x, sizes.floorSize.x)
      for j in _.range(0, presetSize.y, sizes.floorSize.y)
        @thangs.push {
          'id': @getRandomThang(preset.floors)
          'pos': {
            'x': i + sizes.floorSize.x/2
            'y': j + sizes.floorSize.y/2
          }
        }

  randomizeBorder: (preset, presetSize) ->
    for i in _.range(0, presetSize.x, sizes.borderSize.x)
      for j in _.range(sizes.borderSize.thickness)
        @thangs.push {
          'id': @getRandomThang(preset.borders)
          'pos': {
            'x': i + _.random(-sizes.borderSize.x/2, sizes.borderSize.x/2)
            'y': 0 + _.random(-sizes.borderSize.y/2, sizes.borderSize.y)
          }
        }
        @thangs.push {
          'id': @getRandomThang(preset.borders)
          'pos': {
            'x': i + _.random(-sizes.borderSize.x/2, sizes.borderSize.x/2)
            'y': presetSize.y + _.random(-sizes.borderSize.y, sizes.borderSize.y/2)
          }
        }

    for i in _.range(0, presetSize.y, sizes.borderSize.y)
      for j in _.range(3)
        @thangs.push {
          'id': @getRandomThang(preset.borders)
          'pos': {
            'x': 0 + _.random(-sizes.borderSize.x/2, sizes.borderSize.x)
            'y': i + _.random(-sizes.borderSize.y/2, sizes.borderSize.y/2)
          }
        }
        @thangs.push {
          'id': @getRandomThang(preset.borders)
          'pos': {
            'x': presetSize.x + _.random(-sizes.borderSize.x, sizes.borderSize.x/2)
            'y': i + _.random(-sizes.borderSize.y/2, sizes.borderSize.y/2)
          }
        }


    'x':160
    'y':136
  }
}

thangSizes = {
  'floorSize': {
    'x':20
    'y':17
