Esempio n. 1
0
        private void update(Tablero t)
        {
            var coords = Enum.GetValues(typeof(coord));

            direccioAnt = direccio;
            foreach (coord c in coords)
            {
                int i = (int)c;
                memoria[i] = sensors[i];
            }

            sensors[(int)coord.N] = t.getCell(x, y - 1);
            sensors[(int)coord.E] = t.getCell(x + 1, y);
            sensors[(int)coord.S] = t.getCell(x, y + 1);
            sensors[(int)coord.W] = t.getCell(x - 1, y);
        }
Esempio n. 2
0
        public Robot(int x, int y, int id, ref Tablero t)
        {
            this.x   = x;
            this.y   = y;
            this.id  = id;
            direccio = coord.N;

            sensors[(int)coord.N] = t.getCell(x, y - 1);
            sensors[(int)coord.E] = t.getCell(x + 1, y);
            sensors[(int)coord.S] = t.getCell(x, y + 1);
            sensors[(int)coord.W] = t.getCell(x - 1, y);

            var coords = Enum.GetValues(typeof(coord));

            foreach (coord c in coords)
            {
                memoria[(int)c] = 0;
            }
        }