When I translated Twelve Statements to JB, I added near misses for extra RC credit. I also trimmed the fat and got it down to 35 LOC:
Code: (Select All)
_Title "12 Statements #2 Missing by 1" ' b+ 2022-10-31
Dim As Long i, saveI
For n = 0 To 4095 ' 2 ^ 12 = 4096 permutations of TF for 12 digits positions
ReDim As Long st(12), TF(12) 'reset and get a TF scenario and compare to 12 statements
For i = 0 To 11
If n And 2 ^ i Then TF(i + 1) = 1
Next
st(1) = 1
If ((TF(7) + TF(8) + TF(9) + TF(10) + TF(11) + TF(12)) = 3) Then st(2) = 1
If ((TF(2) + TF(4) + TF(6) + TF(8) + TF(10) + TF(12)) = 2) Then st(3) = 1
If TF(5) Then
If ((TF(6) + TF(7)) = 2) Then st(4) = 1
Else ' say true??
st(4) = 1 ' to match solution at RC
End If
If ((TF(4) + TF(3) + TF(2)) = 0) Then st(5) = 1
If ((TF(1) + TF(3) + TF(5) + TF(7) + TF(9) + TF(11)) = 4) Then st(6) = 1
If ((TF(2) + TF(3)) = 1) Then st(7) = 1
If TF(7) Then
If ((TF(5) + TF(6)) = 2) Then st(8) = 1
Else ' say true?
st(8) = 1 ' ??? this is like 4 which fixed things when I added 1 = true here
End If
If ((TF(1) + TF(2) + TF(3) + TF(4) + TF(5) + TF(6)) = 3) Then st(9) = 1
If ((TF(11) + TF(12)) = 2) Then st(10) = 1
If ((TF(7) + TF(8) + TF(9)) = 1) Then st(11) = 1
If ((TF(1) + TF(2) + TF(3) + TF(4) + TF(5) + TF(6) + TF(7) + TF(8) + TF(9) + TF(10) + TF(11)) = 4) Then st(12) = 1
wrong = 0: s$ = ""
For i = 1 To 12
If st(i) <> TF(i) Then wrong = wrong + 1: saveI = i
If TF(i) Then s$ = s$ + _Trim$(Str$(i)) + " " Else s$ = s$ + "_ "
Next
If wrong = 1 Then Print "Near miss, true at: "; s$; " missed at "; _Trim$(Str$(saveI))
If wrong = 0 Then Print " Solution! true at: "; s$; " <<<<<<<<<<<<<"
Next
b = b + ...