# An old square castle with many square rooms

The grandfather of my friend Bob has built a perfect square castle for himself and his family and divided it into 9 perfect square halls and made an armoury in the middle one.

Bob's father divided each of the remaining 8 halls into another 9 perfect square halls and in each middle one he made a garden.

Bob himself divided each of the remaining 64 halls into 9 perfect square halls and in each middle one he made a swimming pool and the rest became bedrooms.

Recently Bob told me that he managed to walk through each bedroom visiting each one of them exactly once and returning back to the one where he started. Each bedroom has a door to another bedroom if they share a wall.

And I being myself decided to check if it's possible before fully trusting him, but I do not have a lot of time, so I'm asking you: can I trust Bob or does he just want to look cool?

Picture:

A=Armoury G=Garden P=Pool

• Does Bob attempt to visit every bedroom without passing through swimming pools, gardens, and armouries, or is a quick swim between bedrooms acceptable? – LogicianWithAHat Dec 9 '15 at 15:54
• I think the real question is why does Bob need so many bedrooms? – orp Dec 9 '15 at 16:27
• @orp Or so many pools?! – fredsbend Dec 9 '15 at 18:16
• The bedrooms are used to house his guards —he clearly has many guards based on the size of that armoury. The pools simply serve as a bath for 8 rooms: proper hygiene is important. – Ian MacDonald Dec 9 '15 at 18:42
• Is Bob's last name Sierpinski by any chance? – Darrel Hoffman Dec 9 '15 at 20:18

This is

possible.

Here is a picture describing why.

r = room
p = pool
g = garden
a = armoury


It's a closed path, so choose any room to start in.

Bob could have done it.

This is actually pretty easy to prove.

First we only look at the smallest rings of bedroms around the swimming pools.
It is pretty easy to form a cycle by going through those 8 rooms and returning to the one you started at.

Next we look at each 8 of those cycles around the gardens.
To connect those 9 cycles into a bigger circuit we make a total of 7 connections.
For each of those connections we look at a single, not yet connected, wall between 2 adjacent inner cycles and take 4 of their roms, two from each cycle, that stand in a square right next to the wall between the cycles.
If we now severe the connections between the two rooms of each cycle respectively and instead make two new connections between the two pairs that are on opposite sides of the wall between the cycles we have effectively combined two cycles into a single one.
Do that 7 times for each garden and you get 8 cycles each spanning a total of 64 bedrooms.

The last step is to combine those 8 large cycles into a complete cyclet with 7 more of these connections.