I posted a four step procedure for solving puzzles where steps 1,2 and 4 could be automated in software. Here are some thoughts on an algorithm for automating step 3.
Step 1 - Fill stacks with alternating A-U U-A pairs
Step 2 - Stabilise loops by placing Gs
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
Step 4 - Place G-U pairs
Step 3
- Define two structures
STACK
XX… XX
XX AU UA alternating pairs from step 1 XX
includes the shorter forms
XXX
XXX
XX
XX
PENTAGON (imagine the bend)
…U
XX…XX
XX…XX
- Algorithm
Start at base 1 and move along the bases.
When to apply the procedure P:
STACK
P…P
STACK…PENTAGON…STACK
P…P…P
Procedure P:
Try all combinations of AU UA CG GC in the four positions… X
…X
Select the combination that best meets the CRITERIA (see later).
[There are four possibilities for four positions giving 4x4x4x4 combinations (256)]
Keep going round until the CRITERIA are fully satisfied OR no changes were made in that pass.
If no changes were made in the last pass try combinations where at least one pair is UG or GU.
-
CRITERIA
The selected combination must satisfy constraints on consecutive Gs and consecutive Cs.
It should be white locally (if possible) and have the largest white overall. [I’m referring to the red/white schematic on the puzzle page] -
TRIM
The last step is to satisfy constraints on G-C pairs.
Start at base 1 and move along the bases.
Replace a GC or CG pair with AU. If this breaks the CRITERIA try UA then UG then GU
Keep going until the constraint on G-C pairs is satisfied OR no changes were made in that pass.