# Three steps of a four step procedure for solving puzzles could be fully automated in software

I have been using a four step procedure for solving puzzles. I believe steps one, two and four can be fully automated in software.
I applied the algorithm manually on the last 200 puzzles.

It would be nice to have these available as a button each. This would improve the solving rate and remove the tedious parts of the process.
These ideas appear in the user guides so a lot of people might appreciate the automation.

Step 1 - Fill stacks with alternating A-U U-A pairs
Pseudocode
____Start at base 1 and apply to each base in turn
____IF this base should be part of a pair
______IF an A-U or U-A bond doesnâ€™t already exist here
________IF this is the first base OR the the previous base had an A-U pair
__________Place U-A pair
________ELSE
__________Place A-U pair

Step 2 - Stabilise loops by placing Gs
Pseudocode
____ Start at base 1 and apply to each base in turn
____IF this base should NOT be part of a pair
______IF the previous base should be part of a pair
__________Change base to G
__________IF the segment energy is the same or greater
_______________Undo

Step 3 - Place G-C pairs (and G-U pairs if required) to solve structure and all constraints except the number of G-U pairs
This is the human step

Step 4 - Place G-U pairs
[The algorithm worked 100% for the 200 puzzle test.]

Pre-condition - assumes structure and all constraints except the number of G-U pairs are solved.

Pseudocode
____Start at base 1 and apply to each base in turn (until G-U pairs constraint is satisfied)
______IF the base is an A-U or U-A pair AND NOT the top or bottom of a stack
_________Place G-U pair
_________IF the structure or any other constraint (except G-U pairs) are broken
_____________Undo

____IF that isnâ€™t enough
______Start at base 1 and apply to each base in turn (until G-U pairs constraint is satisfied)
_________IF the base is an A-U or U-A pair AND IS the top or bottom of a stack
____________Place G-U pair
____________IF the structure or any other constraint (except G-U pairs) are broken
_______________Undo

____IF that still isnâ€™t enough
______Start at base 1 and apply to each base in turn (until G-U pairs constraint is satisfied)
__________IF the base is an A-U or U-A pair
_____________Place G-U pair
_____________IF the structure or any other constraint (except G-U pairs) are broken
________________Undo

____IF that still isnâ€™t enough!
______Start at base 1 and apply to each base in turn (until G-U pairs constraint is satisfied)
__________IF the base is an A-U or U-A pair
______________Place U-G pair
______________IF the structure or any other constraint (except G-U pairs) are broken
________________Undo

2 Likes

If you look in the script section you will see a few players have done just that.
Looks like 70% of the puzzles can be solved with generic code. ViennaUCT