Running Error - Robot is not stopping, forcing a stop

Jump to navigation Jump to search

Running Error - Robot is not stopping, forcing a stop

Edited by 2 users.
Last edit: 17:43, 7 December 2013

When I start the battlefield,my robot and other enemy are frozen. The println messages are not displayed in the robot console. But the command prompt shows the following error. I check that the cause of error is the addition of node in my queue (queue.add(n)). However, this line of code shall be fine i guess. So I would like to ask how to solve this error message? (this part of my program is for path finding using bfs)

Thank you.


          • BATTLE 1, ROUND 1 *****

TURN 1: StudentRobot* (1) hard deadline exceeded - 532809us

Err> Robot StudentRobot* (1) is not stopping. Forcing a stop.

Err> Robot StudentRobot* (2) is not stopping. Forcing a stop.

Average computation time per turn: 511706

Max turn computation time: 532809

	private boolean pathFinding_BFS(Node start, Node end){
		LinkedList<Node> queue = new LinkedList<Node>();
		queue.add(start);
		start.setMarked();
		while (!queue.isEmpty()){
			Node temp = (Node)queue.poll();
			System.out.println("first node:" + temp.getPointInPath().getX() + " y " + temp.getPointInPath().getY());
			if (temp.equals(end)){
				temp.setPrevNodeInPath(temp.getPrevNodeInPath());
				return true;
			}else{
				for (Node n : temp.getAdjacentNode()){	
					System.out.println("in node:" + n.getPointInPath().getX() + " y " + 
n.getPointInPath().getY());
					if (!n.isMarked()){
						n.setMarked();
						n.setPrevNodeInPath(temp);
						System.out.println("test n");
						queue.add(n);  //problem here
					}
				}
			}
		}
		return false;
	}
	

	public  List<Point> getShortestPath(Point start){
		Node src = new Node(start);
		List<Point> path = new ArrayList<Point>();
		for (int i=0;i<endup.size();i++){
			Node destination = new Node(endup.get(i));
			if (pathFinding_BFS(src, destination)){
				while (destination.getPrevNodeInPath() != null){
					destination = destination.getPrevNodeInPath();
					path.add(destination.getPointInPath());
				}
				Collections.reverse(path);
				return path;
			}
		}
		return path;
	}
Lavenderwong (talk)09:03, 7 December 2013

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:Main Page/Running Error - Robot is not stopping, forcing a stop/reply.