Last active
December 11, 2015 04:19
-
-
Save mjard/4544713 to your computer and use it in GitHub Desktop.
it's like punchbot is getting smarter...
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
# maybe we bit off more than we could chew | |
@start | |
push 0 | |
push @stackguard | |
call | |
push @fullsweep | |
call | |
push 1 | |
push @stackguard | |
call | |
# if we did things, restart scans | |
push @start | |
iftgoto | |
# smarts | |
push @remotesensor | |
call | |
push 0 | |
greater | |
push @start | |
iftgoto | |
# if we didn't do anything, move west | |
push @MOVE | |
push @WEST | |
push 2 | |
callff | |
pop | |
# do it all over again | |
push @start | |
goto | |
end | |
@fullsweep | |
push @WEST | |
push @actionat | |
call | |
push @was_active | |
iftgoto | |
push @EAST | |
push @actionat | |
call | |
push @was_active | |
iftgoto | |
push @SOUTH | |
push @actionat | |
call | |
push @was_active | |
iftgoto | |
push @NORTH | |
push @actionat | |
call | |
push @was_active | |
iftgoto | |
push @didntdoshit | |
goto | |
@was_active | |
push 1 | |
return | |
@didntdoshit | |
push 0 | |
return | |
@actionat # [DIRECTION] | |
dup | |
push @LOOK | |
swap | |
push 2 | |
callff | |
dup | |
push @CELL_ROBOT | |
equal | |
push @punchit | |
iftgoto | |
push @CELL_RESOURCE | |
equal | |
push @eatit | |
iftgoto | |
pop | |
push 0 | |
return | |
@punchit | |
pop | |
push @PUNCH | |
push @doit | |
goto | |
@eatit | |
push @PULL | |
@doit | |
swap | |
push 2 | |
callff | |
pop | |
push 1 | |
return | |
@remotesensor | |
push @SCAN | |
push 0 | |
push 0 | |
push 3 | |
callff | |
push @CELL_ROBOT | |
equal | |
push @sensor_w_pre | |
iffgoto | |
push 1 | |
push @sensor_w | |
goto | |
@sensor_w_pre | |
push 0 | |
@sensor_w | |
push @SCAN | |
push 0 | |
push 2 | |
push 3 | |
callff | |
push @CELL_ROBOT | |
equal | |
push @sensor_sw_pre | |
iffgoto | |
push 2 | |
bor | |
push @sensor_sw | |
goto | |
@sensor_sw_pre | |
push 0 | |
@sensor_sw | |
push @SCAN | |
push 0 | |
push 1 | |
push 3 | |
callff | |
push @CELL_ROBOT | |
equal | |
push @scan_done | |
iffgoto | |
push 4 | |
bor | |
@scan_done | |
return | |
@stackguard # [expected_size] | |
# make sure our stack size matches up to what we expect | |
# save in registry so it shows up in our panic screen | |
store staxguard_expected | |
here | |
store staxguard_real | |
push staxguard_real | |
push staxguard_expected | |
equal | |
push @healthystack | |
iftgoto | |
panic | |
@healthystack | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment