 
 
   mouseOverHandler: (evt) =>
-    if not game.state.is StateManager.GameOver
+    if not game.state is States.GameOver
       @tileBackground.attr fill: '#ccc'
 
 
   mouseOutHandler: (evt) =>
-    if not game.state.is StateManager.GameOver
+    if not game.state is States.GameOver
       @tileBackground.attr fill: '#ddd'
 
 
   mouseUpHandler: (evt) =>
-    return if game.state.is StateManager.GameOver
-    if game.state.is StateManager.Empty
+    return if game.state is States.GameOver
+    if game.state is States.Empty
       if evt.button is 0 # Left click
         game.initGame @x, @y
 
-    if game.state.is StateManager.Playing
+    if game.state is States.Playing
       if evt.button is 2 # Right click
         casePosition = game.positionFromCoord @x, @y
         game.board.cases[casePosition].g.remove()



  mouseUpHandler: (evt) =>
    if game.state.is StateManager.Playing
      if game.safe is game.board.cases.length - game.nbMines
        game.win()
        return
      if game.willDie isnt false
        game.gameOver(game.willDie)
    else if game.state.is StateManager.Win
      game.reset()
      game.state.set StateManager.Empty
    else if game.state.is StateManager.GameOver
      game.reset()
      game.state.set StateManager.Empty


  createBoard: () ->

    @board.reset()


class States
  @Empty = 0
  @Playing = 1
  @GameOver = 2
