Capital and largest city

Inputs

  • Name of territory

Outputs

  • Capital and largest city

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
Name of territory: France
Capital and largest city: Paris
2.
Name of territory: Italy
Capital and largest city: Rome
3.
Name of territory: Poland
Capital and largest city: Warsaw

Applicable neurons

  • Get before substring
  • Get value from knowbase
  • constant Capital and largest city
  • character ;
  • 100
  • Insert html to tag
  • character ?
  • Hello world.
  • convert seconds into MM:SS
  • character !
  • \\b
  • character j

Algorithm

Test

Code made by AI:
/**
 * constant Capital and largest city: 
 *
 * @return {Array}
 */
function neuron811()
{
return ["Capital and largest city"]
}

/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * 5: 
 *
 * @return {Array}
 */
function neuron505()
{
return [5];
}

/**
 * 9: 
 *
 * @return {Array}
 */
function neuron509()
{
return [9];
}

/**
 * Connect - two inputs: 
 *
 * @param x1 Variable A
 * @param x2 Variable B
 * @return {Array}
 */
function neuron520(x1, x2)
{
return [x1.toString()+x2.toString()];
}

/**
 * Connect - three inputs: Connect stringA + stringB + stringC
 * 
 * @param x1 string A
 * @param x2 string B
 * @param x3 string C
 * @return {Array}
 */
function neuron564(x1, x2, x3)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;

  arr = neuron520(outputs[1], outputs[2]);
  outputs[3] = arr[0];

  arr = neuron520(outputs[0], outputs[3]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * Ascii code into character: 
 *
 * @param x1 ascii code
 * @return {Array}
 */
function neuron585(x1)
{
return [String.fromCharCode(x1)];
}

/**
 * 3 digits of ascii code into character: connect 3 digits to one ascii number and change it to character
 * 
 * @param x1 1. digit
 * @param x2 2. digit
 * @param x3 3. digit
 * @return {Array}
 */
function neuron638(x1, x2, x3)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;

  arr = neuron564(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  arr = neuron585(outputs[3]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * character ;: 
 * 
 * @return {Array}
 */
function neuron814()
{
  var outputs = [];

  arr = neuron500();
  outputs[0] = arr[0];

  arr = neuron505();
  outputs[1] = arr[0];

  arr = neuron509();
  outputs[2] = arr[0];

  arr = neuron638(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * 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];
}

/**
 * Position: Search position substring of string
 *
 * @param x1 MyString
 * @param x2 FindMe
 * @return {Array}
 */
function neuron523(x1, x2)
{
return [x1.toString().indexOf(x2.toString())];
}

/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Get before substring: 
 * 
 * @param x1 MyString
 * @param x2 Substring
 * @return {Array}
 */
function neuron532(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron523(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron500();
  outputs[3] = arr[0];

  arr = neuron525(outputs[0], outputs[2], outputs[3]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


/**
 * Capital and largest city: 
 * 
 * @param x1 Name of territory
 * @return {Array}
 */
function neuron812(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron811();
  outputs[1] = arr[0];

  arr = neuron814();
  outputs[2] = arr[0];

  arr = neuron801(outputs[0], outputs[1]);
  outputs[3] = arr[0];

  arr = neuron532(outputs[3], outputs[2]);
  outputs[4] = arr[0];

  return[outputs[4]];
}


Code made by AI:

Create your family tree for free