Esempio n. 1
0
    public void findNextPathGN(Node endNode)
    {
        Node startNode = new Node(entity.getXEntity(), entity.getYEntity(), 0, 0);

        //We update each values of the interest field with what our neural network think
        updateInterestField2(endNode.getX(), endNode.getY());

        //We set a default wanted node
        Node wantedPosition = new Node(endNode.getX(), endNode.getY(), 0, 0);

        //updateBestWantedPosition(wantedPosition);
        //on print wanted position
        //path.findPathFromStartEnd(startNode, wantedPosition, entity.getMentalMap());
        //print(path.getPathStack().Count);

        //We try to find a path
        while (path.getPathStack().Count == 0)
        {
            //We try to find a path
            //findPathFromStartEnd(Node startNode, Node endNode, int[,] map)
            path.findPathFromStartEnd(startNode, wantedPosition, entity.getMentalMap());
            //If we haven't find a path
            if (path.getPathStack().Count == 0)
            {
                //We change our wanted node to the best position found by the neural network
                updateBestWantedPosition(wantedPosition);
            }
        }
    }