import java.util.Random; public class RanWalk {
  public static void main(String args[]) throws InterruptedException
  {
    Random r = new Random();
    int wide = 60;
    int height = 20;

    int x = wide / 2;
    int y = height / 2;
    int val;
    Screen s = new Screen(wide, height);
    while(true)
    {
      s.setPixel(x, y, '*');
      val = r.nextInt(4);
      if(val == 0)
        x += 1;
      else if(val == 1)
        x-= 1;
      else if(val == 2) 
        y += 1;
      else
        y -= 1;
      System.out.print(s);
      Thread.sleep(150);
    }
  }
}
