 
   for bug in bug_list
     move_bug bugs, bug
+
+  bugs.names.map (name) ->
+    count = bug_list.reduce(
+      ((sum, bug) -> if bug.name == name then sum + 1 else sum), 0)
+    bugs.stats[name].push
+      iteration: bugs.turns
+      count:     count
+      name:      name
 
 info_at_location = (grid, bug, x, y) ->
   info = if x < 0 or y < 0 or x == 59 or y == 39

  canvas.setHeight  400
  canvas.setWidth  600

  turns = 0
  bugs  = starting_bugs()
  render_game canvas, bugs

  next_turn bugs, canvas, turns
  make_chart '#jitterbug_progress_chart_svg'

next_turn = (bugs, canvas, turns) ->
  next_iteration bugs
  render_game canvas, bugs

  if turns < 1000
    setTimeout((-> next_turn bugs, canvas, turns + 1), 50)

empty_grid = ->
  grid = []

    color:     color
    serial:    (bugs.next_serial += 1)

  unless bugs.stats[name]?
    bugs.stats[name] = [{iteration: 0, count: 0, name: name}]
    bugs.names.push name

  bugs.stats[name][0].count += 1

random_location = (bugs) ->
  x = random_num 59
  y = random_num 39
