Skip to content

Instantly share code, notes, and snippets.

@scottchiang
Created October 5, 2012 22:22
Show Gist options
  • Select an option

  • Save scottchiang/3842800 to your computer and use it in GitHub Desktop.

Select an option

Save scottchiang/3842800 to your computer and use it in GitHub Desktop.
Translate Pseudocode
# SCRIPT: PICK UP GOLD
#
# Iteration One: PICK UP THE GOLD
#
# READ grid containing position of gold and rock
# SET starting position to 0,0
# SET an empty sachel
# WHILE y position is less than height of grid
# IF current position has gold
# THEN add gold to sachel and set content of current position to rock
# ENDIF
# IF position y is at the end of the grid
# THEN set x to 0 and increase y by 1
# ELSE increase x by 1
# IF grid still has gold
# THEN
# Print "Oops, looks like we missed one"
# ENDIF
# DISPLAY THe number of pieces of gold you picked up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment