convert hours, minutes and seconds into HH:MM:SS

Inputs

  • hours
  • minutes
  • seconds

Outputs

  • HH:MM:SS

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
hours: 0
minutes: 1
seconds: 2
HH:MM:SS: 00:01:02
2.
hours: 10
minutes: 20
seconds: 30
HH:MM:SS: 10:20:30
3.
hours: 3
minutes: 20
seconds: 3
HH:MM:SS: 03:20:03

Applicable neurons

  • Connect - three inputs
  • character :
  • insert zero at the beginning, in case of one character
  • convert minutes and seconds into MM:SS
  • Rectangle - content
  • Rectangle - circuit
  • Rounding to whole tenths of something
  • tag title
  • Get first word
  • a + b; a - b
  • convert seconds into MM:SS
  • IfNull

Algorithm

Test

Code made by AI:
/**
 * 8: 
 *
 * @return {Array}
 */
function neuron508()
{
return [8];
}

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

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

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

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

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

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

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

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

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

  return[outputs[4]];
}


/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

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

/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

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

/**
 * a = b: IF a=b THEN 1 ELSE 0;
 *
 * @param x1 a
 * @param x2 b
 * @return {Array}
 */
function neuron591(x1, x2)
{
return [(x1 == x2) ? 1 : 0];
}

/**
 * IF: IF a THEN b ELSE c;
 *
 * @param x1 condition (1/0)
 * @param x2 variable for 1
 * @param x3 variable for 0
 * @return {Array}
 */
function neuron579(x1, x2, x3)
{
return [(x1) ? x2 : x3];
}

/**
 * IF a=b THEN c ELSE d: 
 * 
 * @param x1 a
 * @param x2 b
 * @param x3 c
 * @param x4 d
 * @return {Array}
 */
function neuron724(x1, x2, x3, x4)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;
  outputs[3] = x4;

  arr = neuron591(outputs[1], outputs[0]);
  outputs[4] = arr[0];

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

  return[outputs[5]];
}


/**
 * insert zero at the beginning, in case of one character: 
 * 
 * @param x1 number with 1 or 2 digits
 * @return {Array}
 */
function neuron738(x1)
{
  var outputs = [];
  outputs[0] = x1;

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

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

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

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

  arr = neuron724(outputs[3], outputs[1], outputs[4], outputs[0]);
  outputs[5] = arr[0];

  return[outputs[5]];
}


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


/**
 * convert minutes and seconds into MM:SS: 
 * 
 * @param x1 minutes
 * @param x2 seconds
 * @return {Array}
 */
function neuron739(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

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

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

  arr = neuron738(outputs[1]);
  outputs[4] = arr[0];

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

  return[outputs[5]];
}


/**
 * convert hours, minutes and seconds into HH:MM:SS: 
 * 
 * @param x1 hours
 * @param x2 minutes
 * @param x3 seconds
 * @return {Array}
 */
function neuron740(x1, x2, x3)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;
  outputs[2] = x3;

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

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

  return[outputs[4]];
}


Code made by AI:

Create your family tree for free