Get value from knowbase

Inputs

  • subject
  • key

Outputs

  • value

Algorithm

/**
 * Get value from knowbase: 
 *
 * @param x1 subject
 * @param x2 key
 * @return {Array}
 */
function neuron801(x1, x2)
{
var url = "/ajax-search?subject="+x1.toString()+"&key="+x2.toString();

if (ai_g_kb.exists(url)) 
  {return [ai_g_kb.get(url)];}
if (ai_g_kb.getCount()>=20) 
  {return 'error';}
var data = $.ajax({
url: url,
async: false
   }).responseText;
value = $.parseJSON(data).value;
ai_g_kb.add(url, value);
return [value];
}

console.log(neuron801(960, 189));

Create your family tree for free