The mission is in Reviewing Mode.
You can't see the solutions Leader Board, but you can see other user solutions through the Random Review after you solve the mission.
Combined Resistors.
The spaceship's crew is in serious trouble now since the electronic circuit board for warp-speed-engine-control has blown, they're stalled in outher space. A resistor on the cicuit board has turned into a pile of smoking carbon but luckily, someone found in the service documents what value it has to replace it with.
But after hours and hours searching thru the box with spare parts over and over, the horrified conclusion is that the requested resistor is not there.
However maybe . . . will they be able to make a combination of resistors which then will serve as a replacement and save their souls?
It is up to you now !
The Mission :
You have to write a function `combine: box, ohms → combination`
where `box` is a list of lists representing the box of spare parts, `ohms` the requested resistor and `combination` a list describing the wiring of the components in the folowing way :
Numbers in the combination list are series connected. Sub-lists however are parallel branches and can contain series connected components as well other sub-lists again.
Thus in each list: items are series and nested sub lists are parallel paths.
A few examples:
Fig.1: R1 series R2 = [1, 2]
Fig.2: R1 and R2 parallel = [[1], [2]]
Fig.3: R1 series (R2 parallel R3) = [1, [[2], [3]]
Fig.4: (R1 series R2) parallel (R3 series R4) = [[1, 2], [3, 4]]
Fig.5: (R1 parallel R3) series (R2 parallel R4) = [[1], [3]], [[2], [4]]]
The on the mission involved mathematics :
You can calculate the total resistance of two resistors (R1, R2) series connected (Rs) by:
Rs = R1 + R2
And the calculation for two resistors (R1, R2) parallel connected (Rp) is:
Rp = 1 / (1 / R1 + 1 / R2) Which can also be written as : Rp = R1 * R2 / (R1 + R2)
How it is used:
Electric circuitry.