Chinaunix首页 | 论坛 | 博客
  • 博客访问: 44326
  • 博文数量: 20
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 230
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-21 22:20
文章分类
文章存档

2011年(1)

2009年(19)

我的朋友
最近访客

分类:

2009-02-04 07:57:41

把华容道的各个类分得再细一点
 
    把华容道分成了六个类,又提取了各个类的对称场景,但余下来的数字还是蛮大的,是不是再把它细分一点呢?应该是可以的,以大方快的位置再来细分。
    具体的设想是:大方快在顶层的,大方快在二层的,大方快在三层的,大方快在四层的。这样就可以再细分四个层次,加上对称这个层次,计有五个层次。六个类,每个类五个层次,这样就有 30 种不同状态的区分了。以后分离“主像”与“镜像”定会方便一些。
   
    下面是VB的源程序:(以一横场景作为示范)

Private Sub Form_Click()
 Dim d As String, l As Long, i As Long, dc As Boolean
 Dim a0 As Long, a1 As Long, a2 As Long, a3 As Long, a4 As Long
 a0 = 0: a1 = 0: a2 = 0: a3 = 0: a4 = 0
 Open App.Path & "\一横场景.dat" For Random As #1 Len = 22
  For l = 1 To 59085
   Get #1, l, d
   dc = True
   For i = 0 To 4
    If Mid$(d, i * 4 + 1, 1) <> Mid$(d, i * 4 + 4, 1) Or _
       Mid$(d, i * 4 + 2, 1) <> Mid$(d, i * 4 + 3, 1) Then _
       dc = False: Exit For
   Next i
   
   If dc = True Then
    a0 = a0 + 1
    Open App.Path & "\一横对称场景.dat" For Random As #2 Len = 22
     Put #2, a0, d
    Close #2
   ElseIf dc = False Then
    If Mid$(d, 1, 1) = "4" Or Mid$(d, 3, 1) = "4" Then
      a1 = a1 + 1
      Open App.Path & "\一横一层场景.dat" For Random As #2 Len = 22
       Put #2, a1, d
      Close #2
    ElseIf Mid$(d, 5, 1) = "4" Or Mid$(d, 7, 1) = "4" Then
      a2 = a2 + 1
      Open App.Path & "\一横二层场景.dat" For Random As #2 Len = 22
       Put #2, a2, d
      Close #2
    ElseIf Mid$(d, 9, 1) = "4" Or Mid$(d, 11, 1) = "4" Then
      a3 = a3 + 1
      Open App.Path & "\一横三层场景.dat" For Random As #2 Len = 22
       Put #2, a3, d
      Close #2
    ElseIf Mid$(d, 13, 1) = "4" Or Mid$(d, 15, 1) = "4" Then
      a4 = a4 + 1
      Open App.Path & "\一横四层场景.dat" For Random As #2 Len = 22
       Put #2, a4, d
      Close #2
    End If
   End If
  Next l
 Close #1
 Text1.Text = a0 & "\" & a1 & "\" & a2 & "\" & a3 & "\" & a4
 Text2.Text = "End"
End Sub

 
未完待续 
 
                                        自然牛2009年2月4日
阅读(717) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~