用于循环缩放的ASCII艺术

时间:2015-12-16 17:37:53

标签: java

对于一个项目,我试图扩大用for循环制作的太空针的ASCII艺术。

我目前的代码是

public class ASCII_ForLoops {

    public static final int scale = 1;

    public static void main(String[] args) {

        a();

        d();

        b();

        e();

        a();

        c();

        d();

        b();

    }

    public static void a() {
        for (int a = 1; a < 5 * scale; a++) {
            System.out.println("         ||");

        }
    }

    public static void b() {
        System.out.print("|");
        for (int b = 1; b < 25 * scale; b++) {

            System.out.print("\"");

        }
        System.out.print("|");

    }

    public static void c() {
        for (int c = 1; c < 17 * scale; c++) {
            System.out.println("         |%%||%%|");

        }
    }

    public static void d() {

        System.out.println("          _/||\\_");
        System.out.print("       _/");

        for (int x = 1; x < 4 * scale; x++) {
            System.out.print(":");
        }

        System.out.print("||");

        for (int x = 1; x < 4 * scale; x++)

        {
            System.out.print(":");
        }

        System.out.println("\\_");

        System.out.print("    _/");

        for (int x = 1; x < 7 * scale; x++) {
            System.out.print(":");
        }

        System.out.print("||");

        for (int x = 1; x < 7 * scale; x++)

        {
            System.out.print(":");
        }

        System.out.println("\\_");

        System.out.print(" _/");

        for (int x = 1; x < 10 * scale; x++) {
            System.out.print(":");
        }

        System.out.print("||");

        for (int x = 1; x < 10 * scale; x++)

        {
            System.out.print(":");
        }

        System.out.print("\\_");
        System.out.println("");
    }

    public static void e() {
        System.out.println("   ");
        System.out.print("\\_");
        for (int x = 1; x < 12 * scale; x++) {
            System.out.print("/\\");
        }
        System.out.println("_/");

        System.out.print("  \\_");
        for (int x = 1; x < 10 * scale; x++) {
            System.out.print("/\\");
        }
        System.out.println("_/");

        System.out.print("    \\_");
        for (int x = 1; x < 8 * scale; x++) {
            System.out.print("/\\");
        }
        System.out.println("_/");

        System.out.print("      \\_");
        for (int x = 1; x < 6 * scale; x++) {
            System.out.print("/\\");
        }
        System.out.println("_/");

    }
}

这不起作用,只是使它更高而不是缩放更大而不在某些地方工作。如果有人可以帮我解决如何使用For循环这样做,那将是很好的。

0 个答案:

没有答案