p76dub / MOSIMA-Duel

0 stars 0 forks source link

prolog exception #2

Open mtrazzi opened 5 years ago

mtrazzi commented 5 years ago

After launching Principal.java, I got the following prolog exception:


ERROR: Agent Player1 died without being properly terminated !!!
State was 2
org.jpl7.PrologException: PrologException: error(existence_error(procedure, '/'(jpl_call, 4)), context('/'(see, 1), _0))
    at org.jpl7.Query.get1(Query.java:352)
    at org.jpl7.Query.hasMoreSolutions(Query.java:275)
    at org.jpl7.Query.oneSolution(Query.java:790)
    at org.jpl7.Query.hasSolution(Query.java:865)
    at sma.user.DecisionBehaviour.action(DecisionBehaviour.java:124)
    at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)
    at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:109)
    at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)
    at jade.core.Agent$ActiveLifeCycle.execute(Agent.java:1585)
    at jade.core.Agent.run(Agent.java:1524)
    at java.lang.Thread.run(Thread.java:748)```

Any ideas?
p76dub commented 5 years ago

It seems that the jpl library is not recognized by your prolog installation. It means that either the jpl.dll or jpl.pl can't be found by the prolog interpreter. See here for installation instructions.

mtrazzi commented 5 years ago

Jpl seems to be working correctly. I've followed the installation instructions from your link.

I'm trying to debug the output from DecisionBehaviour.java. Here is the particular code that I'm debugging:

            for (Actions action : Actions.values()) {
                currentSituation = agent.getAgentSituation(); // Will be more precise than using the previous one
                //testing stuff
                System.err.println("here is my error ->");
                System.out.println(getMyAgent());
                System.out.println(action.getPrologQuery(getMyAgent()));
                System.err.println("can it do the next action? ->");
                System.out.println(action.getPrologQuery(getMyAgent()).hasSolution());
                try {
                    if (action.getPrologQuery(getMyAgent()).hasSolution()) {
                        returnValue = action.getReturnCode();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }

            }

and here is what I get in output:

Agent Dummy deployed !
moveTo Error : the agent Dummy doesn't exist.
moveTo Error : the agent Player1 doesn't exist.
here is my error ->
sma.user.MyAgent@24423cd3
explore( <jref>(0x???????) )
can it do the next action? ->
***  Uncaught Exception for agent Player1  ***
org.jpl7.PrologException: PrologException: error(existence_error(procedure, '/'(jpl_call, 4)), context('/'(see, 1), _0))
    at org.jpl7.Query.get1(Query.java:352)
    at org.jpl7.Query.hasMoreSolutions(Query.java:275)
    at org.jpl7.Query.oneSolution(Query.java:790)
    at org.jpl7.Query.hasSolution(Query.java:865)
    at sma.user.DecisionBehaviour.action(DecisionBehaviour.java:131)
    at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)
    at jade.core.behaviours.CompositeBehaviour.action(CompositeBehaviour.java:109)
    at jade.core.behaviours.Behaviour.actionWrapper(Behaviour.java:344)
    at jade.core.Agent$ActiveLifeCycle.execute(Agent.java:1585)
    at jade.core.Agent.run(Agent.java:1524)
    at java.lang.Thread.run(Thread.java:748)
ERROR: Agent Player1 died without being properly terminated !!!
State was 2
Dummy Agent - Fire and Forget - ENEMY !
Dummy shooting : 0.53530025

So maybe the problem is in the initialization of the agents Dummy and Player1 that don't seem to exist?