     @setState baru
 
   handleResetButton: ->
-    @setState
-      set: []
+    @setState set: []
 
   handlePlayButton: ->
-    {range} = @state
-    if range isnt ''
+    {range, maxLies} = @state
+    if range isnt '' && maxLies isnt ''
       @setState
         set: [[[1, range, Yes], [1, range, 0]]]
+        maxLies: min(16, max(0, maxLies))
 
   handleSubmitButton: ->
     if not @queryValidator()

  render: ->
    dom 'section', className: 'row',
      dom 'span', className: 'five columns',
        dom 'div', {},
          dom 'label', {}, 'Range [1-n]'
          dom 'input',
            type: 'text'
            name: 'range'
            onChange: @handleInputNumberChange
            value: @state.range
            disabled: @state.set.length isnt 0
          dom 'i', {}, ' '
          if @state.set.length is 0
            dom 'button',
              type: 'button'
              className: 'button-primary'
              onClick: @handlePlayButton
              'Start'
          else
            dom 'button',
              type: 'button'
              className: 'button-danger'
              onClick: @handleResetButton
              'Restart'

        # Query game
        dom 'hr'


  getInitialState: ->
    set: [] # truth set and lie set

    # input values
    range: 1000
    maxLies: 2 # maximal number of lies
    qa: 1 # query start
    qb: 500 # query end
    qx: No # query answer

  componentDidMount: ->
    # @handlePlayButton()

  handleInputNumberChange: (event)->
    value = parseInt(event.target.value)
