swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Does any body help me!!


From: Marshall, James A R
Subject: RE: Does any body help me!!
Date: Tue, 13 Aug 2002 11:03:27 +0100

Tiago,
  your problem was caused by an attempt to access an element in a Grid2d
object that was out of the bounds of that object. As with most things in
programming languages (e.g. arrays), Grid2d's co-ordinate system starts at
0, meaning that the largest valid co-ordinate on a given axis is actually
the size of the Grid2d on that axis minus 1, i.e.
maxXcoord = xSize - 1
  I've rewritten your code in Agent.java as follows:
    // flat world
    if (newX >= worldXSize)
      newX = worldXSize - 1;
    if (newY >= worldYSize)
      newY = worldYSize - 1;
    if (newX < 0)
      newX = 0;
    if (newY < 0)
      newY = 0;

Note that as well as changing
  newX = worldXSize;
to
  newX = worldXSize - 1;
and doing the same for newY, I've also changed
  newX = 1;
to
  newX = 0;
and similarly for newY
as this maintains consistent behaviour for the agents at each edge of the
grid.
  You should really learn how to use the debugger (I think JBuilder has one
built in), and in conjunction with the Swarm javadocs you should be able to
solve most simple problems like this.
        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: Tiago Simas [mailto:address@hidden
Sent: 12 August 2002 20:10
To: address@hidden
Subject: Re: Does any body help me!!


Hi, my source code is attach.
Thank's
Tiago.

----- Original Message -----
From: "Marshall, James A R" <address@hidden>
To: <address@hidden>
Sent: Monday, August 12, 2002 12:13 PM
Subject: RE: Does any body help me!!


> Tiago,
>   I suspect this may be a null-pointer exception, where an attempt is made
> to access an object that does not exist. Unless you include your soure
code,
> no-one will be able to help you further.
> 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: Tiago Simas [mailto:address@hidden
> Sent: 12 August 2002 19:10
> To: address@hidden
> Subject: Does any body help me!!
>
>
> Hi, Swarm to me has been hard!!!
> Anybody know what could be the possible problem with my program! I'm using
> JBuilder 6.0 with swarm in windows 2000 enviroment. I've received the
> following message when I'm runing the program:
>
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x1011d6e0
> Function name=swarm_directory_objc_ensure_java
> Library=C:\Swarm-2.1.1\bin\javaswarm.dll
>
> Current Java thread:
>  at swarm.space.Grid2dImpl.getObjectAtX$Y(Native Method)
>  at simpleagent.Agents.randomWalk(Agents.java:62)
>  at swarm.simtoolsgui.GUISwarmImpl.go(Native Method)
>  at simpleagent.StartAgents.main(StartAgents.java:22)
>
> Dynamic libraries:
> 0x00400000 - 0x00405000  C:\JBuilder6\jdk1.3.1\bin\javaw.exe
> 0x77F50000 - 0x77FF9000  C:\WINDOWS\System32\ntdll.dll
> 0x77E60000 - 0x77F45000  C:\WINDOWS\system32\kernel32.dll
> 0x77DD0000 - 0x77E5B000  C:\WINDOWS\system32\ADVAPI32.dll
> 0x77CC0000 - 0x77D35000  C:\WINDOWS\system32\RPCRT4.dll
> 0x77D40000 - 0x77DCD000  C:\WINDOWS\system32\USER32.dll
> 0x77C70000 - 0x77CB0000  C:\WINDOWS\system32\GDI32.dll
> 0x77C10000 - 0x77C63000  C:\WINDOWS\system32\MSVCRT.dll
> 0x6D420000 - 0x6D4EF000  C:\JBuilder6\jdk1.3.1\jre\bin\hotspot\jvm.dll
> 0x76B40000 - 0x76B6C000  C:\WINDOWS\System32\WINMM.dll
> 0x6D220000 - 0x6D227000  C:\JBuilder6\jdk1.3.1\jre\bin\hpi.dll
> 0x6D3B0000 - 0x6D3BD000  C:\JBuilder6\jdk1.3.1\jre\bin\verify.dll
> 0x6D250000 - 0x6D266000  C:\JBuilder6\jdk1.3.1\jre\bin\java.dll
> 0x6D3C0000 - 0x6D3CD000  C:\JBuilder6\jdk1.3.1\jre\bin\zip.dll
> 0x10000000 - 0x108D1000  C:\Swarm-2.1.1\bin\javaswarm.dll
> 0x61000000 - 0x6109F000  C:\Swarm-2.1.1\bin\cygwin1.dll
> 0x60540000 - 0x605AA000  C:\Swarm-2.1.1\bin\BLT24.dll
> 0x66000000 - 0x66161000  C:\Swarm-2.1.1\bin\cygtcl80.dll
> 0x66300000 - 0x664EF000  C:\Swarm-2.1.1\bin\cygtk80.dll
> 0x763B0000 - 0x763F5000  C:\WINDOWS\system32\COMDLG32.DLL
> 0x772D0000 - 0x77333000  C:\WINDOWS\system32\SHLWAPI.dll
> 0x77340000 - 0x773CB000  C:\WINDOWS\system32\COMCTL32.dll
> 0x69800000 - 0x69FEE000  C:\WINDOWS\system32\SHELL32.dll
> 0x71950000 - 0x71A34000
>
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0
> .0.0_x-ww_1382d70a\comctl32.dll
> 0x71C20000 - 0x71C6F000  C:\WINDOWS\System32\netapi32.dll
> 0x76F90000 - 0x76FA0000  C:\WINDOWS\System32\Secur32.dll
> 0x5AD70000 - 0x5ADA4000  C:\WINDOWS\system32\uxtheme.dll
> 0x63000000 - 0x63014000  C:\WINDOWS\System32\SynTPFcs.dll
> 0x77C00000 - 0x77C07000  C:\WINDOWS\system32\VERSION.dll
> 0x76C90000 - 0x76CB2000  C:\WINDOWS\system32\imagehlp.dll
> 0x6D510000 - 0x6D58C000  C:\WINDOWS\system32\DBGHELP.dll
> 0x76BF0000 - 0x76BFB000  C:\WINDOWS\System32\PSAPI.DLL
>
> Local Time = Mon Aug 12 11:54:54 2002
> Elapsed Time = 4
> #
> # The exception above was detected in native code outside the VM
> #
> # Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
> #
> # An error report file has been saved as hs_err_pid1248.log.
> # Please refer to the file for further information.
> #
> Thank's
> Tiago.
>
>
>
>                   ==================================
>    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.
>
>                   ==================================
>    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.
>
>

                  ==================================
   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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]