根据用户输入以 ASCII 艺术风格绘制一颗心

Draw a heart in ASCII-art style based on user input

我有一个问题希望你能帮忙解决。

Java 程序应根据用户提供的输入 N 以 ASCII 艺术风格打印爱心。

信息:

示例:

我现在的代码:

public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    System.out.println("Enter the number of hearts you want to print");
    int userInput = scan.nextInt();

    printTop(userInput);
}
public static void printTop(int userInput) {
    String row = "";
    int width = 2 * (userInput - 1) + 3 * userInput;
    for (int height = 0; height < userInput; height++) {
        for (int i = 0; i < userInput - 1; i++) {
            row += "♡";
        }
        for (int i = 0; i < userInput; i++) {
            row += "♥";
        }
        for (int i = 0; i < userInput; i++) {
            row += "♡";
        }
        for (int i = 0; i < userInput; i++) {
            row += "♥";
        }
        for (int i = 0; i < userInput - 1; i++) {
            row += "♡";
        }
        row += "\n";
    }
    System.out.println(row);
}

想法:

问题:

不错的挑战:

import java.util.Scanner;

public class A {
    public static final char COLORED = '♥';
    public static final char WHITE = '♡';

    public static void printTop(int userInput) {
        StringBuffer row = new StringBuffer();

        int width = 2 * (userInput - 1) + 3 * userInput;

        // white hearts at the outside
        int outerHearts = userInput - 1;
        // left colored section or complete
        // colored line from the widest point
        int heartsSection1 = userInput;
        // right color section or 0 from the widest point
        int heartsSection2 = userInput;
        // white hearts between 2 colored sections
        int innerHearts = userInput;

        boolean upperPart = true;
        while (heartsSection1 > 0) {
            for (int i = 0; i < outerHearts; i++) {
                row.append(WHITE);
            }
            for (int i = 0; i < heartsSection1; i++) {
                row.append(COLORED);
            }
            for (int i = 0; i < innerHearts; i++) {
                row.append(WHITE);
            }
            for (int i = 0; i < heartsSection2; i++) {
                row.append(COLORED);
            }
            for (int i = 0; i < outerHearts; i++) {
                row.append(WHITE);
            }
            row.append("\n");
            if (upperPart) {
                if (outerHearts > 0) {
                    outerHearts--;
                    innerHearts = Math.max(0, innerHearts - 2);
                    if (outerHearts == 0) {
                        heartsSection1 = width;
                        heartsSection2 = 0;
                    } else {
                        heartsSection1 += 2;
                        heartsSection2 += 2;
                    }
                } else {
                    // line with only colored hearts,
                    // from now on the hearts reduce
                    upperPart = false;
                }
            }
            if (!upperPart) {
                outerHearts++;
                heartsSection1 -= 2;
            }
            if (heartsSection1 <= 0)
                break;
        }
        System.out.println(row.toString());
    }

    public static void main(String args[]) {
        System.out.println("Enter the number of hearts you want to print");
        Scanner scan = new Scanner(System.in);
        int userInput = scan.nextInt();

        printTop(userInput);
    }
}

在我的输出中它不是一个完美的矩形,因为白色的心比彩色的心小一点。

我用下面的代码解决了这个任务:

import java.util.Scanner;

public class ChristmasHearts {
    private int userInput;
    private int height;
    private int width;
    String topHeart = "";
    String middleHeart = "";
    String bottomHeart = "";

    public ChristmasHearts(int input) {
        this.userInput = input;
    }

    public void draw() {
        calcWidthAndHeight(this.userInput);
        drawTopOfHeart();
        drawBottomOfHeart();
    }

