This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USER: choltha | |
MODEL: claude-3-opus-20240229 | |
PROMPT: | |
Don't chat, just observe the pattern and solve the problem. | |
You are given a problem which consists of a string of elements from a small vocabulary. You will apply logic to solve for | |
the answer, as we will demonstrate. At every step, we modify the previous string to a new string by looking at pairs of elements | |
(in rare cases, the last element doesn't have a pair and is unchanged). | |
For each pair you will apply a rule. A rule can cause the elements to be unchanged, deleted, or replaced. To improve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<problem>#A B# A# #A B# B# B# #A #A #A B# A#</problem> | |
Init: #A 2. B# 3. A# 4. #A 5. B# 6. B# 7. B# 8. #A 9. #A 10. #A 11. B# 12. A# | |
#A 2. B# no change, +1. #A | |
B# 3. A# no change, +2. B# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You are given a problem which consists of a string of elements from a small vocabulary. You will apply logic to solve for | |
the answer, as we will demonstrate. At every step, we modify the previous string to a new string by looking at pairs of elements | |
(in rare cases, the last element doesn't have a pair and is unchanged). | |
For each pair you will apply a rule. A rule can cause the elements to be unchanged, deleted, or replaced. To improve | |
our answering, we will number the elements of the problem. The numbers will follow elements between steps to make it | |
easier to follow our logic. In other words, we do not re-number, and an element will keep its number even if changed by | |
the rule. Removed elements will have their numbers removed as well. | |
After you have applied a rule, you will indicate what will be added to make the string in the next step. Generally, if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve_ab_riddle(program): | |
tokens = program.split() | |
while True: | |
changed = False | |
i = 0 | |
while i < len(tokens) - 1: | |
if tokens[i] == 'A#' and tokens[i+1] == '#A': | |
tokens.pop(i) | |
tokens.pop(i) |