src/model/map/Lighting.java
public static void computeLamp(World w, int x, int y) {
        for (int i = -RADIUS_INT; i <= RADIUS_INT; i++) {
            for (int j = -RADIUS_INT; j <= RADIUS_INT; j++) {
                if (w.withinBounds(x + i, y + j) 
                        && (w.grid[x + i][y + j].type == CellType.PATH || w.grid[x + i][y + j].type == CellType.LAMP) 
                        && !isObstructed(w, x, y, x + i, y + j)) {
                    double light = Math.pow(1 + Utils.getDistance(i, j), EXPONENT);
                    if (light < LIGHT_THRESHOLD)
                        light = 0;
                    w.grid[x + i][y + j].light = Math.max(w.grid[x + i][y + j].light, light);
                }
            }
        }
    }
/**
     * Computes the lighting for a single lamp and assigns it to that lamp.
     */
Computes the lighting for a single lamp and assigns it to that lamp.
Computes the lighting for a single lamp and assigns it to that lamp .
public static void computeLamp(World w, int x, int y) {
        for (int i = -RADIUS_INT; i <= RADIUS_INT; i++) {
            for (int j = -RADIUS_INT; j <= RADIUS_INT; j++) {
                if (w.withinBounds(x + i, y + j) 
                        && (w.grid[x + i][y + j].type == CellType.PATH || w.grid[x + i][y + j].type == CellType.LAMP) 
                        && !isObstructed(w, x, y, x + i, y + j)) {
                    double light = Math.pow(1 + Utils.getDistance(i, j), EXPONENT);
                    if (light < LIGHT_THRESHOLD)
                        light = 0;
                    w.grid[x + i][y + j].light = Math.max(w.grid[x + i][y + j].light, light);
                }
            }
        }
    }
public static void computeLamp ( World w , int x , int y ) { for ( int i = - RADIUS_INT ; i <= RADIUS_INT ; i ++ ) { for ( int j = - RADIUS_INT ; j <= RADIUS_INT ; j ++ ) { if ( w . withinBounds ( x + i , y + j ) && ( w . grid [ x + i ] [ y + j ] . type == CellType . PATH || w . grid [ x + i ] [ y + j ] . type == CellType . LAMP ) && ! isObstructed ( w , x , y , x + i , y + j ) ) { double light = Math . pow ( 1 + Utils . getDistance ( i , j ) , EXPONENT ) ; if ( light < LIGHT_THRESHOLD ) light = 0 ; w . grid [ x + i ] [ y + j ] . light = Math . max ( w . grid [ x + i ] [ y + j ] . light , light ) ; } } } }
Computes the lighting for a single lamp and assigns it to that lamp.
Computes the lighting for a single lamp and assigns it to that lamp .