import static util.SVGUtil.*;

public class CharTurtle {
    private static final int charRange[][] = {   //　★　絵文字のコードの範囲
        { 0x2660, 0x266f },
        { 0x2bc0, 0x2bc4 }
    };

    private static int current = 0;
    private final static int nRanges = charRange.length;
    private static int c = -1;
    private static int nextChar() {
        int nextC;

        if (c == -1) {
            c = charRange[current][0];
        }   
        nextC = c++;
        if (c > charRange[current][1]) {
            current++;
            if (current >= nRanges) {
                current = 0;
            }    
            c = charRange[current][0];
        }   

        return nextC;
    }

    public static void main(String[] args) {
        double fontSize = 4;                                   /* ★ フォントサイズ */
        int num = 25;                                          /* 描く線の総数 */
        double angle = 100;                                    /* 曲がる角度 */
        int i, j, k = 0;

        start();
        rulers();
        textFont("Segoe UI Symbol", fontSize);

        direction(180);
        penUp();
        forward(60);
        turn(-36);
        for (i = 1; i <= num; i++) {
            for (j = 0; j < i; j++) {
                fill(hsb1(k++ / 14.14, 1, 1));
                say("&#x%x;", nextChar());
                forward(fontSize);
            }
            turn(angle);
        }

        center();
        direction(0);
        forward(70);

        fontSize = 3;
        textFont("Segoe UI Symbol", fontSize);
        angle = 92;
        num = 20;

        for (i = 1; i <= num; i++) {
            for (j = 0; j < i; j++) {
                fill(hsb1(k++ / 14.14, 1, 1));
                say("&#x%x;", nextChar());
                forward(fontSize);
            }
            turn(angle);
        }
        penDown();
        finish();
    }
}
