 turn_bug = (bug, offset) ->
   bug.direction = (((bug.direction + offset) % 4) + 4) % 4
 
-add_bug_to_canvas = (canvas, bug) ->
-  x   = bug.location.x * 10
-  y   = bug.location.y * 10
+add_bug_to_canvas = (canvas, bug, bug_size) ->
+  x   = bug.location.x * bug_size
+  y   = bug.location.y * bug_size
   pos = switch bug.direction
-    when 0 then left: x,      top: y,      angle:   0
-    when 1 then left: x + 10, top: y,      angle:  90
-    when 2 then left: x + 10, top: y + 10, angle: 180
-    when 3 then left: x,      top: y + 10, angle: 270
+    when 0 then left: x,            top: y,            angle:   0
+    when 1 then left: x + bug_size, top: y,            angle:  90
+    when 2 then left: x + bug_size, top: y + bug_size, angle: 180
+    when 3 then left: x,            top: y + bug_size, angle: 270
 
   if bug.prev_name == bug.name
     if bug.canvas_img

    next_color:  ['black', 'yellow', 'blue', 'grey', 'pink', 'green', 'red']
    turns:       0
    count:       0

  for i in [0..10]
    add_bug bugs, 'fly_trap', create_fly_trap

  for i in [0..10]
    add_bug bugs, 'moth1', create_moth

  for i in [0..10]
    add_bug bugs, 'moth2', create_moth

  bugs


  fabric.Object.prototype.transparentCorners = false

  width     = 60 # Number of bugs
  height    = 40 # Number of bugs
  bug_size  = 10 # pixels
  max_turns = 1000

  canvas.setHeight height * bug_size
  canvas.setWidth  width  * bug_size

  bugs  = starting_bugs(bug_size, width, height, max_turns)
  render_game canvas, bugs

  next_turn bugs, canvas
