# Class Riddler
## The problem
```
$ python -m classic help
The astronomers of Planet Xiddler are back in action! Unfortunately,
this time they have used their telescopes to spot an armada of
hostile alien warships on a direct course for Xiddler. The armada
will be arriving in exactly 100 days. (Recall that, like Earth,
there are 24 hours in a Xiddler day.)
Fortunately, Xiddler’s engineers have just completed construction of
the planet’s first assembler, which is capable of producing any
object. An assembler can be used to build a space fighter to defend
the planet, which takes one hour to produce. An assembler can also
be used to build another assembler (which, in turn, can build other
space fighters or assemblers). However, building an assembler is
more time-consuming, requiring six whole days. Also, you cannot use
multiple assemblers to build one space fighter or assembler in a
shorter period of time.
What is the greatest number of space fighters the Xiddlerian fleet
can have when the alien armada arrives?
```
## My assumption
It is always preferable to front-load assembler production.
While an assembler could be produced at any point in time, it is always
preferable to gain the multiplicative effect earlier.
If an assembler is set to produce fighters, it should never produce
assemblers again, because it would have been more efficient to produce that
assembler earlier.
Furthermore, if an assembler to set to produce fighters, in the next cycle
all assemblers will be set to produce fighters.
Essentially, the problem is *when to switch production from assemblers to
fighters*.
This also reduces the complexity of the problem. Instead of *hour-by-hour*
choices, the strategies will be formed by *blocks of 6 days* (the time
required to produce an assembler).
As an example, there are two strategies to produce 4 assemblers.
1. One assembler spends (18 * 24 =) 432 hours producing assemblers.
The second and third assemblers will, upon their independent creation at
the 144 and 288 hours marks, begin producing fighters.
That is 288 and 144 fighters respectively, for a sum of 432.
The yield is 4 assemblers and 432 fighters in 432 hours.
2. The first assembler spends (12 * 24 =) 288 hours producing assemblers
and, upon creation at the 144 hour mark, the second assembler spends 144
hours producing assemblers.
The yield is 4 assemblers and 0 fighters in 288 hours.
However, strategy #2 is trivially superior to #1. In the unconsumed 144 hours
4 assemblers will produce (4 * 6 * 24 =) 576 fighters.
## My solution
```
$ python -m classic
Built 7864320 fighters with 32768 assemblers
* 0 fighters were built concurrent to the assemblers
* 7864320 fighters were built in the unconsumed 240 hours
```
See also `python -m classic test` and `python -m classic dump`.