Skip to content

Instantly share code, notes, and snippets.

@choltha
Created April 13, 2024 11:27
Show Gist options
  • Save choltha/383814226639933ecdb4eb505b88e361 to your computer and use it in GitHub Desktop.
Save choltha/383814226639933ecdb4eb505b88e361 to your computer and use it in GitHub Desktop.
A program of the A::B system which has 4 tokens: `A#`, `#A`, `B#` and `#B`.
Translate it into an alternative bdqp-program-syntax first:
Its a system with 4 tokens as well: `b`, `d`, `p` and `q`.
`A#` becomes `b`, `#A` becomes `d`, `B#` becomes `p`, `#B` becomes `q`
A bdqp-program is a sequence of tokens. Example:
p b q d p
To *compute* a program, we must rewrite neighbor tokens, using the rules:
b d ... becomes ... nothing
b q ... becomes ... q b
p d ... becomes ... d p
p q ... becomes ... nothing
In other words, whenever two neighbor tokens have their openings facing each-other,
they must be rewritten according to the corresponding rule. For example, the
first example shown here is computed as:
p b q d p =
p q b d p =
b d p =
p
The steps were:
1. We replaced `b q` by `q b`.
2. We replaced `p q` by nothing.
3. We replaced `b d` by nothing.
The final result was just `p`.
Now, consider the following program:
b p p d p d q
Fully compute it, step by step.
After solving the riddle, it must be translated back to the A::B syntax.
`b` becomes `A#`, `d` becomes `#A`, `p` becomes `B#`, `q` becomes `#B`
---
Follow the following format.
Question: The riddle. Contains ONLY the letters A and B with a # to either side of the letter. Must be translated into bdqp before processing.
Reasoning: To ${produce the answer}, we solve the given riddle, step by step. Be very verbose. Every step MUST be verbalized. Apply one action in each step only. Verbalize what exactly was applied and what was the result of that action. Repeat this process until the riddle is solved. Follow the examples EXACTLY. Its more important to follow the structure exactly, than it is to produce the correct answer of the riddle itself. Be maximally adhereant to the examples.
Answer: The final set of letters and #s. This is the answer to the riddle. Must be in A::B Syntax and contained in a <solution> tag.
---
Question:<problem>#A B# A# #A B# B# B# #A #A #A B# A#</problem>
Reasoning: Starting string: #A B# A# #A B# B# B# #A #A #A B# A#
Translated string: ['d', 'p', 'b', 'd', 'p', 'p', 'p', 'd', 'd', 'd', 'p', 'b']
Starting round 1, tokens: [1=d, 2=p, 3=b, 4=d, 5=p, 6=p, 7=p, 8=d, 9=d, 10=d, 11=p, 12=b]
Pos 1=d 2=p: Found: d p -> replaced with p d -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=p, 7=p, 8=d, 9=d, 10=d, 11=p, 12=b]
Pos 2=d 3=b: NOP
Pos 3=b 4=d: NOP
Pos 4=d 5=p: NOP
Pos 5=p 6=p: NOP
Pos 6=p 7=p: NOP
Pos 7=p 8=d: Found: p d -> replaced with d p -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=p, 7=d, 8=p, 9=d, 10=d, 11=p, 12=b]
Pos 8=p 9=d: Found: p d -> replaced with d p -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=p, 7=d, 8=d, 9=p, 10=d, 11=p, 12=b]
Pos 9=p 10=d: Found: p d -> replaced with d p -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=p, 7=d, 8=d, 9=d, 10=p, 11=p, 12=b]
Pos 10=p 11=p: NOP
Pos 11=p 12=b: NOP
Starting round 2, tokens: [1=p, 2=d, 3=b, 4=d, 5=p, 6=p, 7=d, 8=d, 9=d, 10=p, 11=p, 12=b]
Pos 1=p 2=d: NOP
Pos 2=d 3=b: NOP
Pos 3=b 4=d: NOP
Pos 4=d 5=p: NOP
Pos 5=p 6=p: NOP
Pos 6=p 7=d: Found: p d -> replaced with d p -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=d, 7=p, 8=d, 9=d, 10=p, 11=p, 12=b]
Pos 7=p 8=d: Found: p d -> replaced with d p -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=d, 7=d, 8=p, 9=d, 10=p, 11=p, 12=b]
Pos 8=p 9=d: Found: p d -> replaced with d p -> [1=p, 2=d, 3=b, 4=d, 5=p, 6=d, 7=d, 8=d, 9=p, 10=p, 11=p, 12=b]
Pos 9=p 10=p: NOP
Pos 10=p 11=p: NOP
Pos 11=p 12=b: NOP
No more replacements possible, final tokens: [1=p, 2=d, 3=b, 4=d, 5=p, 6=d, 7=d, 8=d, 9=p, 10=p, 11=p, 12=b]
Translated solution: ['#A', 'B#', 'A#', '#A', 'B#', 'B#', 'B#', '#A', '#A', '#A', 'B#', 'A#']
<solution>#A B# A# #A B# B# B# #A #A #A B# A#</solution>
Answer: <solution>#A B# A# #A B# B# B# #A #A #A B# A#</solution>
---
Correct Prediction: False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment