public static void main( String[] args ) {
		final RobotState rs = new RobotState();
		final RayCaster rc = new RayCaster( 32, 32 );
		for( int i=0; i<1024; ++i ) rc.walls[i] = true;
		
		Random r = new Random();
		int tx = 16, ty = 16;
		for( int i=0; i<1024; ++i ) {
			rc.putWallAt( tx, ty, false );
			//ty += 1;
			
			if( r.nextBoolean() ) {
				tx += (r.nextBoolean() ? 1 : -1);
			} else {
				ty += (r.nextBoolean() ? 1 : -1);
			}
			
		}
		
		rc.cast( rs.px, rs.py, 0, Math.PI*2/360, rs.distanceReadings );
		
		/*
		for( int i=0; i<dist.length; ++i ) {
			dist[i] = Math.sqrt(dist[i]); //Math.sqrt(dist[i]);
		}
		*/
		
		
		final Frame window = new Frame("Robot Client");
		final ZoomDrawCanvas zdCanvas = new ZoomDrawCanvas();
		zdCanvas.setPreferredSize( new Dimension(512,384) );
		zdCanvas.setBackground( Color.BLACK );
		RadarDisplay rd = new RadarDisplay();
		rd.points = rs.distanceReadings;
		zdCanvas.zds.add(rd);
		zdCanvas.zds.add(new CenterMarker());
		zdCanvas.zoom = 64;
		zdCanvas.addKeyListener( new KeyListener() {
			@Override public void keyPressed( KeyEvent kevt ) {
				switch( kevt.getKeyCode() ) {
				case( KeyEvent.VK_UP    ): rs.py -= 1; break;
				case( KeyEvent.VK_DOWN  ): rs.py += 1; break;
				case( KeyEvent.VK_LEFT  ): rs.px -= 1; break;
				case( KeyEvent.VK_RIGHT ): rs.px += 1; break;
				default:
					System.err.println(kevt.getKeyCode());
				}
				rc.cast( rs.px, rs.py, 0, Math.PI*2/360, rs.distanceReadings );
				zdCanvas.repaint();
			}
			@Override public void keyReleased( KeyEvent kevt ) {
			}
			@Override public void keyTyped( KeyEvent kevt ) {
			}
		});
		window.add(zdCanvas);
		window.pack();
		window.addWindowListener( new WindowAdapter() {
			@Override
			public void windowClosing( WindowEvent e ) {
				window.dispose();
			}
		});
		window.setVisible(true);
		zdCanvas.requestFocus();
	}