2013年6月26日水曜日

L search memorandam (6) column_block_room_division





Sub column_block_room_division()

Select Case kind1
Case "B"
Sheets("Sheet8").Cells(cnum, 54) = "B" & igrp & " ( " & room & ")"
Case "R"
Sheets("Sheet8").Cells(cnum, 54) = "R" & ilin & " ( " & room & ")"
Case "C"
Sheets("Sheet8").Cells(cnum, 54) = "C" & icol & " ( " & room & ")"
End Select
 aa = ""
For i7 = 1 To room
 d(i7) = jnn(0, i7)
 aa = aa & jnn(0, i7)
Next i7

If kind = "hidden" Then
  For i5 = 1 To room
   fd(0, i5) = Int(Right(d(i5), 1))
  Next i5
 
ElseIf kind = "naked" Then
  For i5 = 1 To room
   fd(0, i5) = d(i5)
  Next i5
End If

 knum = 0
 For i8 = 1 To z
  If jnn(i8, room + 1) <> 0 Then
  knum = knum + 1
  f(knum) = jnn(i8, 0)
 
   For i9 = 0 To room
   fd(knum, i9) = jnn(i8, i9)
   Next i9
  End If
Next i8


If kind = "hidden" Then
num = 0      'exchange column
For kazu = 1 To z
  For j1 = 1 To room
   If Int(Right(d(j1), 1)) = kazu Then
   num = num + 1
       For i1 = 0 To knum
       df(i1, num) = fd(i1, j1)
       Next i1
   End If
  Next j1
Next kazu

For i1 = 0 To knum
 For j1 = 1 To room
 fd(i1, j1) = df(i1, j1)
 Next j1
Next i1
End If








Lsearch(hidden) と Tsearch(naked)に分けて、fd-matrix(condenced allay matrix)またはdf matrix を作成する。(上の例は、hidden)
If kind = "hidden" Then
 
 For i7 = 1 To empty_cell
  For i6 = 1 To room
    If can(i7, 1) = f(i6) Then
          ikumi = can(i7, 5)
     For i8 = 1 To ikumi
      can(i7, 5 + i8) = ""
     Next i8
         num = 0
        For k1 = 1 To room
         If fd(i6, k1) <> "" Then
         num = num + 1
          can(i7, 5 + num) = fd(0, k1)
          can(i7, 5) = num
         End If
        Next k1
      End If
  Next i6
 Next i7

ElseIf kind = "naked" Then
   For i6 = 1 To room
    x1 = Int(Right(fd(i6, 0), 1))
  
   For i7 = 1 To empty_cell
      For i4 = 1 To room
      If can(i7, 1) = d(i4) Then GoTo conti7
      Next i4
 
      For j8 = 1 To knum
        iii = Int(Mid(d(j8), 2, 1))
        jjj = Int(Mid(d(j8), 4, 1))
       Select Case kind1
      Case "B"
        group_search
    If can(i7, 4) = grp Then GoTo conttrue
      Case "R"
    If can(i7, 2) = iii Then GoTo conttrue
      Case "C"
    If can(i7, 3) = jjj Then GoTo conttrue
      Case Else
       MsgBox ("no unit !"):    Exit Sub
      End Select
      Next j8
GoTo conti7
conttrue:

candy-matrix よりありえない候補を消去する。

         ikumi = can(i7, 5)
            For j3 = 1 To ikumi
              If can(i7, 5 + j3) = x1 Then
                 For k1 = j3 To ikumi
                 can(i7, 5 + k1) = can(i7, 6 + k1)
                Next k1
               End If
            Next j3
conti7:
   Next i7
   Next i6
End If

0 件のコメント:

コメントを投稿