Created
May 24, 2017 12:28
-
-
Save markgoddard/dd93912245fb74e062eaf9cbedf4ca3e to your computer and use it in GitHub Desktop.
Cursor for wang_matrix.exe?
This file contains 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
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