ick', function(){ button_state = -1.0; })
    }
  }

  d3.select('#subbtn').on('click', function(){
    var r = 0;
    for(var i=0;i<checkboxData.elems;i++) {
      var is_checked = d3.select('#ch'+i)[0][0].checked;
      r += is_checked === checkboxData.toclick[i] ? 1.0 : -1.0;
    }
    if (button_state == 1){
      core.endEpisode(r == checkboxData.elems ? 1.0 : -1.0, true);
    }
    else{
      core.endEpisode(-1.0, true);
    }
  });
 

  // generate query text in the UI
  // d3.select('#query').html(