# Thoughts on Puzzle 12 - Arrow Maze?

**URL:** https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002
**Category:** General
**Tags:** open-discussion
**Created:** [July 7, 2022, 7:48pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002 "2022-07-07T19:48:21Z")
**Posts on this page:** 20
**Page:** 3

<div class="post-metadata">

### Author: ![galactic](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@galactic](https://community.rapyd.net/u/galactic)
#### Post date: [July 11, 2022, 1:53am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/44 "2022-07-11T01:53:03Z")

</div>

This was a fun one. Got in late so I missed the deadline but it was fun to revisit backtracking and write a script to solve it. My total respect to people who solved it by hand, that takes a lot of patience!

---

<div class="post-metadata">

### Author: ![gwarbeh](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/gwarbeh/32/8641_2.png) [@gwarbeh](https://community.rapyd.net/u/gwarbeh)
#### Post date: [July 11, 2022, 2:56am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/45 "2022-07-11T02:56:28Z")

</div>

Right on, Maris.  
Backwards was how I moved forward. I found all the places that had only one option as to where to go. I treated these squares as linked. That limited the number of options.

Really, it’s all about limiting options. like sudoku.

Then I tried lining up the numbers closest together. There is less possibility for variation there.

It was good fun!

---

<div class="post-metadata">

### Author: ![slimmers22](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/slimmers22/32/2126_2.png) [@slimmers22](https://community.rapyd.net/u/slimmers22)
#### Post date: [July 11, 2022, 3:45am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/46 "2022-07-11T03:45:24Z")

</div>

Anyone notice puzzle 13 is up and anyone know how to start it cause im very lost lol. didn’t give much direction

---

<div class="post-metadata">

### Author: ![MusaddiqueAli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/musaddiqueali/32/3309_2.png) [@MusaddiqueAli](https://community.rapyd.net/u/MusaddiqueAli)
#### Post date: [July 11, 2022, 7:40am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/47 "2022-07-11T07:40:53Z")

</div>

I solved it already. Yeah, they didn’t give a lot of instructions. One hint that I can give you: only search for those body part names (internal or external) which are made of only 8 letters, some letters within the words may repeat as well. That’s the most hint I can give.

---

<div class="post-metadata">

### Author: ![MusaddiqueAli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/musaddiqueali/32/3309_2.png) [@MusaddiqueAli](https://community.rapyd.net/u/MusaddiqueAli)
#### Post date: [July 11, 2022, 5:10pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/48 "2022-07-11T17:10:24Z")

</div>

Hi, congratulations. I just saw that you won the Interim Period 1 prize. Enjoy your telescope. 👍.

---

<div class="post-metadata">

### Author: ![michalush](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@michalush](https://community.rapyd.net/u/michalush)
#### Post date: [July 11, 2022, 8:05pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/49 "2022-07-11T20:05:37Z")

</div>

Now that puzzle 12 has expired, will anyone who has created a program to solve it might be interested to share it? I’d like to learn for it.

---

<div class="post-metadata">

### Author: ![MusaddiqueAli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/musaddiqueali/32/3309_2.png) [@MusaddiqueAli](https://community.rapyd.net/u/MusaddiqueAli)
#### Post date: [July 12, 2022, 12:51am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/50 "2022-07-12T00:51:59Z")

</div>

Yeah, even I want that.

---

<div class="post-metadata">

### Author: ![Noonian-Soong](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/noonian-soong/32/22676_2.png) [@Noonian-Soong](https://community.rapyd.net/u/Noonian-Soong)
#### Post date: [July 12, 2022, 2:40am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/51 "2022-07-12T02:40:56Z")

</div>

Sure. Here’s my solution in python 3. It’s not super clean or efficient… I kinda just brute-forced it in a hurry. It takes 1m 44s to run on my laptop.

I started by defining a map/array with the directions for each square, and then created an array with the given values. It counts upwards towards 64, starting from 1, creating a new array for each possible location of the current number. This approach generated several hundred million possibilities VERY quickly… too much for my patience (and my poor laptop) to handle. To fix this, I made it check each possible array every time it reached one of the given numbers, and discard any arrays that didn’t stand up to the test. This got it down to just over a million possibilities, which narrowed down to just one correct answer by the time it reached 64. (for some reason, at least one incorrect array escaped the first check, 9–\>10, which made it into the final output… I just ignored it).

