Skip to content

Instantly share code, notes, and snippets.

@mjard
Last active December 11, 2015 02:08
Show Gist options
  • Save mjard/4528189 to your computer and use it in GitHub Desktop.
Save mjard/4528189 to your computer and use it in GitHub Desktop.
PunchBot Fork, Punching in multiple directions!
# maybe we bit off more than we could chew
@STEPSIZE 12
@start
# []
push @fullsweep
# [@fullsweep]
call
# []
push @start
iftgoto
push @MOVE
push @WEST
push 2
callff
pop
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
# [D, D]
push @LOOK
# [D, D, @LOOK]
swap
# [D, @LOOK, D]
push 2
# [D, @LOOK, D, 2]
callff
# [D, LR]
dup
# [D, LR, LR]
push @CELL_ROBOT
# [D, LR, LR, @CELL_ROBOT]
equal
# [D, LR, ER]
push @punchit
# [D, LR, ER, @punchit]
iftgoto
# [D, LR]
push @CELL_RESOURCE
# [D, LR, @CELL_RESOURCE]
equal
# [D, ER]
push @eatit
# [D, ER, @eatit]
iftgoto
# [D]
pop
push 0
return
@punchit
# [D, LR]
pop
# [D]
push @PUNCH
# [D, @PUNCH]
push @doit
# [D, @PUNCH, @doit]
goto
@eatit
# [D]
push @PULL
# [D, @PULL]
@doit
# [D, <ACTION>]
swap
# [<ACTION>, D]
push 2
# [<ACTION>, D, 2]
callff
#[R]
pop
push 1
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment