예제 #1
0
        public char get_Direccion_Char(Celda celda)
        {
            if (x == celda.x)
            {
                return(celda.y < y ? (char)(3 + 'a') : (char)(7 + 'a'));
            }
            else if (y == celda.y)
            {
                return(celda.x < x ? (char)(1 + 'a') : (char)(5 + 'a'));
            }

            else if (x > celda.x)
            {
                return(y > celda.y ? (char)(2 + 'a') : (char)(0 + 'a'));
            }
            else if (x < celda.x)
            {
                return(y < celda.y ? (char)(6 + 'a') : (char)(4 + 'a'));
            }

            throw new Exception("Error direccion no encontrada");
        }
예제 #2
0
 public bool get_Esta_En_Linea(Celda destino) => x == destino.x || y == destino.y;
예제 #3
0
        public bool get_Esta_En_Linea(short destino)
        {
            Celda celda_destino = mapa.celdas[destino];

            return(x == celda_destino.x || y == celda_destino.y);
        }
예제 #4
0
 public int get_Distancia_Entre_Dos_Casillas(Celda destino) => Math.Abs(x - destino.x) + Math.Abs(y - destino.y);
예제 #5
0
        public int get_Distancia_Entre_Dos_Casillas(short destino)
        {
            Celda celda_destino = mapa.celdas[destino];

            return(Math.Abs(x - celda_destino.x) + Math.Abs(y - celda_destino.y));
        }