[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Simple Simulation problem
From: |
Marshall, James A R |
Subject: |
RE: Simple Simulation problem |
Date: |
Tue, 2 Jul 2002 10:37:45 +0100 |
Trushar,
I've had a look at this and managed to get some way with it by changing
the way
you try to create the ObserverSwarm and ModelSwarm. For the ObserverSwarm I
replaced
your code:
displaySwarm =
(ObserverSwarm)Globals.env.lispAppArchiver.getWithZone$key(Globals.env.globa
lZone, "displaySwarm");
with:
displaySwarm = new ObserverSwarm(Globals.env.globalZone);
and similarly for the ModelSwarm I replaced:
modelSwarm =
(ModelSwarm)Globals.env.lispAppArchiver.getWithZone$key(modelZone,
"modelSwarm");
with:
modelSwarm = new ModelSwarm(modelZone);
In both cases getWithZone$key was returning a null pointer, i.e. no
object. I haven't looked at the tutorials
in depth but I'm unfamiliar with this way of creating objects in Swarm... I
normally just create them directly
as I have shown above. If there's merit in another way of doing it I would
appreciate someone pointing it out...
I haven't got time to investigate at the moment.
Anyway, after that you get a null pointer exception on line 86 of
ObserverSwarm.java:
a1bug.setBugColor((byte)1);
This is because a1bug has not been initialised (created). You do
initialise this member of ModelSwarm, so work
from that.
James
---
Dr James A R Marshall
Container World Project - http://www.ese.ic.ac.uk/research/containerworld/
Department of Earth Sciences and Engineering, Imperial College, London
Tel: +44 (0)20 7594 7493
Fax: +44 (0)20 7594 7444
-----Original Message-----
From: Trushar Panchal [mailto:address@hidden
Sent: 02 July 2002 04:26
To: address@hidden
Subject: Re: Simple Simulation problem
Hi Paul,
Thanks for your advise. I am sending you the zip file as you requested.
Also I missed to initialise the file Agent1/2.java with int a=0; which
i have done. I use Win 2000 and java. It compiles without any problems
and comes up with the Control Panel but the Display window and the
Probe Windows are not coming up. Once I click 'Start' this is the two
output i get.
address@hidden/Java/JavaSwarm/FirstSimulation] $ make
/Swarm-2.1.1/bin/javacswarm StartSimulation.java AssignValue.java
Agent1.java Agent2.java ModelSwarm.java ObserverSwarm.java
SwarmUtils.java
address@hidden/Java/JavaSwarm/FirstSimulation] $ javaswarm
StartSimulation
SimpleBug number 1 has been created at 40, 0
SimpleBug number 2 has been created at 40, 80
address@hidden/Java/JavaSwarm/FirstSimulation] $
I hope this might help you to help me. This is very similar to the
tutorial given. This simulation works if I kick out ObserverSwarm.java
file and work only with ModelSwarm.java (making changes in
StartSimulation.java of course).
Hope you will be able to help me out here and get me a display where I
can see 2 agents roaming in the world. I will be really thankful if you
can help me get through as i am struggling with this. Thanks a lot.
Regards
Trushar
Quoting Paul E Johnson <address@hidden>:
> I'm looking at your package now.
>
> Next time you wrap something up, delete the *.class files and save a
>
> directory name, so that when I unzip your package, the files create
>
> their own directory and they all stay together.
>
> I don't understand what your command to compile this might be.
>
> It Looks to me that nothing compiles because you have this undefined
> "a"
> here in Agent1.java and Agent2.java:
>
>
> if (assValue.getValueAtX$Y(xPos, yPos) == 1)
> {
> a = assValue.getValueAtX$Y(xPos, yPos);
> System.out.println("Agent " + bugNumber + " has
> found
> Content of "+ a + " at " + xPos + ", " + yPos);
> }
>
>
> After I fix that (make a a double), I get some monkey business that
>
> means trouble in my machine, I think. On RedHat linux, this indicates
>
> some problem with the way I'm building the rpm, I think.
>
> Is this what you do?
>
> $ javacswarm StartSimulation.java
>
> Look what I get! I have no idea why a c++ dependency would arise. For
>
> c++ libraries I do have:
>
> ./lib/libstdc++-3-libc6.2-2-2.10.0.so
> ./lib/libstdc++-libc6.2-2.so.3
> ./lib/libstdc++-3-libc6.2-2-2.10.0.a
> ./lib/libstdc++-libc6.2-2.a.3
>
> $ javaswarm StartSimulation
> Error: failed /usr/local/j2sdk1.4.0/jre/lib/i386/client/libjvm.so,
> because libstdc++-libc6.1-1.so.2: cannot open shared object file: No
>
> such file or directory
>
> So, sorry, don't know how to help.
>
> --
> Paul E. Johnson email: address@hidden
> Dept. of Political Science
> http://lark.cc.ku.edu/~pauljohn
> 1541 Lilac Lane, Rm 504
> University of Kansas Office: (785) 864-9086
> Lawrence, Kansas 66044-3177 FAX: (785) 864-5700
>
>
> ==================================
> Swarm-Support is for discussion of the technical details of the
> day
> to day usage of Swarm. For list administration needs (esp.
> [un]subscribing), please send a message to
> <address@hidden>
> with "help" in the body of the message.
>
>
Mr. Trushar Panchal
PhD Computer Science
Department of Computer Science
University of Hertfordshire
78 Telford Court, Bishops Rise
Hatfield, Herts, AL10 9BT UK
Phone : +44 (0) 1707 28 5035/5118
Mobile: +44 (0) 77 1234 3692
http://www.trushar-panchal.co.uk
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.