Exemplo n.º 1
0
    public static int GetDistance(Offset a, Offset b)
    {
        Hexagonal ac = a.GetHex();
        Hexagonal bc = b.GetHex();

        return(Hexagonal.GetDistance(ac, bc));
    }
Exemplo n.º 2
0
    public int GetDistance(Offset other)
    {
        Hexagonal a = GetHex();
        Hexagonal b = Offset.GetHex(other);

        return(Hexagonal.GetDistance(a, b));
    }
Exemplo n.º 3
0
        static int GetHexHeuristic(Offset pos1, Offset pos2)
        {
            Hexagonal a = pos1.GetHex();
            Hexagonal b = pos2.GetHex();

            return(Math.Abs(a.x - b.x) + Math.Abs(a.y - b.y) + Math.Abs(a.z - b.z));
        }
Exemplo n.º 4
0
        public override object Run(RunModes runMode, object input, bool Logging)
        {
            int minIndex = (int)input + 1;

            while (true)
            {
                long tri = Triangle.Generate(minIndex);
                if (Pentagonal.IsPentagonal(tri) && Hexagonal.IsHexagonal(tri))
                {
                    return(tri);
                }
                minIndex++;
            }
        }
Exemplo n.º 5
0
    public static int GetRotation(Hexagonal from, Hexagonal to)
    {
        int x = to.x - from.x;
        int y = to.y - from.y;
        int z = to.z - from.z;

        for (int i = 0; i < 6; ++i)
        {
            if (rotations[i].x == x && rotations[i].y == y && rotations[i].z == z)
            {
                return(i);
            }
        }
        return(0);
    }
Exemplo n.º 6
0
 public static int GetDistance(Hexagonal a, Hexagonal b)
 {
     return((Math.Abs(a.x - b.x) + Math.Abs(a.y - b.y) + Math.Abs(a.z - b.z)) / 2);
 }
Exemplo n.º 7
0
 public int GetDistance(Hexagonal other)
 {
     return((Math.Abs(other.x - x) + Math.Abs(other.y - y) + Math.Abs(other.z - z)) / 2);
 }
Exemplo n.º 8
0
 public static int GetRotation(Offset from, Offset to)
 {
     return(Hexagonal.GetRotation(from.GetHex(), to.GetHex()));
 }