The Let's Play Archive

SpaceChem (2013 Tournament)

by Wild M

Part 16: Other Things - "Random" Inputs by Prenton

Warning: the following post contains



From what everyone's saying, it looks like Spacechem's 'random' streams are generated by taking 12 entries



permuting them ( randomly picking one of them for the first entry, then picking one of the 11 remaining ones for the second, etc, leaving 12! - the factorial, 479001600 - possible sequences )



then assigning them to chemicals according to the weightings. So, for Reppe, we could assign 1-4 to water, 5-8 to CO, and 9-12 to acetylene.



This actually leaves us with 12!/4!/4!/4! = 34650 possible 12-input sequences for Reppe, as you can could swap 1/2/3/4 around (as they're all water) without affecting the final sequence, and the same with the other 2 chemicals. Also, note the the longest run we can get of any particular chemical now is 8 - by ending one group of 12 with 4, then starting the next one with 4.

My 2 reactor Reppe solution used 1 reactor to move the water into one output, and debonds CO/HCCH a bit and then send them to the other output.

Then, the second reactor clocked the CO/HCCH input four times, putting them on separate stacks. After four times it hopefully has at least one of each of CO and HCCH on the stacks, so it throws away any excess, pulls in a water, and constructs the final result. This shouldn't have worked with a fair stream. The 16 equally likely input combinations are

AAAA
AAAB
AABA
AABB
ABAA
ABAB
ABBA
ABBB
BAAA
BAAB
BABA
BABB
BBAA
BBAB
BBBA
BBBB

The first and last entries will fail as one of the needed chemicals is missing, so there's only a 7/8 chance of success for each final output. Getting lucky 40 times means the chance of completing the puzzle is (7/8)^40, which works out as less than 0.5%. I'm not that lucky.

However, with Spacechem's random numbers - after pulling the 4 waters out - there are 8!/4!/4! = 70 possible sequences of 8 CO/HCCH sent to the second reactor. Of these, there's only 2 that will fail

AAAABBBB
BBBBAAAA

and the successful ones produce 2 correct outputs, so the chance of completion is (68/70)^20, about 56%.

In short: Spacechem's RNG means that things might be over 100 times more (un)likely than you'd expect.