     hx_top = 12
     hx_bottom = 0
 
+    @hexes = @piece.hexes
     for hx in @hexes
       aa = hx[0]
       bb = hx[1]


  constructor: (piece) ->
    @piece = piece
    @hexes = @piece.hexes
    @hex_draw = @piece.puzzle.hex_draw
    @img = document.createElement('canvas')
    @img.width = @piece.box.width
    @img.height = @piece.box.height
    @draw_pattern()


  draw_pattern: () ->
    for hx in @hexes
      aa = hx[0]
      bb = hx[1]
      @hex_draw.fillhex_ab_xy(aa,bb,10,100,3)



class PieceImage

draw_piece:  (a,b) ->
    @pc_img = document.getElementById("piece")
    if @grid_model.in_range(a,b)
      xy = @grid_model.get_xy(a,b)

  construct_piece: (sym) ->
    @sym = sym
    @hexes = @get_hexes()
    @box.set_box_dimensions()
    @p_mask.draw_pattern()


  get_hexes: () ->
    hexes = []
    for bb in [1..10]
      for aa in [1..24]
        hexes.push([aa,bb]) if @puzzle.pattern.grid[bb][aa] == @sym
    console.log("PIECE ID: "+@sym)
    console.log("    "+hx[0]+","+hx[1]) for hx in hexes
    hexes
