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
| # Turning Pete's program into a class. | |
| class Adventure: | |
| X = 0 | |
| Y = 1 | |
| maze = [[False, False, True, False, False], | |
| [False, True, True, False, True], | |
| [False, True, False, True, True], | |
| [False, True, False, True, False], | |
| [False, True, True, True, False]] |
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
| X = 0 | |
| Y = 1 | |
| def main(): | |
| location = [0, 0] | |
| move(location,1,0) | |
| print location | |
| main() | |
| def move(loc, x, y): | |
| loc[X] += x |