Rosetta Code Challenges
#8
Hi ! Bplus! You brought me a great puzzle for the evening!Smile

I thought a lot about how it could be. I can't check back. Among the solutions is 1, which might be correct. I'm not sure.


Code: (Select All)
'1  3  4  6  7  11
Dim Shared ans(20)

For t = 0 To 4095: ' Locate 1, 1: Print t
    For t2 = 1 To 12
        ans(t2) = Sgn(t And 2 ^ (t2 - 1))
    Next t2

    add = 0: count = 0

    For t2 = 1 To 12
        add = add + Abs(ans(t2) = quest(t2))
        count = count + 1
    Next t2

    If add + 1 = count Then
        Print "find:  ";:
        For t3 = 1 To 12 Step 1
            If ans(t3) Then Print t3;
        Next t3
        Print
    End If
Next t

Function quest (which)
    Select Case which
        Case 1: ans = 1
        Case 2: add = 0: For t = 7 To 12: add = add + ans(t): Next t: ans = add = 3
        Case 3: add = 0: For t = 2 To 12 Step 2: add = add + ans(t): Next t: ans = add = 2
        Case 4: ans = ans(5) And ans(6) And ans(7)
        Case 5: ans = ans(2) = 0 And ans(3) = 0 And ans(4)
        Case 6: add = 0: For t = 1 To 11 Step 2: add = add + ans(t): Next t: ans = add = 4
        Case 7: ans = (ans(2) Or ans(3)) * ((ans(2) And ans(3)) = 0)
        Case 8: ans = ans(5) And ans(6) And ans(7)
        Case 9: add = 0: For t = 1 To 6: add = add + ans(t): Next t: ans = add = 3
        Case 10: ans = ans(11) And ans(12)
        Case 11: add = 0: For t = 7 To 9: add = add + ans(t): Next t: ans = add = 1
        Case 12: add = 0: For t = 1 To 11: add = add + ans(t): Next t: ans = add = 4
    End Select
    quest = Abs(Sgn(ans))
End Function
Reply


Messages In This Thread
Rosetta Code Challenges - by bplus - 04-26-2022, 09:17 PM
RE: Rosetta Code Challenges - by SierraKen - 04-27-2022, 04:36 AM
RE: Rosetta Code Challenges - by bplus - 04-27-2022, 01:38 PM
RE: Rosetta Code Challenges - by bplus - 10-30-2022, 04:41 AM
RE: Rosetta Code Challenges - by bplus - 10-31-2022, 05:40 PM
RE: Rosetta Code Challenges - by SpriggsySpriggs - 10-31-2022, 07:24 PM
RE: Rosetta Code Challenges - by bplus - 10-31-2022, 09:09 PM
RE: Rosetta Code Challenges - by MasterGy - 10-31-2022, 09:33 PM
RE: Rosetta Code Challenges - by bplus - 10-31-2022, 09:43 PM
RE: Rosetta Code Challenges - by bplus - 11-01-2022, 02:07 AM
RE: Rosetta Code Challenges - by bplus - 11-01-2022, 12:19 PM
RE: Rosetta Code Challenges - by bplus - 11-05-2022, 04:57 AM
RE: Rosetta Code Challenges - by CharlieJV - 11-05-2022, 03:10 PM
RE: Rosetta Code Challenges - by bplus - 11-05-2022, 04:02 PM



Users browsing this thread: 4 Guest(s)