The Banach–Tarski paradox states that, given a ball in 3‑dimensional space, you can decompose the ball into a finite number of point subsets. These disjoint sets of points can then be reassembled to produce two copies of the initial ball. You would then, theoretically, have two identical balls.
The process of reassembly consists of only moving the aforementioned point subsets and rotating them, while not changing their spacial shape. This can be done with as few as five disjoint subsets.
Disjoint sets have no common elements by definition. Where A
and B
are any two point subsets of the initial ball, the common elements between A
and B
is an empty set. This is shown in the following equation.
For the disjoint sets below, the common members form an empty set.
The Challenge
Write a program that can take an input ASCII "ball", and output a duplicate "ball".
Input
Here is an example input ball:
##########
###@%$*.&.%%!###
##!$,%&?,?*?.*@!##
##&**!,$%$@@?@*@&&##
#@&$?@!%$*%,.?@?.@&@,#
#,..,.$&*?!$$@%%,**&&#
##.!?@*.%?!*&$!%&?##
##!&?$?&.!,?!&!%##
###,@$*&@*,%*###
##########
Each sphere is outlined by pound signs (#
) and filled with any of theses characters: .,?*&$@!%
. Every input will be a 22x10 characters (width by height).
Creating a Duplicate
First, each point inside the ball is given a numbered point based on its index in .,?*&$@!%
. Here is the above example, once numbered:
##########
###7964151998###
##86295323431478##
##5448269677374755##
#75637896492137317572#
#21121654386679924455#
##1837419384568953##
##85363518238589##
###2764574294###
##########
Then, each point is shifted up one (nine goes to one):
##########
###8175262119###
##97316434542589##
##6559371788485866##
#86748917513248428683#
#32232765497781135566#
##2948521495679164##
##96474629349691##
###3875685315###
##########
Finally, each new point value is converted back to its corresponding character:
##########
###!.@&,$,..%###
##%@?.$*?*&*,&!%##
##$&&%?@.@!!*!&!$$##
#!$@*!%.@&.?,*!*,!$!?#
#?,,?,@$&*%@@!..?&&$$#
##,%*!&,.*%&$@%.$*##
##%$*@*$,%?*%$%.##
###?!@&$!&?.&###
##########
Output
These two balls are then output side-by-side, in this form (separated by four spaces at the equators):
########## ##########
###@%$*.&.%%!### ###!.@&,$,..%###
##!$,%&?,?*?.*@!## ##%@?.$*?*&*,&!%##
##&**!,$%$@@?@*@&&## ##$&&%?@.@!!*!&!$$##
#@&$?@!%$*%,.?@?.@&@,# #!$@*!%.@&.?,*!*,!$!?#
#,..,.$&*?!$$@%%,**&&# #?,,?,@$&*%@@!..?&&$$#
##.!?@*.%?!*&$!%&?## ##,%*!&,.*%&$@%.$*##
##!&?$?&.!,?!&!%## ##%$*@*$,%?*%$%.##
###,@$*&@*,%*### ###?!@&$!&?.&###
########## ##########
Note: Shifting the point values, and later characters, is symbolic of the rotations performed to reassemble the point subsets (character groupings).