Vorige Pagina About the Author

' Check Order 17 Quadrant Magic Patterns (General)

' Routines P01 ... P253 contain the equations describing the correponding pattern and a call to Ctn17 (Count Patterns)
' (not available in HTML)

' Tested with Office 365 under Windows 10

Public a(289)
Public nP(253, 4), nQ(253), s(4)
Dim s1

Sub ChkPtrn17()

y = MsgBox("Blocked", vbInformation, "ChkPtrn")
End

ShtNm1 = "QrtLns17"     'Input
ShtNm2 = "PtrnCnt17"    'Print Quadrant Count

For j100 = 2 To 2

    For i1 = 1 To 289   'Read available Square(s)
    
        a(i1) = Sheets(ShtNm1).Cells(j100, i1).Value
    
    Next i1

    GoSub 700: If fl1 = 0 Then GoTo 1000    'Check Magic Patterns (General)

    n9 = n9 + 1: GoSub 600                  'Print Paterns

For i1 = 1 To 253

For i2 = 1 To 4
    Cells(i1 + 4, i2).Value = nP(i1, i2)
Next i2
Cells(i1 + 4, 5).Value = nQ(i1)
Cells(i1 + 4, 6).Value = i1

Next i1

1000 Next j100

End

'   Print Patterns

600 nQ4 = 0

    For i1 = 1 To 253
        Cells(n9 + 1, i1) = nQ(i1)
        If nQ(i1) = 4 Then nQ4 = nQ4 + 1
    Next i1
    Cells(n9 + 1, 254).Value = nQ4
    Cells(n9 + 1, 255).Value = n9
    
''    Cells(1, 256).Value = n9
    Return

'   Check Magic Patterns (Testing)

700 fl1 = 1: Erase nP, nQ, s

    P01 1:    P02 2:    P03 3:    P04 4:    P05 5:    P06 6:    P07 7:    P08 8:    P09 9:    P10 10:
    P11 11:   P12 12:   P13 13:   P14 14:   P15 15:   P16 16:   P17 17:   P18 18:   P19 19:   P20 20:
    P21 21:   P22 22:   P23 23:   P24 24:   P25 25:   P26 26:   P27 27:   P28 28:   P29 29:   P30 30:
    P31 31:   P32 32:   P33 33:   P34 34:   P35 35:   P36 36:   P37 37:   P38 38:   P39 39:   P40 40:
    P41 41:   P42 42:   P43 43:   P44 44:   P45 45:   P46 46:   P47 47:   P48 48:   P49 49:   P50 50:
    P51 51:   P52 52:   P53 53:   P54 54:   P55 55:   P56 56:   P57 57:   P58 58:   P59 59:   P60 60:
    P61 61:   P62 62:   P63 63:   P64 64:   P65 65:   P66 66:   P67 67:   P68 68:   P69 69:   P70 70:
    P71 71:   P72 72:   P73 73:   P74 74:   P75 75:   P76 76:   P77 77:   P78 78:   P79 79:   P80 80:
    P81 81:   P82 82:   P83 83:   P84 84:   P85 85:   P86 86:   P87 87:   P88 88:   P89 89:   P90 90:
    P91 91:   P92 92:   P93 93:   P94 94:   P95 95:   P96 96:   P97 97:   P98 98:   P99 99:   P100 100:
    P101 101: P102 102: P103 103: P104 104: P105 105: P106 106: P107 107: P108 108: P109 109: P110 110:
    P111 111: P112 112: P113 113: P114 114: P115 115: P116 116: P117 117: P118 118: P119 119: P120 120:
    P121 121: P122 122: P123 123: P124 124: P125 125: P126 126: P127 127: P128 128: P129 129: P130 130:
    P131 131: P132 132: P133 133: P134 134: P135 135: P136 136: P137 137: P138 138: P139 139: P140 140:
    P141 141: P142 142: P143 143: P144 144: P145 145: P146 146: P147 147: P148 148: P149 149: P150 150:
    P151 151: P152 152: P153 153: P154 154: P155 155: P156 156: P157 157: P158 158: P159 159: P160 160:
    P161 161: P162 162: P163 163: P164 164: P165 165: P166 166: P167 167: P168 168: P169 169: P170 170:
    P171 171: P172 172: P173 173: P174 174: P175 175: P176 176: P177 177: P178 178: P179 179: P180 180:
    P181 181: P182 182: P183 183: P184 184: P185 185: P186 186: P187 187: P188 188: P189 189: P190 190:
    P191 191: P192 192: P193 193: P194 194: P195 195: P196 196: P197 197: P198 198: P199 199: P200 200:
    P201 201: P202 202: P203 203: P204 204: P205 205: P206 206: P207 207: P208 208: P209 209: P210 210:
    P211 211: P212 212: P213 213: P214 214: P215 215: P216 216: P217 217: P218 218: P219 219: P220 220:
    P221 221: P222 222: P223 223: P224 224: P225 225: P226 226: P227 227: P228 228: P229 229: P230 230:
    P231 231: P232 232: P233 233: P234 234: P235 235: P236 236: P237 237: P238 238: P239 239: P240 240:
    P241 241: P242 242: P243 243: P244 244: P245 245: P246 246: P247 247: P248 248: P249 249: P250 250:
    P251 251: P252 252: P253 253:

    Return

End Sub

Sub Cnt17(i1)   'Count Patterns

    s1 = 2465   'Magic Constant

    For i2 = 1 To 4
        If s(i2) = s1 Then nP(i1, i2) = 1: nQ(i1) = nQ(i1) + 1
    Next i2

End Sub

Vorige Pagina About the Author