This approach could be improved by filling in the numbers in a different way - say, finding the given numbers that are closest together and filling the spaces between them first, instead of incrementing sequentially from 1 like I did.

```auto
#%%
import numpy as np

maze = np.array([
    ['SE', 'S', 'S', 'SE', 'W', 'W', 'S', 'SW'],
    ['NE', 'S', 'E', 'SE', 'S', 'S', 'S', 'W'],
    ['E', 'W', 'N', 'SE', 'SW', 'NE', 'S', 'W'],
    ['S', 'E', 'NE', 'NW', 'NW', 'E', 'S', 'W'],
    ['E', 'W', 'NW', 'E', 'SE', 'W', 'S', 'W'],
    ['S', 'E', 'S', 'W', 'SE', 'E', 'NW', 'S'],
    ['NE', 'SE', 'E', 'NE', 'NW', 'W', 'N', 'N'],
    ['E', 'NW', 'N', 'W', 'E', 'N', 'W', 'END']
    ])

vals = np.array([
    [1, 0, 0, 0, 0, 0, 0, 0],
    [0, 0,16,17,52, 0, 0, 0],
    [44,43, 0,14, 0, 0,10,45],
    [0,27, 0, 0,15,28, 0, 0],
    [60, 0,26, 0,63, 0, 0,61],
    [0, 0,55,54, 0, 0, 0, 0],
    [0, 0,56, 0,53, 0, 0, 0],
    [0, 0, 0,33, 0, 0, 0,64]
])

a = [1,7]
b = [5,1]
y = [5,6]
d = [7,4]
e = [2,4]
l = [1,0]

checkvals = vals[vals!=0]
tempvals = 1*vals

def get_idxs(idx, direction):
    if direction == 'E':
        Px = np.arange(idx[1]+1, 8)
        Py = np.ones(len(Px))*idx[0]
    if direction == 'W':
        Px = np.flip(np.arange(0, idx[1]))
        Py = np.ones(len(Px))*idx[0]
    if direction == 'S':
        Py = np.arange(idx[0]+1, 8)
        Px = np.ones(len(Py))*idx[1]
    if direction == 'N':
        Py = np.flip(np.arange(0, idx[0]))
        Px = np.ones(len(Py))*idx[1]
    if direction == 'NE':
        Px = np.arange(idx[1]+1, 8)
        Py = np.flip(np.arange(0, idx[0]))
    if direction == 'NW':
        Px = np.flip(np.arange(0, idx[1]))
        Py = np.flip(np.arange(0, idx[0]))
    if direction == 'SE':
        Px = np.arange(idx[1]+1, 8)
        Py = np.arange(idx[0]+1, 8)
    if direction == 'SW':
        Px = np.flip(np.arange(0, idx[1]))
        Py = np.arange(idx[0]+1, 8)
    if len(Px) > len(Py):
        Px = Px[0:len(Py)]
    elif len(Px) < len(Py):
        Py = Py[0:len(Px)]
    Px = np.array(Px).astype(int)
    Py = np.array(Py).astype(int)
    return Px, Py

def prune(i, current_sols):
    crop_sols = []
    for p_sol in current_sols:
        previous_num = i - 1

        getit = np.where(p_sol == previous_num)
        prev_y = getit[0]
        prev_x = getit[1]
        prev_idx = [prev_y[0], prev_x[0]]
        prev_dir = maze[prev_y, prev_x]
        Px, Py = get_idxs(prev_idx, prev_dir)

        getit = np.where(p_sol == i)
        curr_y = getit[0]
        curr_x = getit[1]

        if curr_y in Py and curr_x in Px:
            crop_sols.append(p_sol)
    return crop_sols

possible_sols = [tempvals]
for i in range(1, 64, 1):
    current_sols = list([])

    if i in possible_sols[0]:
        skipval = True
        if i == 1:
            possible_sols = possible_sols
        else: 
            possible_sols = prune(i, possible_sols)
    else:
        for psol in possible_sols:
            prev_y = np.where(psol == i-1)[0]
            prev_x = np.where(psol == i-1)[1]
            prev_idx = [prev_y[0], prev_x[0]]
            direction = maze[prev_y, prev_x]
            Px, Py = get_idxs(prev_idx, direction)
            for poss in range(0, len(Px)):
                x = Px[poss]
                y = Py[poss]
                if psol[y,x] == 0:
                    temp = 1*psol
                    temp[y,x] = i
                    current_sols.append(temp)
        
        possible_sols = current_sols

correct_sol = possible_sols[1]

a = [1,7]
b = [5,1]
y = [5,6]
d = [7,4]
e = [2,4]
l = [1,0]

nums = [
    correct_sol[a[0], a[1]],
    correct_sol[b[0], b[1]],
    correct_sol[y[0], y[1]],
    correct_sol[d[0], d[1]],
    correct_sol[e[0], e[1]],
    correct_sol[l[0], l[1]]
    ]

for i in range(0, len(nums)):
    val = nums[i]
    if val > 52:
        nums[i] = val-52
    if val > 26:
        nums[i] = val-26

alphabet = 'abcdefghijklmnopqrstuvwxyz'

string = ''
for num in nums:
    string = string + alphabet[num-1]
print(string)
# %%

```

