# Barrel - Part 4

An entry in Fortnightly Topic Challenge #35: Restricted Title 1. Title based on this xkcd.
This is a continuation of Barrel - Part 1, Barrel - Part 2, and Barrel - Part 3, but this puzzle is still self-contained.
Continued in Barrel - Part 5.

That's right, your barrel job somehow just got even harder. The situation is basically the same as in Barrel - Part 2, except that barrels have openings, and you must not spill the contents of any barrel. To make this puzzle self-contained, let's review the rules:

• The goal is to get the red barrel out of the warehouse without letting any other barrels escape.
• A barrel takes up one space when upright, and two spaces when laid down.
• Movement of barrels works as in the following image (solid barrels can move to their adjacent outlines). Laid down barrels can roll to the side and be propped up. Upright barrels can be tipped over. Of course, the space(s) it moves to must be free.

• New Rule: A barrel may have zero, one or two openings. An opening may never "touch" the ground. For example, a barrel with two openings can never be upright.

Here is your warehouse's current state. Openings are denoted by the white on one side of the barrel. Please show how to get the red barrel out of the exit in the top right. You are not required to do so in the minimum number of moves.

OK, this one's going to be way more difficult than the ones before. The first observation is that an open barrel standing somewhere can only stand somewhere else if it has rolled in between, and rolling requires a two-space wide path. And the doubly open barrel of course cannot even stand at all. So, let's get rolling! (Hlyaaargh.)

Since the door isn't wide enough to roll through, the dynamite red barrel must be standing at the door in the end. (If the red barrel were on its side at the door, it would necessarily be impossible to stand it up on the outside, because it was tipped on its side while it was standing somewhere inside the warehouse.) The path of the dynamite red barrel must therefore be something along the lines of this:

Now then, the first order of business is going to be

"move the doubly-open barrel two steps to the right".

To see why this must be so, consider the same puzzle with everything removed but these three barrels:

There are a couple of different ways of solving this simplified version, but in every solution the twice-open barrel has to move two steps to the right.

Now, in theory, it's possible to sneak the red barrel to the right, under the doubly open one, but that requires quite a shuffle, so we'll try to bring the red barrel up first, and to the right only after that, so we'll be following the path in the earlier diagram.

In the real puzzle, there's quite a lot of clutter in the way. Let's start by naming the barrels, and clearing up some space. We can always undo the cleanup later, if it turned out to be a mistake.

Moves

   1. A-right  6. H-right   11. P-right  16. N-up
2. C-up     7. J-up      12. G-down
3. C-left   8. N-left    13. G-right
4. D-left   9. N-up      14. G-down
5. D-up    10. P-right   15. J-left


All this brings us to the following position, where we finally have the room to move the I-barrel:

It looks like we'll run in trouble, since the J-barrel is blocking the red barrel's path, and there's a lot of stuff in the top left corner, where we wanted to manoeuvre the red barrel. Turns out, neither of these problems is insurmountable, mainly because we got lucky with the exact way we packed away the top left barrels:

    ...       21. RED-up   26. RED-right  31. F-down   36. D-down
17. I-right   22. F-up     27. RED-up     32. C-down   37. RED-left
18. I-right   23. RED-left 28. RED-up     33. D-left   38. C-up
19. RED-right 24. J-down   29. F-Down     34. RED-up   39. D-down
20. RED-up    25. J-down   30. F-right    35. C-right  40. RED-down


And then it's just a matter of dodging the remaining barrels on the way (and they said donkey kong skills wouldn't ever be useful anywhere else):

41. RED-right 46. N-down 51. B-left    56. RED-left  61. E-left  66. H-up
42. RED-right 47. A-down 52. B-down    57. E-left    62. E-left
43. RED-up    48. A-left 53. B-left    58. E-up      63. E-up
44. N-left    49. A-left 54. B-down    59. E-right   64. H-left
45. N-left    50. A-left 55. RED-down  60. E-down    65. H-up


..and the coast is clear!

      ...        71. RED-up
67. RED-right  72. RED-right
68. RED-right
69. RED-right
70. RED-right


Phew!

EDIT: Praise be to @ManyPinkHats for producing this animation of the sequence:

• I've not worked with Flash before so I can't remake Chowzen's work from Barrel - Part 2, but I can at least provide my own animated graphic that might help. – ManyPinkHats Jun 4 '18 at 15:06
• Oh wow, I thought that was way too much work to even consider! Thank you so very much! – Bass Jun 4 '18 at 16:28