
I could use help modeling this puzzle. I'm not looking for a solution but I need help in phrasing the problem mathematically. I need a change in paradigm. My friend asked me for help with this puzzle but frankly, I'm not sure where to begin. I'm thinking maybe of a discrete math or maybe even a linear algebra approach but I've not taken either class in many years and am not sure.
I tried discrete math but the expressions I got were too long to be reasonable. Linear algebra struck me only because it's matrix-based but I couldn't find a way to apply it (with further thought seems very much the wrong tool).
Is there a way to set the problem up so that it can be solved in $O(1)$ time?
I am looking up Sudoku algorithms at the moment and hopefully that'll help. Any suggestions to a posable algorithm or model would be great!
Edit: I know I used a lot of buzz words in my original post. These edits should have fixed some of that. I don’t like the name of the puzzle either but I wanted to be somewhat academic in adding a source. To clarify for @Blitzer I just what to know what type of math to use. I spoke of big O notation because I didn’t know if it was possible to solve in a non-algorithmic manner.
The responses I’ve got have been amazing and incredibly detailed. A big thank you to everyone for perpetuating such a helpful community!
I tried to consider it as an Integer Linear Program. We have the binary variables $c_{ij}, d_{ij}, s_{ij}, t_{ij}, e_{ij}$ for $(i,j) \in [6]^2$ indicating (respectively) whether there is a circle, diamond, square, triangle or empty in the place $(i,j)$. Then we have many constraints:
Then for the black arrow constraints. Symbol $v$ with black arrow: then the row (or column and either could be reversed, have to index them accordingly) can't begin $y, ey $ or $eey$ for any other symbol $y$. These can be encoded as
The white arrows are even more tricky. Now it can't begin with any of $yz, yez, yeez, eyz, eyez, eeyz$ for any other two symbols $y, z$. And also, because $v$ can't be the first, it can't begin with $v, ev, eev$. These turn to constraints similarly as before.
The program doesn't have an objective function, we're just looking for any feasible solution.
I tried to code this with Sage (my code here). But it says there are no feasible solutions. What mistake did I make, or is this whole idea flawed?
Now with
solver='ppl'it doesn't crash but neither does it finish any time soon. Maybe this method without better algorithms isn't any good.EDIT: I know you're not looking for solutions, but since that Integer program didn't work, I solved it in a usual way. I might as well put it here in the answer. A simple recursive backtracker solves it pretty fast. I made it so that it puts in a whole row at a time (there are $360$ possibilities). Here's the code.
The solution is ($0=$ empty, $1=$ circle, $2=$ diamond, $3=$ square, $4=$ triangle):