Sub LOTO6() ' LOTO6 Macro Dim counter1 As Long Workbooks.Add.Activate sn = 1 Worksheets.Add after:=ActiveSheet ActiveSheet.Name = "LOTO6_" + FormatNumber(sn, "000") counter = 2 counter1 = 0 retsu = 2 i = 6 j = 5 k = 4 l = 3 m = 2 n = 1 Do Until counter1 > 6096454 - 1 counter1 = counter1 + 1 If counter = 65536 Then '列を変える行数65536-1で列を変えてまつ。 counter = 2 retsu = retsu + 7 If retsu > 245 Then sn = sn + 1: retsu = 2 Worksheets.Add after:=ActiveSheet ActiveSheet.Name = "LOTO6_" + FormatNumber(sn, "000") End If End If
Cells(counter, retsu).Formula = n Cells(counter, retsu + 1).Formula = m Cells(counter, retsu + 2).Formula = l Cells(counter, retsu + 3).Formula = k Cells(counter, retsu + 4).Formula = j Cells(counter, retsu + 5).Formula = i counter = counter + 1 i = i + 1 If i > 43 Then j = j + 1: i = j + 1 If j > 42 Then k = k + 1: j = k + 1: i = j + 1 If k > 41 Then l = l + 1: k = l + 1: j = k + 1: i = j + 1 If l > 40 Then m = m + 1: l = m + 1: k = l + 1: j = k + 1: i = j + 1 If m > 39 Then n = n + 1: m = n + 1: l = m + 1: k = l + 1: j = k + 1: i = j + 1 End If End If End If End If End If Loop
Sub LOTO6Filter() ' LOTO6 filter Macro Dim counter1 As Long Workbooks.Add.Activate sn = 1 Worksheets.Add after:=ActiveSheet ActiveSheet.Name = "LOTO6_" + FormatNumber(sn, "000") counter = 2 counter1 = 0 retsu = 2 i = 6 j = 5 k = 4 l = 3 m = 2 n = 1 Do Until counter1 > 6096454 - 1 counter1 = counter1 + 1 If counter = 65536 Then '列を変える行数65536-1で列を変えてまつ。 counter = 2 retsu = retsu + 7 If retsu > 245 Then sn = sn + 1: retsu = 2 Worksheets.Add after:=ActiveSheet ActiveSheet.Name = "LOTO6_" + FormatNumber(sn, "000") End If End If
If kisuu <= 4 And kisuu >= 2 Then '奇数の数が2から4つ If teiisuu >= 2 And teiisuu <= 4 Then '低位数21以下が2つから4つ If simo1_04 >= 2 And simo1_04 <= 4 Then '下1桁が0から4の個数が2 If renban = 1 Or renban = 2 Then '連番は1個か2個 3連を許す If simo1 = 1 Then '下1桁のペアは1個 If t0 >= 90 And t0 <= 160 Then '合計数90より大かつ160より小 If sosuu >= 1 And sosuu <= 3 Then '素数の数は1から3個
Cells(counter, retsu).Formula = n Cells(counter, retsu + 1).Formula = m Cells(counter, retsu + 2).Formula = l Cells(counter, retsu + 3).Formula = k Cells(counter, retsu + 4).Formula = j Cells(counter, retsu + 5).Formula = i
counter = counter + 1 End If End If End If End If End If End If End If
i = i + 1 If i > 43 Then j = j + 1: i = j + 1 If j > 42 Then k = k + 1: j = k + 1: i = j + 1 If k > 41 Then l = l + 1: k = l + 1: j = k + 1: i = j + 1 If l > 40 Then m = m + 1: l = m + 1: k = l + 1: j = k + 1: i = j + 1 If m > 39 Then n = n + 1: m = n + 1: l = m + 1: k = l + 1: j = k + 1: i = j + 1 End If End If End If End If End If Loop
Sub LOTO6_BARAKAIPATTERN_CREATE() ' LOTO6 Macro バラ買い理論パターン作成 改良版!!
Xto6 = 8 ' エントリー数を入力 Xto6 の X CP = 4 ' バラ買いパターン本数 CP_C = 3 ' バラ買い本数前半の終わり値 MULTI_C = 21 ' マルチ本数前半の終わり値 Skima = 1 ' 各チェックポイント(CP)の次の位置間隔 P12345X = 6 ' 先頭のエントリーが含む数 Dim MULTIptn(924, 6) As Integer ' (マルチ本数, 6) Dim MATRIX(924, 924) As Integer ' (マルチ本数,マルチ本数) Dim C_ptn(924) As Integer ' (マルチ本数) Dim P_CP(46) As Integer ' (CPの値) Dim ctr As Long Dim ctr1 As Long MULTIno = Xto6 * (Xto6 - 1) * (Xto6 - 2) * (Xto6 - 3) * (Xto6 - 4) * (Xto6 - 5) / 6 / 5 / 4 / 3 / 2
i = 6: j = 5: k = 4: l = 3: M = 2: n = 1 Workbooks.Add.Activate Cells.Select Selection.ColumnWidth = 3 With Selection .HorizontalAlignment = xlCenter End With Range("A1:A2").Select With Selection .HorizontalAlignment = xlGeneral End With Columns("A:A").ColumnWidth = 15.63
Cells(1, 1) = "バラ買い理論 パターン作成" Cells(2, 1) = "マルチパターン作成中" Range("A4").Select ctr = 0 Do Until ctr > MULTIno - 1 ctr = ctr + 1 MULTIptn(ctr, 1) = CInt(n): MULTIptn(ctr, 2) = CInt(M) MULTIptn(ctr, 3) = CInt(l): MULTIptn(ctr, 4) = CInt(k) MULTIptn(ctr, 5) = CInt(j): MULTIptn(ctr, 6) = CInt(i) i = i + 1 If i > Xto6 Then j = j + 1: i = j + 1 If j > Xto6 - 1 Then k = k + 1: j = k + 1: i = j + 1 If k > Xto6 - 2 Then l = l + 1: k = l + 1: j = k + 1: i = j + 1 If l > Xto6 - 3 Then M = M + 1: l = M + 1: k = l + 1: j = k + 1: i = j + 1 If M > Xto6 - 4 Then n = n + 1: M = n + 1: l = M + 1: k = l + 1: j = k + 1: i = j + 1 End If End If End If End If End If Loop
' マルチパターン表示 22to6 以降は65536行を超える 'GoTo SKIP1 For i = 1 To MULTIno For j = 1 To 6 Cells(7 + i, 9 + j).Value = MULTIptn(i, j) Next j Next i SKIP1:
' マトリクス作成 Cells(2, 1) = "マトリクス作成中" For ctr = 1 To MULTIno Cells(3, 1) = ctr For ctr1 = 1 To MULTIno M = 0 For i = 1 To 6 For j = 1 To 6 If MULTIptn(ctr, i) = MULTIptn(ctr1, j) Then M = M + 1 End If Next j Next i If M >= 5 Then MATRIX(ctr, ctr1) = 1 End If Next ctr1 Next ctr
' マトリクス表示 11to6以上はExcelの列が足りない 'GoTo SKIP2 For i = 1 To MULTIno For j = 1 To MULTIno Cells(7 + i, 16 + j) = MATRIX(i, j) Next j Next i Range("J8:O217").Select Selection.Copy Range("Q1").Select Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _ , Transpose:=True Application.CutCopyMode = False Range("A4").Select SKIP2:
Cells(2, 1) = "バラ買いパターン走査中" For i = 1 To CP_C ' 初期CP位置決定1 P_CP(i) = 1 + (i - 1) * Sukima Next i For i = CP_C + 1 To CP ' 初期CP位置決定2 P_CP(i) = MULTI_C + 1 + (i - CP_C + 1) * Sukima Next i
count = 0 ' パターン処理回数 count100 = 100 OK = 1 Do Until P_CP(1) > P12345X ' 一本目の走査位置制限 count = count + 1 If count >= count100 Then Cells(3, 1).Value = count count100 = count100 + 100 End If For i = 1 To MULTIno C_ptn(i) = 0 ' 初期化 Next i
For i = 1 To MULTIno For j = 1 To CP If MATRIX(P_CP(j), i) = 1 Then C_ptn(i) = 1 Exit For End If Next j Next i
' バラ買いパターン表示 For i = 1 To MULTIno If C_ptn(i) <> 1 Then Exit For End If Next i If i > MULTIno Then For U = 1 To CP Cells((CP + 1) * OK + U + 2, 2) = MULTIptn(P_CP(U), 1) Cells((CP + 1) * OK + U + 2, 3) = MULTIptn(P_CP(U), 2) Cells((CP + 1) * OK + U + 2, 4) = MULTIptn(P_CP(U), 3) Cells((CP + 1) * OK + U + 2, 5) = MULTIptn(P_CP(U), 4) Cells((CP + 1) * OK + U + 2, 6) = MULTIptn(P_CP(U), 5) Cells((CP + 1) * OK + U + 2, 7) = MULTIptn(P_CP(U), 6) Next U OK = OK + 1 End If
' 走査位置移動 i_RESET = 0 P_CP(CP) = P_CP(CP) + 1 For i = CP_C + 1 To CP - 1 If P_CP(CP - i + CP_C + 1) <= MULTIno - (i - CP_C + 1) * Sukima Then Exit For End If P_CP(CP - i - 1 + CP_C + 1) = P_CP(CP - i - 1 + CP_C + 1) + 1 For j = CP - i + CP_C + 1 To CP P_CP(j) = P_CP(j - 1) + Sukima Next j Next i If P_CP(CP_C + 1) > MULTIno - (CP - CP_C - 1) * Sukima Then For i = CP_C + 1 To CP ' 初期ポインタ位置決定2 P_CP(i) = MULTI_C + 1 + (i - CP_C + 1) * Sukima Next i i_RESET = 1 End If
If i_RESET = 1 Then P_CP(CP_C) = P_CP(CP_C) + 1 For i = 0 To CP_C - 1 If P_CP(CP_C - i) <= MULTI_C - i * Sukima Then Exit For End If P_CP(CP_C - i - 1) = P_CP(CP_C - i - 1) + 1 For j = CP_C - i To CP_C P_CP(j) = P_CP(j - 1) + Sukima Next j Next i End If
Dim MULTIptn(924, 6) As Integer ' (マルチ本数, 6) Dim MATRIX(924, 924) As Integer ' (マルチ本数,マルチ本数) Dim C_ptn(924) As Integer ' (マルチ本数) Dim P_CP(46) As Integer ' (CPの値) 目的のXto6に対応したマルチパターンの数とCP値を設定します。
ちなみに>>222はこういうことですね。以下ご参考まで。 1.ソースファイルを別名で保存する。(本物を壊さないように) 2.それをテキストエディタ(何でも良い)で開く。 3.半角スペースを全角スペースに全(一括)置換※。 (前角スペースが使われていないことが前堤) 4.それを貼り付ける(と見映えが少し良くなる)。 Sub sortValues() For i = 0 To 5 For j = i To 6 If MyArray(j) < MyArray(i) Then tmp_val = MyArray(j) MyArray(j) = MyArray(i) MyArray(i) = tmp_val End If Next j Next i End Sub 5.欲しい人はコピぺして全角スペースを半角に全(一括)置換(自分でインデントを調える必要がない)。 ※インデントがタブなら1タブあたり全角スペース4個程度で全(一括)置換。 (これは簡易なエディタだと厳しいかも)
A B C D E G A C D F H J B C D E F J B E G J K L A B C D H I A C D G K L B C D F I K C D E F I L A B C D J L A C E F H I B C D G I J C D E H K L A B C E F L A C E G J L B C E H I J C D E I J K A B C E I K A C F G I J B C F G K L C D G H J K A B C F J K A C F I K L B C F I J L C E F G H K A B D E I J A C G H I K B C G H I L C E F J K L A B D F G H A D E F G K B D E F K L C F G H J L A B D G I K A D E F H L B D E G H L C H I J K L A B D H J K A D E G H J B D E H I K D E F G H I A B E F G J A D F I J K B D F H J L D F G J K L A B E G H K A D G I J L B E F G I K D G H I K L A B F G I L A E G I K L B E F H I L E G H I J L A B F H K L A E H J K L B E F H J K F G H I J K A B G H I J A F H I J L A B I J K L
Option Explicit Sub LOTO6_BARAKAIPATTERN_CREATE_FREE_VERSION() ' LOTO6 Macro バラ買い理論パターン作成 フリー版!! Dim StartP As Long Dim PStart As Long Dim MULTIno As Long Dim Xto6 As Long Dim KAI As Integer Dim KAISU As Integer Dim I As Long Dim J As Long Dim K As Long Dim L As Long Dim M As Long Dim N As Long Dim Z As Integer Dim OUT As Integer Dim MULTIptn(12376, 6) As Integer ' (マルチ本数, 6) Dim MATRIX(12376, 12376) As Integer ' (マルチ本数,マルチ本数) Dim CHOOSE(12376, 6) As Integer ' (マルチ本数) Dim COUNT As Long Dim BARACNT As Integer
I = 6: J = 5: K = 4: L = 3: M = 2: N = 1 Workbooks.Add.Activate Cells.Select Selection.ColumnWidth = 3 With Selection .HorizontalAlignment = xlCenter End With Range("A1:A2").Select With Selection .HorizontalAlignment = xlGeneral End With Columns("A:A").ColumnWidth = 15.63
Do Until COUNT > MULTIno - 1 COUNT = COUNT + 1 MULTIptn(COUNT, 1) = CInt(N): MULTIptn(COUNT, 2) = CInt(M) MULTIptn(COUNT, 3) = CInt(L): MULTIptn(COUNT, 4) = CInt(K) MULTIptn(COUNT, 5) = CInt(J): MULTIptn(COUNT, 6) = CInt(I) I = I + 1 If I > Xto6 Then J = J + 1: I = J + 1 If J > Xto6 - 1 Then K = K + 1: J = K + 1: I = J + 1 If K > Xto6 - 2 Then L = L + 1: K = L + 1: J = K + 1: I = J + 1 If L > Xto6 - 3 Then M = M + 1: L = M + 1: K = L + 1: J = K + 1: I = J + 1 If M > Xto6 - 4 Then N = N + 1: M = N + 1: L = M + 1: K = L + 1: J = K + 1: I = J + 1 End If End If End If End If End If Loop ' マルチパターン表示 22to6 以降は65536行を超える 'GoTo SKIP1 For I = 1 To MULTIno For J = 1 To 6 Cells(7 + I, 9 + J).Value = MULTIptn(I, J) Next J Next I SKIP1:
' マトリクス作成 Cells(2, 1) = "マトリクス作成中" For COUNT = 1 To MULTIno Cells(3, 1) = COUNT For COUNT100 = 1 To MULTIno M = 0 For I = 1 To 6 For J = 1 To 6 If MULTIptn(COUNT, I) = MULTIptn(COUNT100, J) Then M = M + 1 End If Next J Next I If M >= 5 Then MATRIX(COUNT, COUNT100) = 1 End If Next COUNT100 Next COUNT ' マトリクス表示 11to6以上はExcelの列が足りない GoTo SKIP2 For I = 1 To MULTIno For J = 1 To MULTIno Cells(7 + I, 16 + J) = MATRIX(I, J) Next J Next I
Do While 1 COUNT = COUNT + 1 Cells(3, 1).Value = COUNT
For I = StartP To MULTIno ' 選択パターン移動 If MULTIptn(I, 0) = 0 Then StartP = I Exit For End If Next I If I >= MULTIno Then Exit Do End If CHOOSE(StartP, 0) = 1 For I = 1 To 6 CHOOSE(StartP, I) = MULTIptn(StartP, I) ' バラ買いパターンコピー Next I For I = 1 To MULTIno If MATRIX(I, StartP) = 1 Then MULTIptn(I, 0) = 99 End If Next I
'GoTo SKIP3 For I = PStart To 1 Step -1 If MULTIptn(I, 0) = 0 Then PStart = I Exit For End If Next I If I <= 1 Then Exit Do End If CHOOSE(PStart, 0) = 1 For I = 1 To 6 CHOOSE(PStart, I) = MULTIptn(PStart, I) ' バラ買いパターンコピー 逆ポイント探し Next I For I = PStart To 1 Step -1 If MATRIX(I, PStart) = 1 Then MULTIptn(I, 0) = 99 End If Next I SKIP3: Loop
' バラ買いパターン表示 BARACNT = 0 For I = 1 To MULTIno If CHOOSE(I, 0) = 1 Then For J = 1 To 6 Cells(OUT + 8, J + 1) = CHOOSE(I, J) Next J OUT = OUT + 1 BARACNT = BARACNT + 1 End If Next I Cells(OUT + 7, 1) = BARACNT OUT = OUT + 1
For I = 1 To MULTIno ' データクリア MULTIptn(I, 0) = 0 CHOOSE(I, 0) = 0 For J = 1 To 6 CHOOSE(I, J) = 0 Next J Next I