    private void drawTopOfHeart() {
        int whites = 0;
        int blacks = 1;
        int center = 1;
        int heightOfTopHeart = 1;
        int isEvenCenterLessSubtractor = 2;
        int isNotEvenCenterLessSubtractor = 1;

        if (this.userInput == 1) {
            for (int i = 0; i < heightOfTopHeart; i++) {
                this.topHeart += "♥";
                this.topHeart += "♡";
                this.topHeart += "♥";
            }
            System.out.println(topHeart);
        } else {
            whites = this.userInput - 1;
            blacks = this.userInput;
            center = this.userInput;
            heightOfTopHeart = this.userInput - 1;

            for (int i = 0; i < heightOfTopHeart; i++) {
                for (int j = 0; j < whites; j++) {
                    this.topHeart += "♡";
                }

                for (int j = 0; j < blacks; j++) {
                    this.topHeart += "♥";
                }

                for (int j = 0; j < center; j++) {
                    this.topHeart += "♡";
                }

                if (this.userInput >= 5 && center <= 0) {
                    if (isEven(this.userInput) && center == 0) {
                        for (int j = 0; j < blacks; j++) {
                            this.topHeart += "♥";
                        }
                    } else if (isEven(this.userInput) && center < 0) {
                        int rightSideBlacks = blacks - isEvenCenterLessSubtractor;

                        for (int j = 0; j < rightSideBlacks; j++) {
                            this.topHeart += "♥";
                        }
                        isEvenCenterLessSubtractor += 2;
                    } else if (!isEven(this.userInput) && center < 0) {
                        int rightSideBlacks = blacks - isNotEvenCenterLessSubtractor;

                        for (int j = 0; j < rightSideBlacks; j++) {
                            this.topHeart += "♥";
                        }
                        isNotEvenCenterLessSubtractor += 2;
                    } else {
                        int factorToSubtract = 2;
                        int rightSideBlacks = blacks - factorToSubtract;

                        for (int j = 0; j < rightSideBlacks; j++) {
                            this.topHeart += "♥";
                        }
                        factorToSubtract += 2;
                    }
                } else {
                    for (int j = 0; j < blacks; j++) {
                        this.topHeart += "♥";
                    }
                }

                for (int j = 0; j < whites; j++) {
                    this.topHeart += "♡";
                }

                whites -= 1;
                blacks += 2;
                center -= 2;

                if (this.userInput == 0) {
                    this.topHeart = "";
                }
                System.out.println(topHeart);
                topHeart = "";
            }
        }
    }

    private void drawMiddelOfHeart() {
        for (int j = 0; j < this.width; j++) {
            this.middleHeart += "♥";
        }

        if (this.userInput == 0) {
            this.middleHeart = "";
        }

        System.out.println(this.middleHeart);
        middleHeart = "";
    }

    private void drawBottomOfHeart() {
        int whites = 1;
        int blacks = 1;
        int heightOfBottomHeart = 1;

        if (this.userInput == 1) {
            for (int i = 0; i < heightOfBottomHeart; i++) {
                this.bottomHeart += "♡";
                this.bottomHeart += "♥";
                this.bottomHeart += "♡";
            }
            System.out.println(bottomHeart);

        } else {
            heightOfBottomHeart = this.height - this.userInput;
            whites = 1;
            blacks = this.width - 2;

            drawMiddelOfHeart();
            for (int i = 0; i < heightOfBottomHeart; i++) {

                for (int j = 0; j < whites; j++) {
                    this.bottomHeart += "♡";
                }

                for (int j = 0; j < blacks; j++) {
                    this.bottomHeart += "♥";
                }

                for (int j = 0; j < whites; j++) {
                    this.bottomHeart += "♡";
                }

                blacks -= 2;
                whites += 1;

                if (this.userInput == 0) {
                    this.bottomHeart = "";
                }
                System.out.println(bottomHeart);
                bottomHeart = "";
            }
        }
    }

    private boolean isEven(int n) {
        return n % 2 == 0;
    }

    private void calcWidthAndHeight(int n) {
        this.width = 3;
        this.height = 2;

        for (int counter = 1; counter <= (n - 1); counter++) {
            this.width += 5;

            if (isEven(counter)) {
                this.height += 4;
            } else {
                this.height += 3;
            }
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();

        scanner.close();

        ChristmasHearts heart = new ChristmasHearts(input);
        heart.draw();
    }
}

画一个 ASCII 艺术心,填充和空心

想象一个坐标平面,画出一个由两个半圆和一个半菱形组成的图形。

图片1和2:

图 1 - Try it online!

int n = 6;
for (int y = -n; y <= 2 * n; y++) {
    for (int x = -2 * n; x <= 2 * n; x++)
        if ((y <= 0 &&
                ((int) Math.sqrt((x+n)*(x+n) + y*y) <= n
                        || (int) Math.sqrt((x-n)*(x-n) + y*y) <= n))
                || (y > 0 && Math.abs(x) <= 2 * n - y))
            System.out.print("♥ ");
        else
            System.out.print("♡ ");
    System.out.println();
}

输出 1:

♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ 
♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ 
♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ 
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ 
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ 
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ 
♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ 
♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ 
♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ 
♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 

图 2 - Try it online!

int n = 6;
for (int y = -n; y <= 2 * n; y++) {
    for (int x = -2 * n; x <= 2 * n; x++)
        if ((y <= 0 &&
                ((int) Math.sqrt((x+n)*(x+n) + y*y) == n
                        || (int) Math.sqrt((x-n)*(x-n) + y*y) == n))
                || (y > 0 && Math.abs(x) == 2 * n - y))
            System.out.print("♥ ");
        else
            System.out.print("♡ ");
    System.out.println();
}

输出 2:

♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ ♡ ♡ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♡ ♡ ♡ 
♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ 
♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ 
♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ 
♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ 
♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ 
♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ 
♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ 
♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ 
♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 
♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♥ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ 

另请参阅:
Print out an ASCII circle and axes with characters

您可以使用java.awt包将这些字符♥♡画成黑白图:

然后你可以打印一个二维像素数组作为组成这张图片的字符:

