Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (564)
Games in Android Showcase (151)
games submitted by our members
Games in WIP (605)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Problem iterating linked/synchronised list on: 2004-05-05 13:02:40
Yes, this makes sense, I'm not getting the same error, anymore.

I'm getting a different error.

It's a out of bounds exception, which I'm working on, I'll come back if I have any other questions.

2  Game Development / Newbie & Debugging Questions / Re: Problem iterating linked/synchronised list on: 2004-05-05 11:35:24
None of the answers have helped me so far, I think this is as I haven't explained my problem fully. I'll explain my algorithim, hopefully this should clear up exactly what I'm trying to do.

I have 3 lists - a near, far and known list.
The goal node is in the known list. (it's 'travel time' is known.)
all other nodes in the far list.
1.I add the nodes surrounding the goal node into the near list, removing from far list.
2.I take the first node in the near list, add the surrounding nodes of that to the end of the near list, removing from far.
3.I perform maths on this node until it's travel time is known.
4.I add this node to the known list, removing from near.
5. I then go back to stage 2 until the near list is empty (far list will also be empty, known list will be full).

As you can see I'm trying to iterate through a near list who's size is constantly changing. What can I do?
3  Game Development / Newbie & Debugging Questions / Re: Problem iterating linked/synchronised list on: 2004-05-04 22:19:24
Hmm, okay, can you give me some example code of that? Using the code I've given - say iterate a near list while adding and removing things from it, if you know what I mean.
4  Game Development / Newbie & Debugging Questions / Problem iterating linked/synchronised list on: 2004-05-04 21:11:50
Hello, I'm working on a project to perform a fast march algorithm in Java (finds the optimum path through a map from any point on the map to a goal) and I'm having a terrible old time trying to get my lists to be iterated correctly. I believe this is to do with the fact that I am attempting to alter the size of the list while I iterate it. I therefore thought I would have to use synchronised lists, which I am attempting to use but which don't change my runtime errors at all. Some example code of my problem I have listed below, the line where I get a java.util.ConcurrentModificationException is in bold. If I get this working I'll share the Fast March algorithim code here, I don't know if it's of any use to anyone, but it's an interesting piece of AI, anyway.


   private java.util.List near;
   private java.util.List far;
   private java.util.List known;
   terrain curr;

       near = Collections.synchronizedList(new LinkedList());
       far = new LinkedList();
       known = new LinkedList();
       curr =new terrain();

           ListIterator linear = near.listIterator(0);
           while ( linear.hasNext()) {
               curr = (terrain);      // selects item within the list being iterated
               if(curr.pos.x != 0){
                   else if(known.contains(map[curr.pos.x-1][curr.pos.y])){
                       ux1= map[curr.pos.x-1][curr.pos.y];
//Bunch of other checks would go here, and a whole bunch
// of maths, and finally the slowness of curr would be
//known, and we'd add it to the known list...


Pages: [1]
wxwsk8er (51 views)
2015-03-20 15:39:46

Fairy Tailz (42 views)
2015-03-15 21:52:20

Olo (28 views)
2015-03-13 17:51:59

Olo (30 views)
2015-03-13 17:50:51

Olo (33 views)
2015-03-13 17:50:16

Olo (40 views)
2015-03-13 17:47:07

ClaasJG (30 views)
2015-03-10 11:36:42

ClaasJG (37 views)
2015-03-10 11:33:01

Pippogeek (45 views)
2015-03-05 14:36:23

Pippogeek (37 views)
2015-03-05 13:56:12
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!