 #   play : Action -> State
 # }
 
+Limit = 2000000000 # two billion, faster than using Infinity
+
 class MinimaxAgent
-  constructor: (@depth = Infinity) ->
+  constructor: (@depth = Limit) ->
     @rootAgent = MAX
 
   # nextAction :: (state:State) -> Action

    [_, bestAction] = @minimax state
    bestAction

  minimax: (state, α = -Infinity, β = +Infinity, ply = 0) ->
    isTerminal = state.isTerminal()
    ++ply if not isTerminal and state.nextAgent() is @rootAgent
    if ply > @depth or isTerminal

# MINIMAX

[MAX, MIN] = [1, 2]

# Action :: Any

