Tuesday, 29 April 2014

logical deduction - Barrel - Part 1


An entry in Fortnightly Topic Challenge #35: Restricted Title 1. Title based on the very first xkcd.
Continued in Barrel - Part 2, Barrel - Part 3, Barrel - Part 4, and Barrel - Part 5.




You manage a barrel warehouse. The warehouse is divided into an $8\times 8$ grid of cells. A barrel takes up one cell when upright, and two cells when laid down. You only remember where some of the barrels are in the warehouse, and you must determine where the rest of them are. Luckily, you remember two things that should help you out:



  • There are indicators along each row/column representing the number of barrels that occupy at least one cell in that row/column.

  • Barrels that are lying down have no room to roll to either side, i.e. there is a barrel or the wall stopping them from rolling on either side.



Here is a diagram of the warehouse, with the row/column indicators and the barrels you know for sure. Please determine where the remaining barrels are, and show your steps.


enter image description here



Answer



Answer



enter image description here



Step by step solution




enter image description here
The start of the puzzle. Several rows and columns are already completely filled, so let's shade them in:
enter image description here
R2C2, R2C4, R6C5, and R8C5 must be occupied by a barrel to prevent their adjacent barrels from rolling now since the other space can't be occupied. They could be in any orientation, but a barrel must exist there.
enter image description here
I counted the number of barrels remaining. The placing of these barrels nearly fills up row 2, 6, and 8, so many spaces can't be placed now:
enter image description here
R2C4 can't extend to R2C5 or it can roll north. Likewise R6C5 can't extend to R5C5 or it can roll east. In particular, R2C5 can't be occupied by another barrel either, since that would exceed row 2's barrel limit.
enter image description here
Therefore, R3C5 is a barrel to block the barrel to the east of it.

enter image description here
Now R5C5 can't be a barrel due to column 5's barrel restriction. R4C2 must be occupied to prevent the barrel west of it from rolling. R2C4 can't extend down due to row 3's barrels.
enter image description here
R4C2 can't extend east or it could slide up. R4C5 must be occupied by a barrel or else the barrel to the west of it could slide, importantly since column 5 is already at the barrel limit that means that R4C5 and R3C5 are part of the same barrel. This means that R3C4 isn't occupied due to row 3, and therefore both R6C5 and R8C5 extend left to satisfy column 4's restriction.
enter image description here
We do another inventory check of barrels remaining. We need 3 more barrels on columns, and 2 more barrels on rows. An interesting property is that upright barrels contribute 1 to both row and column counts, horizontal barrels contribute 1 to row counts, and 2 to column counts, and vertical barrels contribute 1 to column counts, and 1 to row counts. Hence we need at least one more horizontal barrel.
enter image description here
The only place we could place a horizontal barrel is R4C7-8 (R5C2-3 would slide south). The other barrels are therefore upright and we are done. enter image description here



No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...