     @puzzle_pattern = @puzzle.puzzle_pattern
     @grid = @puzzle_pattern.grid
     @hex_draw = @puzzle.hex_draw
+    @backgrounds = ["#cc9999","#adcc99","#99c2cc",
+                    "#c299cc","#ccad99","#99cc99",
+                    "#99adcc","#cc99c2","#ccc299",
+                    "#99ccad","#9999cc","#cc99ad",
+                    "#c2cc99","#99ccc2","#ad99cc"]
+
     @init_missing_pieces_mask()
 
 
-#  TODO TODO TODO TODO
-#  Change this class to build the mask from the hexes for the pieces in
-#  @puzzle.pz_status.unset_pieces.
-
   init_missing_pieces_mask: () ->
-    @missing = @puzzle.pz_status.all_pieces
+    @missing = []
+    @missing[p] = @puzzle.pz_status.all_pieces[p] for p in [0..15]
+    @start_color_cycle()
+    @puzzle.puzzle_view.draw_photo()
+
+
+  reset_mask: () ->
+    @puzzle.puzzle_view.draw_photo()
+    @get_next_color()
+    @draw_mask()
+
+
+  start_color_cycle: () ->
+    if Math.floor(2*Math.random()) > 1
+      @color_direction = "up"
+    else
+      @color_direction = "down"
+    @color_number = Math.floor(15*Math.random())
+    @color = @backgrounds[@color_number]
+
+
+  get_next_color: () ->
+    switch @color_direction
+      when "up"
+        if @color_number == 14 then @color_number = 0 else @color_number += 1
+      when "down"
+        if @color_number == 0 then @color_number = 14 else @color_number -= 1
+    @color = @backgrounds[@color_number]
 
 
   draw_mask: () ->
     @hex_draw.set_context("canvas")
     for bb in [1..10]
       for aa in [1..24]
-        @hex_draw.fill_hex_ab(aa,bb,0) if @grid[bb][aa] in @missing
+        @hex_draw.fill_hex_ab(aa,bb,@color) if @grid[bb][aa] in @puzzle.pz_status.unset_pieces
 
 
 

    @redraw = new PieceRedrawBuffer(this)
    @hexes = []
    @bounding_box = [0,0,0,0,]
    @log_hexes = false


  construct_piece: (sym) ->



  puzzle_finished: () ->
    @puzzle.puzzle_view.draw_photo()
    alert("Puzzle finished")


  next_piece: () ->
    @puzzle.mask.reset_mask()
    pc = Math.floor(@pieces_in_puzzle*Math.random())
    @sym = @unset_pieces[pc]
    @unset_pieces.splice(@unset_pieces.indexOf(@sym),1)
