Ejemplo n.º 1
0
        public override DIRECTION translateMove(cord from, cord to, ref View v)
        {
            int first  = to.x - from.x;
            int second = to.y - from.y;

            if (first > 0) // dolu
            {
                return(DIRECTION.DIRECTION_FORWARD);
            }
            else if (first < 0) // nahoru
            {
                v = new TopView();
                return(DIRECTION.DIRECTION_BACKWARD);
            }
            else if (second > 0) // doprava
            {
                v = new RightView();
                return(DIRECTION.DIRECTION_LEFT);
            }
            else if (second < 0) // doleva
            {
                v = new LeftView();
                return(DIRECTION.DIRECTION_RIGHT);
            }
            else
            {
                return(DIRECTION.WAIT);
            }
        }
Ejemplo n.º 2
0
        public static void WriteOutput(string fileName, cord[] path)
        {
            StreamWriter sw = new StreamWriter(fileName);
            View         v  = new RightView();

            for (int i = 0; i < path.Length - 1; i++)
            {
                sw.WriteLine((int)v.translateMove(path[i], path[i + 1], ref v));
            }

            sw.Close();
        }