【 tulaoshi.com - ASP.NET 】
dim a(10,10),b(100) as longFor i = 1 To 10 For j = 1 To 10 a(i, j) = "0" Next jNext iFor k = 1 To 20 '²¼À×10: a1 = Int(Rnd * 10) + 1 b1 = Int(Rnd * 10) + 1 If a(a1, b1) = "0" Then a(a1, b1) = "*" n = n + 1 Else GoTo 10 End IfNext k'ÉèÖÃÀ×±ßÉϵÄÊý×ÖFor n = 2 To 9 'ÖмäÅÐ¶Ï For t = 2 To 9 If a(n, t) = "*" Then For n1 = n - 1 To n + 1 For t1 = t - 1 To t + 1 If a(n1, t1) <> "*" Then a(n1, t1) = LTrim$(Str$(Val(a(n1, t1)) + 1)) End If Next t1 Next n1 End If Next tNext nFor i = 2 To 9 If a(1, i) = "*" Then 'µÚÒ»ÐÐÅÐ¶Ï For j = 1 To 2 For k = i - 1 To i + 1 If a(j, k) <> "*" Then a(j, k) = LTrim$(Str$(Val(a(j, k)) + 1)) End If Next k Next j End If If a(10, i) = "*" Then 'µÚÊ®ÐÐÅÐ¶Ï For j = 9 To 10 For k = i - 1 To i + 1 If a(j, k) <> "*" Then a(j, k) = LTrim$(Str$(Val(a(j, k)) + 1)) End If Next k Next j End IfNext iFor i = 2 To 9 If a(i, 1) = "*" Then 'µÚÒ»ÐУ¬µÚiÁÐÅÐ¶Ï For j = i - 1 To i + 1 For k = 1 To 2 If a(j, k) <> "*" Then a(j, k) = LTrim$(Str$(Val(a(j, k)) + 1)) End If Next k Next j End If If a(i, 10) = "*" Then 'µÚiÐУ¬µÚÊ®ÁÐÅÐ¶Ï For j = i - 1 To i + 1 For k = 9 To 10 If a(j, k) <> "*" Then a(j, k) = LTrim$(Str$(Val(a(j, k)) + 1)) End If Next k Next j End IfNext i'Ëĸö½ÇÅжÏIf a(1, 1) = "*" Then 'µÚ1ÐУ¬µÚ1ÁÐÀ×ÅÐ¶Ï For i = 1 To 2 For j = 1 To 2 If a(i, j) <> "*" Then a(i, j) = LTrim$(Str$(Val(a(i, j)) + 1)) End If Next j Next iEnd IfIf a(1, 10) = "*" Then 'µÚ1ÐУ¬µÚ10ÁÐÀ×ÅÐ¶Ï For i = 1 To 2 For j = 9 To 10 If a(i, j) <> "*" Then a(i, j) = LTrim$(Str$(Val(a(i, j)) + 1)) End If Next j Next iEnd IfIf a(10, 1) = "*" Then 'µÚ10ÐУ¬µÚ1ÁÐÀ×ÅÐ¶Ï For i = 9 To 10 For j = 1 To 2 If a(i, j) <> "*" Then a(i, j) = LTrim$(Str$(Val(a(i, j)) + 1)) End If Next j Next iEnd IfIf a(10, 10) = "*" Then 'µÚ10ÐУ¬µÚ10ÁÐÀ×ÅÐ¶Ï For i = 9 To 10 For j = 9 To 10 If a(i, j) <> "*" Then a(i, j) = LTrim$(Str$(Val(a(i, j)) + 1)) End If Next j Next iEnd IfFor i = 1 To 100 b(i) = a((i - 1) 10 + 1, (i - 1) Mod 10 + 1)Next i布雷为:10*10型