-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# My input looked like this, as printed by code in part 1: | ||
# | ||
# Registers: A=... B=0 C=0 | ||
# 0 B = A % 8 | ||
# 2 B ^= 1 | ||
# 4 C = A / 2**B | ||
# 6 B ^= 5 | ||
# 8 B ^= C | ||
# 10 A /= 2**3 | ||
# 12 output B % 8 | ||
# 14 if A != 0: jump to 0 | ||
# | ||
# Suppose that value of A register in binary looks like ....abcdefgh, where | ||
# abcdefgh are the last bits. For example, if A = 420 = binary 110100100, then | ||
# abcdefgh = 10100100. Let's step through the code and see what it does: | ||
# | ||
# Registers: A=...abcdefgh B=0 C=0 | ||
# 0 B = def | ||
# 2 B = deF here F denotes the opposite of f | ||
# 4 C = fgh if deF=000 | ||
# efg if deF=001 | ||
# def if deF=010 | ||
# cde if deF=011 | ||
# bcd if deF=100 | ||
# abc if deF=100 | ||
# .. | ||
# 6 B ^= 5 | ||
# 8 B ^= C | ||
# 10 A /= 2**3 | ||
# 12 output B % 8 | ||
# 14 if A != 0: jump to 0 |