# Destroyed building (calculation, windows, walls)

## Inputs

• Price of calculation
• Are windows defective? (1/0)
• Price of repair windows
• Are walls defective? (1/0)
• Price of repair walls

## Outputs

• Price of repairs

## Neuron type

Best algorithm has been found - locked

## Patterns

Pattern Input Output
1.
 Price of calculation: 10 Are windows defective? (1/0): 0 Price of repair windows: 500 Are walls defective? (1/0): 0 Price of repair walls: 700
 Price of repairs: 10
2.
 Price of calculation: 12 Are windows defective? (1/0): 1 Price of repair windows: 700 Are walls defective? (1/0): 0 Price of repair walls: 1200
 Price of repairs: 712
3.
 Price of calculation: 7 Are windows defective? (1/0): 1 Price of repair windows: 20 Are walls defective? (1/0): 1 Price of repair walls: 30
 Price of repairs: 57
4.
 Price of calculation: 2 Are windows defective? (1/0): 0 Price of repair windows: 50 Are walls defective? (1/0): 1 Price of repair walls: 60
 Price of repairs: 62

## Applicable neurons

• Plus (x + y)
• Destroyed building (windows, walls)
• Compound interest: annual compounding
• character t
• before decimal point
• Partner XY
• get day from date (yyyy-mm-dd)
• Is character uppercase?

## Algorithm

### Test

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

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

/**
* Destroyed building (windows):
*
* @param x1 Are windows defective? (1/0)
* @param x2 Price of repair windows
* @return {Array}
*/
function neuron598(x1, x2)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;

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

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

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

return[outputs[4]];
}

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

/**
* Destroyed building (windows, walls):
*
* @param x1 Are windows defective? (1/0)
* @param x2 Price of repair windows
* @param x3 Are walls defective? (1/0)
* @param x4 Price of repair walls
* @return {Array}
*/
function neuron599(x1, x2, x3, x4)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;
outputs[2] = x3;
outputs[3] = x4;

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

arr = neuron598(outputs[0], outputs[1]);
outputs[5] = arr[0];

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

return[outputs[6]];
}

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

/**
* Destroyed building (calculation, windows, walls):
*
* @param x1 Price of calculation
* @param x2 Are windows defective? (1/0)
* @param x3 Price of repair windows
* @param x4 Are walls defective? (1/0)
* @param x5 Price of repair walls
* @return {Array}
*/
function neuron600(x1, x2, x3, x4, x5)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;
outputs[2] = x3;
outputs[3] = x4;
outputs[4] = x5;

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

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

return[outputs[6]];
}

```