fork download
  1. import java.util.Arrays;
  2. public class Main {
  3. public static void main(String args[]) {
  4. // char[][]b = {{'a','b','a'},{'b','a','b'},{'a','b','a'}};
  5. // int[][]t = {{1,1,1},{2,0,1},{2,0,0}};
  6. char[][]b = {{'.', ',', '.', ',', '.', ',', '.'},{'.', ',', '.', ',', '.', ',', '.'},{'.', ',', '.', ',', '.', ',', '1'}};
  7. int[][]t = {{0,1,0,0,1,2,0},{1,1,1,2,2,2,2},{0,2,0,0,0,1,0}};
  8. m(b,t);
  9. }
  10.  
  11. static void m(char[][]b,int[][]t){var z="";int w=b[0].length,h=b.length,j=0,i,x,y,n,d,e;char c,r[][]=new char[h*8][w*8];for(;j<h;j++){for(i=0;i<w;i++){for(x=0;x<8;x++)for(y=0;y<8;y++){r[j*8+y][i*8+x]=b[j][i];n=t[j][i];if(n!=0){if(n==1){c=64;e=0;d=7;}else{c=35;e=1;d=6;}if(x>e&y>e&x<d&y<d)r[j*8+y][i*8+x]=c;if(x>e&x<d){if(j>0&y<2&&t[j-1][i]!=0)r[j*8+y][i*8+x]=c;if(j<h-1&y>5&&t[j+1][i]!=0)r[j*8+y][i*8+x]=c;}if(y>e&y<d){if(i>0&x<2&&t[j][i-1]!=0)r[j*8+y][i*8+x]=c;if(i<w-1&x>5&&t[j][i+1]!=0)r[j*8+y][i*8+x]=c;}}}}for(x=0;x<8;z+=" ")System.out.println(z+Arrays.toString(r[j*8+x++]).replaceAll("[\\[\\]]|[, ]\\s",""));}}
  12.  
  13. }
Success #stdin #stdout 0.18s 55280KB
stdin
Standard input is empty
stdout
........,,,,,,,,........,,,,,,,,........,,,,,,,,........
 ........,@@@@@@,........,,,,,,,,.@@@@@@@,,,,,,,,........
  ........,@@@@@@,........,,,,,,,,.@@@@@@@######,,........
   ........,@@@@@@,........,,,,,,,,.@@@@@@@######,,........
    ........,@@@@@@,........,,,,,,,,.@@@@@@@######,,........
     ........,@@@@@@,........,,,,,,,,.@@@@@@@######,,........
      ........,@@@@@@,........,,,,,,,,.@@@@@@@,,####,,........
       ........,@@@@@@,........,,,,,,,,.@@@@@@.,,####,,........
        ........,@@@@@@,........,,,,,,,,..####..,,####,,........
         .@@@@@@@@@@@@@@@@@@@@@@@,,,,,,,,..####..,,####,,........
          .@@@@@@@@@@@@@@@@@@@@@@@##############################..
           .@@@@@@@@@@@@@@@@@@@@@@@##############################..
            .@@@@@@@@@@@@@@@@@@@@@@@##############################..
             .@@@@@@@@@@@@@@@@@@@@@@@##############################..
              .@@@@@@@@@@@@@@@@@@@@@@@,,,,,,,,........,,####,,........
               ........,@@@@@@,........,,,,,,,,........,,####,,........
                ........,,####,,........,,,,,,,,........,@@@@@@,11111111
                 ........,,####,,........,,,,,,,,........,@@@@@@,11111111
                  ........,,####,,........,,,,,,,,........,@@@@@@,11111111
                   ........,,####,,........,,,,,,,,........,@@@@@@,11111111
                    ........,,####,,........,,,,,,,,........,@@@@@@,11111111
                     ........,,####,,........,,,,,,,,........,@@@@@@,11111111
                      ........,,,,,,,,........,,,,,,,,........,@@@@@@,11111111
                       ........,,,,,,,,........,,,,,,,,........,,,,,,,,11111111