rascal222 / TER-Warbot-2016

Développement de la version 2016 de Warbot dans le cadre du TER du M1 Imagina réalisé par Thomas Bonnin et Pascal Wagner
3 stars 0 forks source link

[Py] getPerceptsResources() doesn't return the detected ressources #9

Open stardisblue opened 8 years ago

stardisblue commented 8 years ago

example :

def actionWarExplorer():
    setDebugString("Search Food");
    percepts = getPerceptsResources();

    if(len(percepts) > 0) :
        setDebugString("Ressources found");

    for percept in percepts:
        if (percept.getDistance() < getMaxDistanceTakeFood()) :
            return take();
        else :
            setHeading(percept.getAngle());

    if (isBlocked()) :
        RandomHeading();

    return move();
stardisblue commented 8 years ago

another exemple :

def actionWarExplorer():
    print(getPercepts())
    print(getPerceptsResources())

near Food outputs :

[AgentPercept : WarFood 24 : team = M�re nature : 279.2233313282495� 34.64868655974869, AgentPercept : WarFood 27 : team = M�re nature : 204.08576312352136� 29.793742963414807]
[]