 
 
   gameOver: (deadPosition) =>
-    @state.set StateManager.GameOver
+    @state = States.GameOver
     @showMines(deadPosition)
 
 
   win: () ->
-    @state.set StateManager.Win
+    @state =States.Win
     background = @board.board.rect 0, 0, 42*19, 42*13
     background.attr fill: 'rgba(255, 255, 255, 0.7)'
     winLbl = @board.board.text 42*19/2, 42*13/2, 'Win'



  initGame: (x, y) ->
    @state.set StateManager.Playing
    @generateBoard x, y




class @Game
  constructor: (id) ->
    @state = States.Empty
    @entities = Empty: 0, Mine: 1, Flag: 2
    @nbMines = 50
    @flags = 0
