Created
December 8, 2019 06:00
-
-
Save wcharczuk/4212d65fdeccfbca1883ca10af21edde to your computer and use it in GitHub Desktop.
A small intcode example; takes a user input, and returns -1 if its < 8, 0 if its == 8, and 1 otherwise
This file contains hidden or 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
.limit | |
.userInput | |
.temp | |
add 0 8 .limit | |
input .userInput | |
equals &.userInput &.limit .temp | |
jump-if-false &.temp pc(6) | |
print 0 | |
jump-if-false 0 sym(-1) | |
less-than &.userInput &.limit .temp | |
jump-if-false &.temp pc(6) | |
print -1 | |
jump-if-false 0 sym(-1) | |
print 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment