All pastes #944475 Raw Edit

Mine

public java v1 · immutable
·published 2008-03-16 03:22 UTC
rendered paste body
//--I CALL THIS--userMoves = Generator.entropy(userMoves,2);//--WHICH RUNS THIS: --static Queue entropy(Queue movesQueue, int whichQueue){//--THERE IS EXTRA CODE HERE--PossibleMove thismove = new PossibleMove(directionstring,placesmove);movesQueue.put((PossibleMove)thismove);//--THEN IN ANOTHER PLACE--PossibleMove test1;test1 = (PossibleMove)userMoves.getFrontElement();System.out.println(test1.getDirection());System.out.println returns NULL, why is this not casting properly?? HELP!!//Moar code:static Queue entropy(Queue movesQueue, int whichQueue){	//whichQueue .. 1 = User moves queue 2 = Computer moves queue		 Random randGen = new Random();			   if (whichQueue == 1) {		  //Generate some random moves for the user queue		   int ii = 1;		   while (ii<=21){			   							   int directionrand = randGen.nextInt(8);			   String directionstring = new String("null");			   						   			//Work out a direction from the random int generated			   			HashMap directionMap = new HashMap();			   			directionMap.put(0, new String("N"));			   			directionMap.put(1, new String("NE"));			   			directionMap.put(2, new String("E"));			   			directionMap.put(3, new String("SE"));			   			directionMap.put(4, new String("S"));			   			directionMap.put(5, new String("SW"));			   			directionMap.put(6, new String("W"));			   			directionMap.put(7, new String("NW"));			   			Set DirectionMapSet = directionMap.entrySet();			   						   	//Given the generated 1-8 (0-7) random number, place the actual direction into directionstring			   		directionstring = ((String)directionMap.get(directionrand));			   					   //Now generate the number of places to move (1 to 3)			   int placesmove = randGen.nextInt(3);			   placesmove = placesmove + 1; // numbers 1 to 3 make the logic easier in the rest of the game than 0 to 2			   					   //So now we have a direction, and a set number of places between one and three			   //Let's create a new 'PossibleMove' object that will store this data, and put it on our moves queue.			   PossibleMove thismove = new PossibleMove(directionstring,placesmove);			   movesQueue.put((PossibleMove)thismove);			   System.out.println(directionstring);			  			   //Incriment the counter for the while loop.			   ii++;