---

<div class="post-metadata">

### Author: ![just\_T3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@just\_T3](https://community.rapyd.net/u/just_T3)
#### Post date: [July 12, 2022, 11:52am UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/52 "2022-07-12T11:52:51Z")

</div>

The 13th puzzle is easier but the third BODYPART word is abit tricky … cant find many 8 letter words describing the body that match Z and Y

---

<div class="post-metadata">

### Author: ![MusaddiqueAli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/musaddiqueali/32/3309_2.png) [@MusaddiqueAli](https://community.rapyd.net/u/MusaddiqueAli)
#### Post date: [July 12, 2022, 2:31pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/53 "2022-07-12T14:31:54Z")

</div>

Because there are none with Z and Y.

---

<div class="post-metadata">

### Author: ![siddz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/siddz/32/8737_2.png) [@siddz](https://community.rapyd.net/u/siddz)
#### Post date: [July 12, 2022, 3:40pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/54 "2022-07-12T15:40:21Z")

</div>

If you look at the other two letters in yellow and then google 8 letter body parts, it’s quite an obscure one 🙂

---

<div class="post-metadata">

### Author: ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://community.rapyd.net/u/michel)
#### Post date: [July 12, 2022, 4:06pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/55 "2022-07-12T16:06:50Z")

</div>

I got a slightly different solution, also in Python 3.  
I made it go backwards from the bottom-right square (containing 64), as there are more fixed values close to 64 than to 1, but it would be easy to change to a forwards one.

It is a recursive solution, based on a graph representation of the problem: the vertices (V) are the 64 square coordinates (0,0) … (7,7) and an edge is created (in V) from square x to square y if square y contains an arrow directed towards x (here is the backwards bit).

The first half of the program is building the graph.

The real algorithm is in the recursive function visit(v, n), which traverses every legal path in the maze, starting from the bottom right square v=(7,7) and value n=64, decreasing the value by 1 at every step, until it reaches value 1.

It finds a (the only) solution in about 1 second and finishes exploration in 4 seconds.

