Пример #1
0
        public void calculateBest()
        {
            Point target    = getCurBestTarget();
            Point calcPoint = getCurBestPath(target);

            if (calcPoint.X < 0 && calcPoint.Y < 0)
            {
                return;
            }

            TileNode startTile = shortPath.getInnerTile(target, target);

            Point curPoint  = calcPoint;
            Point nextPoint = startTile.getNextPoint();

            do
            {
                if (!mice.isMyPoint(curPoint))
                {
                    if (mice.getMemory((int)curPoint.X, (int)curPoint.Y) == 0)
                    {
                        updateCanvas((int)curPoint.X, (int)curPoint.Y, "best_no.png");
                    }
                    else
                    {
                        updateCanvas((int)curPoint.X, (int)curPoint.Y, "best.png");
                    }
                }
                if (nextPoint.X < 0 || nextPoint.Y < 0)
                {
                    break;
                }
                curPoint  = nextPoint;
                startTile = shortPath.getInnerTile(target, curPoint);
                nextPoint = startTile.getNextPoint();
            } while (true);

            startTile = shortPath.getTile(target, target);

            curPoint  = target;
            nextPoint = startTile.getNextPoint();
            do
            {
                if (!mice.isMyPoint(curPoint))
                {
                    if (mice.getMemory((int)curPoint.X, (int)curPoint.Y) == 0)
                    {
                        updateCanvas((int)curPoint.X, (int)curPoint.Y, "best_no.png");
                    }
                    else
                    {
                        updateCanvas((int)curPoint.X, (int)curPoint.Y, "best.png");
                    }
                }
                if (nextPoint.X < 0 || nextPoint.Y < 0)
                {
                    break;
                }
                curPoint  = nextPoint;
                startTile = shortPath.getTile(target, curPoint);
                nextPoint = startTile.getNextPoint();
            } while (true);
        }