/**
  * Returns the light value at the given coordinate.
  *
  * @param x
  * @param y
  * @return int An integer between 0 and 1023 representing the light value.
  * @throws IllegalArgumentException When the x or y coordinates are not valid |
  *     !sensors.isValid(x,y)
  */
 public int getLightValue(int x, int y) {
   int correctedY = sensors.getMaxY() - y;
   if (sensors.isValid(x, correctedY)) {
     int clr = img.getRGB(x, correctedY);
     int lightValue = calculateLightValue(clr);
     //		  System.out.println("Lightsensor white-value: "+lightValue);
     return lightValue;
   } else {
     throw new IllegalArgumentException("X or Y out of bounds");
   }
 }