魔星陣

 投稿者:しばっち  投稿日:2011年11月13日(日)20時09分4秒
  魔星陣? (魔方陣の星型版)

FOR A = 1 TO 12
   FOR B = 1 TO 12
      IF A = B THEN GOTO 60
      FOR C = 1 TO 12
         IF A = C OR B = C THEN GOTO 50
         FOR D = 1 TO 12
            IF A = D OR B = D OR C = D THEN GOTO 40
            LET  E = 26 - D - C - B
            IF E < 1 THEN EXIT FOR
            IF E > 12 THEN GOTO 40
            IF A = E OR B = E OR C = E OR D = E THEN GOTO 40
            FOR F = 1 TO 12
               IF A = F OR B = F OR C = F OR D = F OR E = F THEN GOTO 30
               LET  H = 26 - A - C - F
               IF H < 1 THEN EXIT FOR
               IF H > 12 THEN GOTO 30
               IF A = H OR B = H OR C = H OR D = H OR E = H OR F = H THEN GOTO 30
               FOR I = 1 TO 12
                  IF A = I OR B = I OR C = I OR D = I OR E = I OR F = I OR H = I THEN GOTO 20
                  LET  L = 26 - B - F - I
                  IF L < 1 THEN EXIT FOR
                  IF L > 12 THEN GOTO 20
                  IF A = L OR B = L OR C = L OR D = L OR E = L OR F = L OR H = L OR I = L THEN GOTO 20
                  FOR G = 1 TO 12
                     IF A = G OR B = G OR C = G OR D = G OR E = G OR F = G OR H = G OR I = G OR L = G THEN GOTO 10
                     LET  K = 26 - A - D - G
                     IF K < 1 THEN EXIT FOR
                     IF K > 12 THEN GOTO 10
                     IF A = K OR B = K OR C = K OR D = K OR E = K OR F = K OR H = K OR I = K OR L = K OR G = K THEN GOTO 10
                     LET  J = 26 - H - I - K
                     IF J < 1 THEN GOTO 10
                     IF J > 12 THEN GOTO 10
                     IF A = J OR B = J OR C = J OR D = J OR E = J OR F = J OR H = J OR I = J OR L = J OR G = J OR K = J THEN GOTO 10
                     LET  NO = NO + 1
                     PRINT "No."; NO
                     PRINT USING "      ##":A
                     PRINT USING "##  ##  ##  ##":B,C,D,E
                     PRINT USING "  ##      ##":F,G
                     PRINT USING "##  ##  ##  ##":H,I,J,K
                     PRINT USING "      ##":L
10                   NEXT G
20                NEXT I
30             NEXT F
40          NEXT D
50       NEXT C
60    NEXT B
70 NEXT A
END
 

戻る