 
 
   positionFromCoord: (x, y) ->
-    position = x + y * game.board.nbHorizontalCases
+    position = x + y * @board.nbHorizontalCases
 
 
   isValidPosition: (x, y) ->


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


  generateBoard: (x, y) ->

    for i in [0...@data.length]
      if @data[i] is @entities.Mine
        [x, y] = @coordFromPosition(i)
        @board.cases[i].g.remove()
        if i is deadPosition
          @board.cases[i] = new ExplodedMine @board.board, x, y
        else
          if @board.cases[i].constructor is Flag
            @board.cases[i] = new FlaggedMine @board.board, x, y
          else
            @board.cases[i] = new Mine @board.board, x, y

    for i in [0...@board.cases.length]
      if @board.cases[i].constructor is Flag and @data[i] isnt @entities.Mine
