You are locked in a massive fortress, slowly starving to death. Your guards inform you that there is food in the fortress, and even tell you where it is and provide a map of the building.
However, you are not sure that you can actually reach the food, given that the every door is locked, and every room is its own labyrinth. Are you able to reach the food? If you're in the same room, you should try. If you're not in the same room, then you might as well stay put, preserving your strength in case help from the outside world comes.
Input
Two arrays: 3 coordinates of where you are, and 3 coordinates of where the food is. (Both are 0-based)
:Optional: an array of three numbers, indicating the size of the following fortress in each dimension.
A three dimensional array of the fortress, where each point in the array is either 1/true (if that point is a wall) or 0/false (if the point is empty). The array is a rectangular prism, and there is no guarantee that the structure follows the laws of physics. (Thus, the bottom floor might be completely empty.)
The place where you are and the place where the food is both have a 0/false.
Output
Are the two points in the same room, unseparated by a wall? Note that you can not move through a diagonal.
Format
You may write a program or a function.
The input may be through STDIN, command line or function arguments, or reading from a file. If you choose a text-based input (like STDIN) you may use any delimiters to help your program parse the input.
The output may be through STDOUT or the function result. You can output/return "true"/"false", 0/1, or the like.
Examples
In these examples, I put a Y where you are, and a F where the food is. This is just to help you understand the examples; in the actual input they would be 0/false.
Input
[0 0 1] // You are at x = 0, y = 0, z = 1
[1 2 2] // The food is at x = 1, y = 2, z = 2
[[[0 0 0] // z = 0, y = 0
[0 0 0] // z = 0, y = 1
[1 1 1]] // z = 0, y = 2
[[Y 0 0]
[0 0 0] // z = 1
[1 1 1]]
[[0 0 0]
[1 1 0] // z = 2
[0 F 0]]]
Output
True. (The places are connected. You can move from [0 0 1] > [2 0 1] > [2 0 2] > [2 2 2] > [1 2 2].)
Input
[3 0 1]
[1 1 0]
[4 2 2] // If you want, you can include this in the input, to indicate the fortress's size
[[[0 1 0 0] // z = 0, y = 0
[0 F 1 0]] // z = 0, y = 1
[[0 0 1 Y]
[0 1 0 0]]]
Output
False. (There are two rooms. Your room includes [2 0 0], [2 1 1], [3 0 0], [3 0 1], [3 0 1], and [3 1 1]. The food's room includes the other empty spaces. Note that a wall of 1's divides the fortress in half.
Winning criterion
Code golf. Shortest code for your function/program wins.
[0,0,1],[1,2,2],[[[0,0,0],[0,0,0],[1,1,1]],[[0,0,0],[0,0,0],[1,1,1]],[[0,0,0],[1,1,0],[0,0,0]]]
a valid way to format your first example? \$\endgroup\$[0,0,1],[1,2,2],[3,3,3],[0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0]
a valid input? \$\endgroup\$