Skip to content

Instantly share code, notes, and snippets.

@lukassup
Created April 27, 2017 20:21
Show Gist options
  • Select an option

  • Save lukassup/baf54e13c167489ce9f81d53253a60db to your computer and use it in GitHub Desktop.

Select an option

Save lukassup/baf54e13c167489ce9f81d53253a60db to your computer and use it in GitHub Desktop.
def h(text):
print '<h3>' + text + '</h3>'
def here(self):
p = self.get_current_position()
return p['x'], p['y']
def moves(self):
top, mid, bot = self.get_neighbours()
return (
self.up if top[1] != 1 else None,
self.left if mid[0] != 1 else None,
self.right if mid[2] != 1 else None,
self.down if bot[1] != 1 else None)
from maze import Maze
del maze
Maze.moves = moves
Maze.here = here
maze = Maze()
all_moves = maze.moves()
available_moves = filter(bool, all_moves)
h('Globals')
print globals()
h('Maze class')
print dir(Maze)
h('Maze instance')
print(dir(maze))
h('Currently at')
print maze.here()
h('All moves')
print all_moves
h('Available moves')
print available_moves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment