# middle

## Description

Middle of rectangle

## Inputs

• Rectangle - X
• Rectangle - Y
• Rectangle - width
• Rectangle - height

## Outputs

• middle of rectangle - X
• middle of rectangle - Y

## Neuron type

Best algorithm has been found - locked

## Patterns

Pattern Input Output
1.
 Rectangle - X: 0 Rectangle - Y: 0 Rectangle - width: 0 Rectangle - height: 0
 middle of rectangle - X: 0 middle of rectangle - Y: 0
2.
 Rectangle - X: 1 Rectangle - Y: 4 Rectangle - width: 4 Rectangle - height: 2
 middle of rectangle - X: 3 middle of rectangle - Y: 5
3.
 Rectangle - X: 2 Rectangle - Y: 1 Rectangle - width: 1 Rectangle - height: 2
 middle of rectangle - X: 2.5 middle of rectangle - Y: 2

## Applicable neurons

• Plus (x + y)
• Minus (x - y)
• Multiple (x × y)
• Half (0.5)
• Pi (π) 3.14
• Rounding to whole thousands of something
• tag title
• Connect - five inputs
• (-∞, x]
• constant x.xxxx
• get seconds from time (hh:mm:ss)
• Is character uppercase?
• Check if a string ends with a specified string

## Algorithm

### Test

```/**
* character .:
*
* @return {Array}
*/
function neuron510()
{
return['.'];
}

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

/**
* Half (0.5):
*
* @return {Array}
*/
function neuron522()
{
var outputs = [];

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

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

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

return[outputs[2]];
}

/**
* Multiple (x × y):
*
* @param x1 Number X
* @param x2 Number Y
* @return {Array}
*/
function neuron3(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '*'+Number(x2)).toString()];
}

/**
* Plus (x + y): The addition of two whole numbers is the total amount of those quantities combined.
*
* @param x1 first number
* @param x2 second number
* @return {Array}
*/
function neuron1(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '+'+Number(x2)).toString()];
}

/**
* middle: Middle of rectangle
*
* @param x1 Rectangle - X
* @param x2 Rectangle - Y
* @param x3 Rectangle - width
* @param x4 Rectangle - height
* @return {Array}
*/
function neuron839(x1, x2, x3, x4)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;
outputs[2] = x3;
outputs[3] = x4;

arr = neuron522();
outputs[4] = arr[0];

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

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

arr = neuron1(outputs[6], outputs[1]);
outputs[7] = arr[0];

arr = neuron1(outputs[0], outputs[5]);
outputs[8] = arr[0];

return[outputs[8], outputs[7]];
}

```