All pastes #344871 Raw Edit

Someone

public java v1 · immutable
·published 2007-02-08 01:59 UTC
rendered paste body
public class run {	public static void main ( String args[] ) {				Robot robot = new Robot (args.length>0? args[0] : "");				int white_index=0;     // white pointer		int blue_index=0;      // blue pointer		int red_index=robot.nbins()-1; // red pointer		int nb_swaps=0;        // swap counter		 		if (red_index <= 0) {			robot.report();			return;		}				while (white_index <= red_index)		{		    switch( robot.peek(white_index) )		     {		      case 'w': 		       white_index++; 		       break;		 		      case 'r':		       robot.swap(blue_index,white_index);		       blue_index++;		       white_index++;		       break;		 		      default:		      case 'b':		       robot.swap(white_index,red_index);		       red_index--;		       break;		     }		}		    		robot.report();	}}