Exemplo n.º 1
0
 /// <summary>
 /// Creates a new ImageAnalyzer.
 /// </summary>
 public ImageAnalyzer()
 {
     this.movementStack = new Stack<MovementDirection>();
     this.backtrackQueue = new Queue<MovementDirection>();
     this.instructions = new List<MovementInstruction>();
     this.canvas = null;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Analyzes an image and creates a basic set of movement instructions.
        /// </summary>
        public IEnumerable<MovementInstruction> CreateMovementInstructions(Image image)
        {
            movementStack.Clear();
            backtrackQueue.Clear();
            instructions.Clear();
            canvas = CreateCanvas(image);

            while (true)
            {
                canvas.VisitCurrentNode();
                if (!TryNext())
                {
                    return instructions;
                }
            }
        }