public bool Walk(Direction dir) { if (!CanWalk(dir)) return false; position = position[dir].OtherSide; position.Seen = true; if (OnChange != null) OnChange(this); return true; }
public static int ToInt(Direction dir) { return dir == NORTH ? 0 : dir == WEST ? 1 : dir == EAST ? 2 : dir == SOUTH ? 3 : -1; }
public MazeLink this[Direction dir] { get { return exits[dir.AsInt]; } }
public MazeLink(Direction dir, bool walled) { direction = dir; wall = walled; }
public String ReportWalk(Direction dir) { return String.Format( "You walk to the {0}.\n{1}", dir, ReportLook ); }
public bool CanWalk(Direction dir) { return !position[dir].Wall; }