Skip to main content
deleted 53 characters in body
Source Link

C, 291 280 277 273265 bytes

x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);y<20;y+=!x)s=0,t=1,U(A=a-x,C=c-x),U(B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);}
// Integers...
x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){ 
    // Read input; p0=(a,b), p1=(c,d)
    for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w); y<20; y+=!x)
       
        // A, B, C and D represent delta-x and delta-y for each points
        // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
        A=a-x,C=c-x,
        B=b-y,D=d-y,
    
        // s != 0 iff (x,y) can have some laser through it
        // t == 1 iff all lasers pass through (x,y)
        // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
        s=0,t=1,U(AA=a-x,CC=c-x),U(BB=b-y,DD=d-y),U(A-B,C-D),U(A+B,C+D),
        putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);
}

C, 291 280 277 273 bytes

x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);y<20;y+=!x)A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);}
// Integers...
x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){ 
    // Read input; p0=(a,b), p1=(c,d)
    for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w); y<20; y+=!x)
       
       // A, B, C and D represent delta-x and delta-y for each points
        // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
        A=a-x,C=c-x,
        B=b-y,D=d-y,
    
        // s != 0 iff (x,y) can have some laser through it
        // t == 1 iff all lasers pass through (x,y)
        // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
        s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
        putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);
}

C, 291 280 277 265 bytes

x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);y<20;y+=!x)s=0,t=1,U(A=a-x,C=c-x),U(B=b-y,D=d-y),U(A-B,C-D),U(A+B,C+D),putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);}
// Integers...
x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){ 
    // Read input; p0=(a,b), p1=(c,d)
    for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w); y<20; y+=!x)
       
        // A, B, C and D represent delta-x and delta-y for each points
        // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
        // s != 0 iff (x,y) can have some laser through it
        // t == 1 iff all lasers pass through (x,y)
        // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
        s=0,t=1,U(A=a-x,C=c-x),U(B=b-y,D=d-y),U(A-B,C-D),U(A+B,C+D),
        putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);
}
added 2 characters in body
Source Link

C, 291 280 277277 273 bytes

r,x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);A=a;y<20;y+=!x)A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=r%21x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),y<20;y=++r/21);}
// Integers...
r,x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){for(
 
    // Read input; p0=(a,b), p1=(c,d)
    for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w); y<20; y+=!x)
       
       // A, B, C and D represent delta-x and delta-y for each points
        // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
        A=a-x,C=c-x,
        B=b-y,D=d-y,
    
        // s != 0 iff (x,y) can have some laser through it
        // t == 1 iff all lasers pass through (x,y)
        // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
        s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
        putchar((x=r%21x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),

    // End of for
    y<20;y=++r/21);
}

C, 291 280 277 bytes

r,x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),y<20;y=++r/21);}
// Integers...
r,x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){for(

    // Read input; p0=(a,b), p1=(c,d)
    scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);

    // A, B, C and D represent delta-x and delta-y for each points
    // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
    A=a-x,C=c-x,
    B=b-y,D=d-y,

    // s != 0 iff (x,y) can have some laser through it
    // t == 1 iff all lasers pass through (x,y)
    // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
    s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
    putchar((x=r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),

    // End of for
    y<20;y=++r/21);
}

C, 291 280 277 273 bytes

x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);y<20;y+=!x)A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);}
// Integers...
x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){ 
    // Read input; p0=(a,b), p1=(c,d)
    for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w); y<20; y+=!x)
       
       // A, B, C and D represent delta-x and delta-y for each points
        // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
        A=a-x,C=c-x,
        B=b-y,D=d-y,
    
        // s != 0 iff (x,y) can have some laser through it
        // t == 1 iff all lasers pass through (x,y)
        // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
        s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
        putchar((x=++x%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10);
}
added 46 characters in body
Source Link

C, 291 280280 277 bytes

r,x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<=0;*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=++r%21x=r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),r<420; y=ry<20;y=++r/21);}
// Integers...
r,x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<=0;*j*k<1;
}
    
main(){for(
    
    // Read input; p0=(a,b), p1=(c,d)
    scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);

    // A, B, C and D represent delta-x and delta-y for each points
    // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
    A=a-x,C=c-x,
    B=b-y,D=d-y,
    
    // s != 0 iff (x,y) can have some laser through it
    // t == 1 iff all lasers pass through (x,y)
    // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
    s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
    putchar((x=++r%21x=r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),
    
    // End of for
    r<420; y=ry<20;y=++r/21);
}

C, 291 280 bytes

r,x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<=0;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=++r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),r<420; y=r/21);}
// Integers...
r,x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<=0;
}
    
main(){for(
    
    // Read input; p0=(a,b), p1=(c,d)
    scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);

    // A, B, C and D represent delta-x and delta-y for each points
    // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
    A=a-x,C=c-x,
    B=b-y,D=d-y,
    
    // s != 0 iff (x,y) can have some laser through it
    // t == 1 iff all lasers pass through (x,y)
    // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
    s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
    putchar((x=++r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),
    
    // End of for
    r<420; y=r/21);
}

C, 291 280 277 bytes

r,x,y,A,C,B,D,a,c,b,d,w,s,t;T(i){return abs(i)<2*w-1;}U(j,k){s+=T(j-k)*T(j)*T(k);t*=T(j-k)*j*k<1;}main(){for(scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);A=a-x,C=c-x,B=b-y,D=d-y,s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),putchar((x=r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),y<20;y=++r/21);}
// Integers...
r,x,y,A,C,B,D,a,c,b,d,w,s,t;

// Is true if i is in range (of something)
T(i){return abs(i)<2*w-1;}

// Tests if lasers (horizontal, vertical, diagonal, etc) can/must exist at this point
// T(j-k) == 0 iff the laser of this direction can exist
// s += 1 iff this laser direction can pass through this point
// t *= 1 iff this laser direction must pass through this point
U(j,k){
    s+=T(j-k)*T(j)*T(k);
    t*=T(j-k)*j*k<1;
}

main(){for(

    // Read input; p0=(a,b), p1=(c,d)
    scanf("%i%i%i%i%i",&a,&b,&c,&d,&w);

    // A, B, C and D represent delta-x and delta-y for each points
    // e.g.: if we're processing (2,3), and p0=(4,5), A=4-2, B=5-3
    A=a-x,C=c-x,
    B=b-y,D=d-y,

    // s != 0 iff (x,y) can have some laser through it
    // t == 1 iff all lasers pass through (x,y)
    // (!A*!B+!C*!D) == 1 iff (x,y) is either p0 or p1  
    s=0,t=1,U(A,C),U(B,D),U(A-B,C-D),U(A+B,C+D),
    putchar((x=r%21)?".?#x"[!!s+t+(!A*!B+!C*!D)]:10),

    // End of for
    y<20;y=++r/21);
}
deleted 9 characters in body
Source Link
Loading
Source Link
Loading