Mind Switcher Mind Switcher
Moderate
English RU FR

- Oh no! Is it possible to get everyone back to normal using four or more bodies?

- I'm not sure. I'm afraid we need to use... MATH .

"Futurama" - Season 6 Episode 10 - "The Prisoner of Benda"

Sophia's drones are simple robots which do dangerous work. Just in case one breaks, Sophia has a backup machine for these drones. This machine can copy a robots mind and has a secret and undocumented function. The backup machine can also operate as a mind switcher for robots.

Sophia forgot to turn off the machine and left the drones in the same room. When she had returned some drones already swapped their minds with each other. We should help them to return to their original bodies as their current state voids the manufacturer warranty.

We have a log from the machine, of which drones minds were swapped. There is however one slight problem - no pair of bodies can swap minds more than once. However, with two additional bodies we can return the switching chaos back to a normal state of things. Nikola and Sophia have offered to help us ("nikola" and "sophia").

You are given an array with with information about the recent swaps. Each entry is a set with two names of robots (bodies). You can operate with bodies which were written in the journal and with two additional bodies - "nikola" and "sophia". Find the sequence of the swaps required to return all minds to their original bodies. The result should be represented as a list/tuple of sets with two names in each.

Input: A journal as a tuple of sets. Each set contains two strings.

Output: The sequence of actions as a list/tuple of sets. Each set contains two strings.

Example:

mind_switcher(({"scout", "super"},)) == ({"super", "nikola"}, {"sophia", "scout"},
                                         {"nikola", "scout"}, {"sophia", "super"},
                                         {"nikola", "sophia"})

    

How it is used: The theorem from this mission is based on group theory. And group theory has application in cryptography, physics and chemistry.

Precondition:
0 < len(journal) ≤ 55
Journal is correct.

Sources: Cohen, David (2010). Futurama volume 5 DVD episode 10 "The Prisoner of Benda" (DVD). 20th Century Fox.

Settings
Code:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

×
 
 
<< <
> >>
exec

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Share your own solution
Go to the next mission Back to the list of missions Back to the map