 
     @tileBackground.attr fill: '#fff'
     text = @ctx.text @size/2, @size/2, @number
-    text.attr fontFamily: 'Arial', fontSize: 38, alignmentBaseline: 'central', textAnchor: 'middle', fill: @colors[@number-1]
+    text.attr
+      fontFamily: 'Arial', fontSize: 38, alignmentBaseline: 'central',
+      textAnchor: 'middle', fill: @colors[@number-1]
     @g.append text
 
 

  countMines: () ->
    nbMines = 0
    for [x, y] in game.neighborCoord @x, @y
      nbMines++ if game.data[game.positionFromCoord(x, y)] is game.entities.Mine
    return nbMines

  countFlags: () ->
    nbFlags = 0
    for [x, y] in game.neighborCoord @x, @y
      nbFlags++ if game.board.cases[game.positionFromCoord(x, y)].constructor is Flag
    return nbFlags


class TextCase extends Case
  constructor: (@ctx, @x, @y, @number) ->
    @colors = ['blue', 'green', 'red', 'navy', 'maroon', 'aqua', 'purple', 'black']

    super
    @g.unmouseover()


  around: (idx, x, y) ->
    neighbors = @neighborCoord x, y
    neighborsIdx = [@positionFromCoord(item[0], item[1]) for item in neighbors]

    return idx in neighborsIdx[0] or
           idx is @positionFromCoord(x, y) or
           @data[idx] is @entities.Mine

