Skip to content

Instantly share code, notes, and snippets.

@bazub
Created December 9, 2012 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bazub/4247344 to your computer and use it in GitHub Desktop.
Save bazub/4247344 to your computer and use it in GitHub Desktop.
Pseudo-code for searching for end-point of ship
Get Start_point(x,y)
if x-3 >=1
mark endpoint (x-3,y) //north
if x+3 <=10
mark endpoint (x+3,y) //south
if y-3 >=1
mark endpoint (x,y-3) //west
if y+3 <=10
mark endpoint (x,y+3) //east
update map
get End_point(x,y)
fill line (Start_point(x,y),End_point(x,y))
delete other_endpoints
update map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment