Cognitive psychology is researched since the 1940s. The idea was to understand human problem solving and the importance of heuristics in it. George Katona (an early psychologist) published in the 1940s a paper about human learning and teaching. He mentioned the so-called Katona-Problem, which is a geometric task.
Squares
Katona style problems are the ones where you remove straws in a given configuration of straws to create n unit squares in the end. In the end, every straw is an edge to a unit square. Some variations include 2x2 or 3x3 sizes of squares allowed as well as long as no two squares are overlapping, i.e. a bigger square 2x2 can't contain a smaller square of size 1x1. Some problems use matchsticks as a variation, some use straws, others use lines. Some variations allow bigger squares to contain smaller ones, as long as they don't share an edge viz. https://puzzling.stackexchange.com/questions/59316/matchstick-squares
Is there a way we can view it as a graph and removing straws/matchsticks as deleting edges between nodes in a graph?
If so, can I train a bot where I can plugin some random, yet valid conditions for the game and goal state to get the required solution?
Edit #1: The following problem is just a sample to show where I am getting at. The requirement for my game is much larger. Also, I chose uninformed search to make things simpler without bothering about complex heuristics and optimization techniques. Please be free to explore ideas with me.
Scenario #1:
Consider this scenario. In the following diagram, each dashed line or pipe line represents a straw. Numbers and alphabet denote junctions where straw meet. Let's say, my bot can explore each junction, remove zero, one, two, three or four straws such that resultant state has
- no straw that dangles off by being not connected to a square.
- a small mxm square isn't contained in a larger nxn square (m<n)
- Once straw is removed, it can't be put back.
Initial configuration is shown here. I always need to start from top left corner node P and optimization... the objective is to remove straws in minimum hops from node to node using minimum number of moves, by the time goal state is reached.
P------Q------R------S------T
| | | | |
| | | | |
E------A------B------F------G
| | | | |
| | | | |
J------C------D------H------I
| | | | |
| | | | |
K------L------M------N------O
| | | | |
| | | | |
U------V------W------X------Y
Goal 1 : I wish to create a large 2x2 square.
At some point during, say BFS search (although it could be any uninformed search on partially observable universe i.e. viewing one node at a time), I could technically reach A, blow out all edges on A to create the following.
P------Q------R------S------T
| | | |
| | | |
E A B------F------G
| | | |
| | | |
J------C------D------H------I
| | | | |
| | | | |
K------L------M------N------O
| | | | |
| | | | |
U------V------W------X------Y
That is one move.
Goal 2 : I want to create a 3x3 square instead.
I can't do that in one move. I need the record of successive nodes to be explored and then possibly backtrack to given point as well if the state fails to produce desired result. Each intermediate state might produce rectangles which are not allowed (also, how would one know how many more and which straws to remove to get to a square) or dangle a straw or worse get stuck in an infinite loop as I can choose to not remove any straw. How do I approach this problem?
#Edit 2:
For validation, figures 3, 4 and 5 are given below.
P------Q------R------S------T
| | | |
| | | |
E A B------F G
| | | |
| | | |
J------C------D------H I
| | | | |
| | | | |
K------L------M------N O
| | | | |
| | | | |
U------V------W------X Y
The above figure (3) is invalid as we can't have dangling sticks TG,GI etc.
P------Q------R------S------T
| | |
| | |
E------A G
| |
| |
J I
| |
| |
K O
| |
| |
U------V------W------X------Y
The above figure (4) is invalid as we can't have overlapping squares
P------Q------R S T
| |
| |
E A B------F------G
| | | |
| | | |
J------C------D------H------I
| | | | |
| | | | |
K------L------M------N------O
| | | | |
| | | | |
U------V------W------X------Y
Figure (5) is valid configuration.