        ♡ ♡ ♡ ♡         ♡ ♡ ♡ ♡                 ♡ ♡ ♡ ♡         ♡ ♡ ♡           
      ♡ ♡ ♡ ♡ ♡ ♡     ♡ ♡ ♡ ♡ ♡ ♡             ♡         ♡     ♡       ♡         
    ♡ ♡ ♡ ♡ ♡ ♡ ♡   ♡ ♡ ♡ ♡ ♡ ♡ ♡           ♡           ♡   ♡           ♡       
    ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡         ♡             ♡ ♡             ♡     
    ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡         ♡             ♡               ♡     
    ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡         ♡                             ♡     
    ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡             ♡                           ♡     
      ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡             ♡                         ♡       
        ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡                 ♡                     ♡         
        ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡                     ♡                 ♡           
          ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡                       ♡                 ♡           
            ♡ ♡ ♡ ♡ ♡ ♡ ♡ ♡                         ♡             ♡             
              ♡ ♡ ♡ ♡ ♡ ♡                             ♡         ♡               
                ♡ ♡ ♡ ♡                                 ♡     ♡                 
                  ♡ ♡                                   ♡   ♡                   
                  ♡                                       ♡                     

Try it online!

public static void main(String[] args) {
  int[][] hearts = stringToPixels("♥♡", new Font(Font.SERIF, Font.PLAIN, 22), 0);
  // output
  for (int[] row : hearts) {
    StringBuilder sb = new StringBuilder();
    for (int i : row)
      sb.append(i != 0 ? "♡ " : "  ");
    if (sb.indexOf("♡") > -1)
      System.out.println(sb);
  }
}
/**
 * @param str source string to draw
 * @param f   font to render text
 * @param pd  padding as a precaution, in most cases 0
 * @return the 2D array of pixels that make up this string
 */
static int[][] stringToPixels(String str, Font f, int pd) {
  FontRenderContext ctx = new FontRenderContext(f.getTransform(), false, false);
  Rectangle bounds = f.getStringBounds(str, ctx).getBounds();
  int width = bounds.width + pd * 2;
  int height = bounds.height + pd * 2;
  BufferedImage image =
          new BufferedImage(width, height, BufferedImage.TYPE_BYTE_BINARY);
  Graphics2D graphics = (Graphics2D) image.getGraphics();
  graphics.setFont(f);
  graphics.drawString(str, pd + bounds.x, pd - bounds.y);
  //ImageIO.write(image, "png", new File("str.png"));
  int[][] pcx = new int[height][width];
  for (int i = 0; i < height; i++)
    for (int j = 0; j < width; j++)
      if (image.getRGB(j, i) == 0xFFFFFFFF)
        pcx[i][j] = 1;
  return pcx;
}

最简单的是为直线建一个char[],用空白的心填充它,然后用白色的心填充边,计算并用白色的心填充中心。

结果是非常简洁和快速的代码,但中心计算可能看起来很复杂,虽然它是一个简单的公式。

public static void printHeart(int n) {
    printHeart(n, '\u2665', '\u2661');
}

public static void printHeart(int n, char black, char white) {
    if (n <= 0)
        return;
    int width = 5 * n - 2;
    char[] buf = new char[width];
    for (int i = 1 - n; i < (width + 1) / 2; i++) {
        int outer = Math.abs(i), center = 2 - n - 2 * i;
        Arrays.fill(buf, black);
        Arrays.fill(buf, 0, outer, white);
        Arrays.fill(buf, width - outer, width, white);
        if (center > 0)
            Arrays.fill(buf, (width - center) / 2, (width + center) / 2, white);
        System.out.println(buf);
    }
}

请注意代码不需要单独的部分来打印上半部分和下半部分。这是通过将 i 从负数迭代到正数来实现的技巧,例如对于 n=4i-3 迭代到 +8,包括两者。

测试

由于我浏览器上的字体没有使用等宽的心形,结果不好,所以下面的测试使用普通字符。

for (int n = 0; n <= 6; n++)
    printHeart(n, 'X', '.');

输出

X.X
.X.
.XX..XX.
XXXXXXXX
.XXXXXX.
..XXXX..
...XX...
..XXX...XXX..
.XXXXX.XXXXX.
XXXXXXXXXXXXX
.XXXXXXXXXXX.
..XXXXXXXXX..
...XXXXXXX...
....XXXXX....
.....XXX.....
......X......
...XXXX....XXXX...
..XXXXXX..XXXXXX..
.XXXXXXXXXXXXXXXX.
XXXXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXX.
..XXXXXXXXXXXXXX..
...XXXXXXXXXXXX...
....XXXXXXXXXX....
.....XXXXXXXX.....
......XXXXXX......
.......XXXX.......
........XX........
....XXXXX.....XXXXX....
...XXXXXXX...XXXXXXX...
..XXXXXXXXX.XXXXXXXXX..
.XXXXXXXXXXXXXXXXXXXXX.
XXXXXXXXXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXXXXXX.
..XXXXXXXXXXXXXXXXXXX..
...XXXXXXXXXXXXXXXXX...
....XXXXXXXXXXXXXXX....
.....XXXXXXXXXXXXX.....
......XXXXXXXXXXX......
.......XXXXXXXXX.......
........XXXXXXX........
.........XXXXX.........
..........XXX..........
...........X...........
.....XXXXXX......XXXXXX.....
....XXXXXXXX....XXXXXXXX....
...XXXXXXXXXX..XXXXXXXXXX...
..XXXXXXXXXXXXXXXXXXXXXXXX..
.XXXXXXXXXXXXXXXXXXXXXXXXXX.
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXXXXXXXXXXX.
..XXXXXXXXXXXXXXXXXXXXXXXX..
...XXXXXXXXXXXXXXXXXXXXXX...
....XXXXXXXXXXXXXXXXXXXX....
.....XXXXXXXXXXXXXXXXXX.....
......XXXXXXXXXXXXXXXX......
.......XXXXXXXXXXXXXX.......
........XXXXXXXXXXXX........
.........XXXXXXXXXX.........
..........XXXXXXXX..........
...........XXXXXX...........
............XXXX............
.............XX.............