```auto
from collections import defaultdict

V = [(i, j) for i in range(8) for j in range(8)]
E = defaultdict(list)
val = {(0,0): 1, (1,3): 17, (1,4): 52, (2,1): 43, (2,3): 14, (2,6): 10, (2,7): 45, (3,4): 15, 
       (3,5): 28, (4,0): 60, (4,2): 26, (4,7): 61, (5,3): 54, (6,2): 56, (7,3): 33, (7,7): 64}
fixedpos = set(val.keys())
fixedval = set(val.values())
pos = {v:k for k, v in val.items()}

data = """12214423
72012224
04613724
20755024
04501424
20241052
71075466
05640640
"""
dirs = [(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1),(-1,0),(-1,1)]
for i, line in enumerate(data.split()):
    for j, c in enumerate(line):
        di, dj = dirs[int(c)]
        i2, j2 = i + di, j + dj
        while 0 <= i2 < 8 and 0 <= j2 < 8:
            E[(i2,j2)].append((i,j))
            i2 += di
            j2 += dj

onpath = defaultdict(bool)
val2 = defaultdict(int)

def convert(n):
    while n > 26:
        n -= 26
    return chr(n - 1 + ord("A"))

def solution():
    return "".join(convert(val2[x]) for x in [(1,7),(5,1),(5,6),(7,4),(2,4),(1,0)])

def visit(v, n):
    if n in fixedval and v != pos[n]:
        return
    if v in fixedpos and n != val[v]:
        return
    if n == 1:
        print(solution())
        return
    onpath[v] = True
    val2[v] = n
    for w in E[v]:
        if not onpath[w]:
            visit(w, n - 1)
    val2.pop(v)
    onpath[v] = False

visit((7,7), 64)

```

---

<div class="post-metadata">

### Author: ![just\_T3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@just\_T3](https://community.rapyd.net/u/just_T3)
#### Post date: [July 12, 2022, 4:20pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/56 "2022-07-12T16:20:17Z")

</div>

Ok I have been looking all day!! haha

---

<div class="post-metadata">

### Author: ![just\_T3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@just\_T3](https://community.rapyd.net/u/just_T3)
#### Post date: [July 12, 2022, 5:21pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/57 "2022-07-12T17:21:21Z")

</div>

I still have not found the third word but the current converted word makes no sense, I have taken note of how we have to rearrange the bodypart words.

I am currently trying vertically and reverse horizontal

---

<div class="post-metadata">

### Author: ![MusaddiqueAli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/musaddiqueali/32/3309_2.png) [@MusaddiqueAli](https://community.rapyd.net/u/MusaddiqueAli)
#### Post date: [July 12, 2022, 6:05pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/58 "2022-07-12T18:05:59Z")

</div>

The 3rd BODYPART was the toughest to find for me as well. Hint: It’s a bone. Not going to reveal on which part of the body it lies. But I think you can figure it out, somehow. 👍

---

<div class="post-metadata">

### Author: ![just\_T3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@just\_T3](https://community.rapyd.net/u/just_T3)
#### Post date: [July 12, 2022, 7:04pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/59 "2022-07-12T19:04:02Z")

</div>

I figured it out!! That bone hint helped a lot!! Thanks very much!!! Not gonna reveal for obvious reasons

---

<div class="post-metadata">

### Author: ![AriTheLion](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@AriTheLion](https://community.rapyd.net/u/AriTheLion)
#### Post date: [July 12, 2022, 7:08pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/60 "2022-07-12T19:08:05Z")

</div>

Can share my Java version but it is very ugly in compare to the python code shred here, even the directions is hard coded

---

<div class="post-metadata">

### Author: ![just\_T3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@just\_T3](https://community.rapyd.net/u/just_T3)
#### Post date: [July 12, 2022, 7:13pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/61 "2022-07-12T19:13:58Z")

</div>

Just share anyway! It shows your work

---

<div class="post-metadata">

### Author: ![just\_T3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@just\_T3](https://community.rapyd.net/u/just_T3)
#### Post date: [July 12, 2022, 7:18pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/62 "2022-07-12T19:18:57Z")

</div>

none of these words making sense, I am trying moving the letters (X) amount of times to the right and left and see what happens

---

<div class="post-metadata">

### Author: ![Sylthrim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/sylthrim/32/8201_2.png) [@Sylthrim](https://community.rapyd.net/u/Sylthrim)
#### Post date: [July 12, 2022, 7:32pm UTC](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002/63 "2022-07-12T19:32:10Z")

</div>

“arrange the results in a particular way”. There is no x.

[Previous page](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002.md?page=2)

[Next page](https://community.rapyd.net/t/thoughts-on-puzzle-12-arrow-maze/18002.md?page=4)
