public char this[Position position] { get { return this.matrix[position.Row, position.Col]; } private set { this.matrix[position.Row, position.Col] = value; } }
public bool CanMoveTo(Position position) { if (position.Row < 0 || position.Row >= this.matrix.GetLength(0)) { return false; } if (position.Col < 0 || position.Col >= this.matrix.GetLength(1)) { return false; } if (this[position] == '1' || this.IsVisisted(position)) { return false; } return true; }
public bool IsVisisted(Position position) { return this.visited[position.Row, position.Col]; }
public void Visit(Position position) { this.visited[position.Row, position.Col] = true; }