Created
October 5, 2012 22:22
-
-
Save scottchiang/3842800 to your computer and use it in GitHub Desktop.
Translate Pseudocode
This file contains hidden or 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
| # 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