Skip to content

Instantly share code, notes, and snippets.

@markgoddard
Created May 24, 2017 12:28
Show Gist options
  • Save markgoddard/dd93912245fb74e062eaf9cbedf4ca3e to your computer and use it in GitHub Desktop.
Save markgoddard/dd93912245fb74e062eaf9cbedf4ca3e to your computer and use it in GitHub Desktop.
Cursor for wang_matrix.exe?
module WangMatrix
class Cursor
attr_reader :traversed
def initialize(maze:)
@maze = maze
@traversed = [maze.maze_start]
end
def adjacent()
@maze.adjacent(@traversed.last)
end
def update(pos)
# Some kind of validation here
assert pos in adjacent()
@traversed << pos
end
def finish?()
@maze.finish?(@traversed.last)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment