import java.awt.*;
public class JRobo
{
int x; int y;
boolean draw; int heading;
Graphics robog;
JRobo( Graphics g )
{
x = 200;
y = 150;
draw = true;
heading = 0;
robog = g;
}
public void r( int degrees )
{
heading = ( heading + degrees ) % 360;
}
public void l( int degrees )
{
heading = ( heading - degrees ) % 360;
}
public void f( int distance)
{
int dx, dy;
dx = ( int ) Math.round( distance * Math.sin( heading * 2 * 3.142 / 360 ) * 500/1000 );
dy = ( int ) Math.round( distance * -Math.cos( heading * 2 * 3.142 / 360 ) * 500/1000 );
if ( draw )
robog.drawLine( x, y, x + dx, y + dy );
x = x + dx;
y = y + dy;
}
public void p( ) {
draw = ! draw;
}
}