Skip to content

Instantly share code, notes, and snippets.

@sixthgear
Last active December 10, 2015 21:48
Show Gist options
  • Select an option

  • Save sixthgear/4497788 to your computer and use it in GitHub Desktop.

Select an option

Save sixthgear/4497788 to your computer and use it in GitHub Desktop.
seeker bot
STORE target_x << 0
STORE target_y << 0
STORE move_dir << @NORTH
goto << @main
@main
EQUAL << target_x 0
iffgoto << @main_move
EQUAL << target_y 0
iffgoto << @main_move
CALL << @do_scan
STORE target_y
STORE target_x
@main_move
LESS << target_x 0
iftgoto << @move_west
GREATER << target_x 0
iftgoto << @move_east
LESS << target_y 0
iftgoto << @move_north
GREATER << target_y 0
iftgoto << @move_south
# reset, try scanning again
# STORE target_x << 0
# STORE target_y << 0
goto << @main_action
@move_west
STORE move_dir << @WEST
PLUS << target_x 1
STORE target_x
goto << @main_action
@move_east
STORE move_dir << @EAST
MINUS << target_x 1
STORE target_x
goto << @main_action
@move_north
STORE move_dir << @NORTH
MINUS << target_y 1
STORE target_y
goto << @main_action
@move_south
STORE move_dir << @SOUTH
PLUS << target_y 1
STORE target_y
goto << @main_action
@main_action
CALLFF << @LOOK move_dir 2
iftgoto << @main_grab
CALLFF << @MOVE move_dir 2
POP
goto << @main
@main_grab
CALLFF << @PULL move_dir 2
POP
STORE target_x << 0
STORE target_y << 0
goto << @main
@do_scan
STORE scan_x << 0
STORE scan_y << 0
STORE scan_n << 1
STORE scan_i << scan_n
STORE scan_dir << 0
# STORE scan_max << 10
@scan_begin
# MINUS << scan_max 1
# STORE scan_max
# iffgoto << scan_max @scan_end
EQUAL << scan_dir 0
iftgoto << @scan_north
EQUAL << scan_dir 1
iftgoto << @scan_east
EQUAL << scan_dir 2
iftgoto << @scan_south
EQUAL << scan_dir 3
iftgoto << @scan_west
@scan_north
MINUS << scan_y 1
STORE scan_y
goto << @scan_go
@scan_east
PLUS << scan_x 1
STORE scan_x
goto << @scan_go
@scan_south
PLUS << scan_y 1
STORE scan_y
goto << @scan_go
@scan_west
MINUS << scan_x 1
STORE scan_x
goto << @scan_go
@scan_go
# perform scan
CALLFF << @SCAN scan_x scan_y 3
iftgoto << @scan_found
MINUS << scan_i 1
STORE scan_i
iftgoto << scan_i @scan_begin
# check to see if we should up the spiral length
MODULO << scan_dir 2
iffgoto << @scan_change_dir
@scan_increase
PLUS << scan_n 1
STORE scan_n
@scan_change_dir
# change direction
PLUS << scan_dir 1
MODULO << 4
STORE scan_dir
STORE scan_i << scan_n
goto << @scan_begin
@scan_found
RETURN << scan_x scan_y
@scan_end
RETURN << 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment