예제 #1
0
        public char get_Direccion(Celda celda)
        {
            /** Diagonales **/
            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'));
            }

            /** Lineales **/
            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 int get_Distancia(Celda destino) => Math.Abs(x - destino.x) + Math.Abs(y - destino.y);