All pastes #575529 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-19 02:37 UTC
rendered paste body
PassAgain:
        PassAgain = False
        'Start counting for each textbox
        For XO = 0 To 8
            For YO = 0 To 8
                'If the textbox is blank
                If SudPuz(XO, YO) = 0 Then
                    PassAgain = True
                    'Prep for evaluating
                    Dim Chk(8) As Boolean 'False
                    TC = 0
                    'Start checking every verticle instance
                    For XI = 0 To 8
                        For i = 1 To 9
                            'Can check itself because itself is 0
                            If SudPuz(XI, YO) = i Then
                                'Flag X instance
                                Chk(i - 1) = True
                            End If
                        Next
                    Next
                    'Start checking every horizontal instance
                    For YI = 0 To 8
                        For i = 1 To 9
                            'Can check itself because itself is 0
                            If SudPuz(XO, YI) = i Then
                                'Flag Y instance
                                Chk(i - 1) = True
                            End If
                        Next
                    Next
                    'Start checking for occurances in the same square
                    Dim tmpX, tmpY As Integer
                    Dim tmpStr As String = XO.ToString & YO.ToString
                    Select Case tmpStr
                        Case "00", "01", "02", "10", "11", "12", "20", "21", "22"
                            For tmpX = 0 To 2
                                For tmpY = 0 To 2
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "03" Or "04" Or "05" Or "13" Or "14" Or "15" Or "23" Or "24", "25"
                            For tmpX = 0 To 2
                                For tmpY = 3 To 5
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "06", "07", "08", "16", "17", "18", "26", "27", "28"
                            For tmpX = 0 To 2
                                For tmpY = 6 To 8
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "30", "31", "32", "40", "41", "41", "50", "51", "52"
                            For tmpX = 3 To 5
                                For tmpY = 0 To 2
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "33", "34", "35", "43", "44", "45", "53", "54", "55"
                            For tmpX = 3 To 5
                                For tmpY = 3 To 5
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "36", "37", "38", "46", "47", "48", "56", "57", "58"
                            For tmpX = 3 To 5
                                For tmpY = 6 To 8
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "60", "61", "62", "70", "71", "72", "80", "81", "82"
                            For tmpX = 6 To 8
                                For tmpY = 0 To 2
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "63", "64", "65", "73", "74", "75", "83", "84", "85"
                            For tmpX = 6 To 8
                                For tmpY = 3 To 5
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                        Case "66", "67", "68", "76", "77", "78", "86", "87", "88"
                            For tmpX = 6 To 8
                                For tmpY = 6 To 8
                                    For i = 1 To 9
                                        'Can check itself because itself is 0
                                        If SudPuz(tmpX, tmpY) = i Then
                                            'Flag Y instance
                                            Chk(i - 1) = True
                                        End If
                                    Next
                                Next
                            Next
                    End Select
                    'Count occurances
                    TC = 0
                    For i = 0 To 8
                        If Chk(i) = True Then
                            TC += 1
                        Else
                            'Catch last false occurance
                            LTC = i + 1
                        End If
                    Next
                    'Check to see if value is definite
                    'MsgBox(Chk(0).ToString & Chk(1).ToString & Chk(2).ToString & Chk(3).ToString & Chk(4).ToString & Chk(5).ToString & Chk(6).ToString & Chk(7).ToString & Chk(8).ToString)

                    If TC = 8 Then
                        SudPuz(XO, YO) = LTC
                    End If
                End If
            Next
        Next
        If PassAgain = True Then
            'Goto PassAgain
        End If