www.pudn.com > gameprg.zip > hrd.frm


VERSION 5.00 
Begin VB.Form Form1  
   Caption         =   "Form1" 
   ClientHeight    =   5715 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   6765 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   5715 
   ScaleWidth      =   6765 
   StartUpPosition =   3  '窗口缺省 
   Begin VB.CommandButton Command9  
      Caption         =   "Command9" 
      Height          =   855 
      Left            =   4560 
      TabIndex        =   22 
      Top             =   2880 
      Width           =   375 
   End 
   Begin VB.Data Data1  
      Caption         =   "Data1" 
      Connect         =   "Access" 
      DatabaseName    =   "C:\WINDOWS\Profiles\ykck001\My Documents\华容道\data.mdb" 
      DefaultCursorType=   0  '缺省游标 
      DefaultType     =   2  '使用 ODBC 
      Exclusive       =   0   'False 
      Height          =   375 
      Left            =   4800 
      Options         =   0 
      ReadOnly        =   0   'False 
      RecordsetType   =   1  'Dynaset 
      RecordSource    =   "" 
      Top             =   4920 
      Visible         =   0   'False 
      Width           =   1335 
   End 
   Begin VB.CommandButton Command8  
      Appearance      =   0  'Flat 
      Caption         =   "重新开始" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   16 
      Top             =   3240 
      Width           =   1455 
   End 
   Begin VB.CommandButton Command7  
      Caption         =   "屯兵东路" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   15 
      Top             =   2400 
      Width           =   1455 
   End 
   Begin VB.CommandButton Command6  
      Caption         =   "分兵三路" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   14 
      Top             =   1920 
      Width           =   1455 
   End 
   Begin VB.CommandButton Command5  
      Caption         =   "横刀立马(二)" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   13 
      Top             =   960 
      Width           =   1455 
   End 
   Begin VB.CommandButton Command4  
      Caption         =   "齐头并进" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   12 
      Top             =   1440 
      Width           =   1455 
   End 
   Begin VB.CommandButton Command3  
      Caption         =   "横刀立马(一)" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   11 
      Top             =   480 
      Width           =   1455 
   End 
   Begin VB.Frame Frame2  
      Height          =   3375 
      Left            =   120 
      TabIndex        =   0 
      Top             =   120 
      Width           =   2655 
      Begin VB.CommandButton Command2  
         Caption         =   "下" 
         Height          =   250 
         Index           =   7 
         Left            =   240 
         TabIndex        =   21 
         Top             =   720 
         Visible         =   0   'False 
         Width           =   500 
      End 
      Begin VB.CommandButton Command2  
         Caption         =   "右" 
         Height          =   500 
         Index           =   5 
         Left            =   720 
         TabIndex        =   20 
         Top             =   240 
         Visible         =   0   'False 
         Width           =   250 
      End 
      Begin VB.CommandButton Command2  
         Caption         =   "左" 
         Height          =   500 
         Index           =   3 
         Left            =   0 
         TabIndex        =   19 
         Top             =   240 
         Visible         =   0   'False 
         Width           =   250 
      End 
      Begin VB.CommandButton Command2  
         Appearance      =   0  'Flat 
         Caption         =   "上" 
         Height          =   250 
         Index           =   1 
         Left            =   240 
         TabIndex        =   18 
         Top             =   0 
         Visible         =   0   'False 
         Width           =   500 
      End 
      Begin VB.CommandButton Command1  
         Height          =   1200 
         Index           =   0 
         Left            =   120 
         Picture         =   "hrd.frx":0000 
         Style           =   1  'Graphical 
         TabIndex        =   10 
         Top             =   240 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Appearance      =   0  'Flat 
         Height          =   1200 
         Index           =   1 
         Left            =   720 
         Picture         =   "hrd.frx":7432 
         Style           =   1  'Graphical 
         TabIndex        =   9 
         Top             =   240 
         Width           =   1200 
      End 
      Begin VB.CommandButton Command1  
         Height          =   1200 
         Index           =   2 
         Left            =   1920 
         Picture         =   "hrd.frx":15A24 
         Style           =   1  'Graphical 
         TabIndex        =   8 
         Top             =   240 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Height          =   1200 
         Index           =   3 
         Left            =   120 
         Picture         =   "hrd.frx":1CE56 
         Style           =   1  'Graphical 
         TabIndex        =   7 
         Top             =   1440 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Appearance      =   0  'Flat 
         Height          =   600 
         Index           =   4 
         Left            =   720 
         Picture         =   "hrd.frx":24288 
         Style           =   1  'Graphical 
         TabIndex        =   6 
         Top             =   1440 
         Width           =   1200 
      End 
      Begin VB.CommandButton Command1  
         Height          =   1200 
         Index           =   5 
         Left            =   1920 
         Picture         =   "hrd.frx":2B5A2 
         Style           =   1  'Graphical 
         TabIndex        =   5 
         Top             =   1440 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Height          =   600 
         Index           =   6 
         Left            =   120 
         Picture         =   "hrd.frx":329D4 
         Style           =   1  'Graphical 
         TabIndex        =   4 
         Top             =   2640 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Height          =   600 
         Index           =   7 
         Left            =   720 
         Picture         =   "hrd.frx":3640E 
         Style           =   1  'Graphical 
         TabIndex        =   3 
         Top             =   2040 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Height          =   600 
         Index           =   8 
         Left            =   1320 
         Picture         =   "hrd.frx":39E48 
         Style           =   1  'Graphical 
         TabIndex        =   2 
         Top             =   2040 
         Width           =   600 
      End 
      Begin VB.CommandButton Command1  
         Height          =   600 
         Index           =   9 
         Left            =   1920 
         Picture         =   "hrd.frx":3D882 
         Style           =   1  'Graphical 
         TabIndex        =   1 
         Top             =   2640 
         Width           =   600 
      End 
   End 
   Begin VB.Label Label1  
      Alignment       =   1  'Right Justify 
      Caption         =   "0" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   18 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   17 
      Top             =   3960 
      Width           =   1215 
   End 
End 
Attribute VB_Name = "Form1" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim a(4, 3) As Integer 
Dim b(9, 1) As Integer 
Dim left_ok As Boolean 
Dim right_ok As Boolean 
Dim up_ok As Boolean 
Dim down_ok As Boolean 
Dim move_num As Integer 
Dim step_num As Integer 
Dim step1 As Integer 
 
Private Sub Command1_Click(Index As Integer) 
Dim ok_num As Integer 
ok_num = 0 
Command2(1).Visible = False 
Command2(3).Visible = False 
Command2(5).Visible = False 
Command2(7).Visible = False 
 
 
check_me (Index) 
 
If left_ok Then 
ok_num = ok_num + 1 
End If 
If down_ok Then 
ok_num = ok_num + 1 
End If 
If right_ok Then 
ok_num = ok_num + 1 
End If 
If up_ok Then 
ok_num = ok_num + 1 
End If 
If ok_num = 1 Then 
    If left_ok Then 
    move_left (Index) 
    End If 
    If right_ok Then 
    move_right (Index) 
    End If 
    If down_ok Then 
    move_down (Index) 
    End If 
    If up_ok Then 
    move_up (Index) 
    End If 
        left_ok = False 
    right_ok = False 
    down_ok = False 
    up_ok = False 
 
End If 
If ok_num > 1 Then 
    If left_ok Then 
    Command2(3).Visible = True 
    Command2(3).Left = Command1(Index).Left 
    Command2(3).Top = Command1(Index).Height / 2 + Command1(Index).Top - Command2(3).Height / 2 
    Else 
    Command2(3).Visible = False 
     
    End If 
    If right_ok Then 
    Command2(5).Visible = True 
    Command2(5).Left = Command1(Index).Width - Command2(5).Width + Command1(Index).Left 
    Command2(5).Top = Command1(Index).Height / 2 + Command1(Index).Top - Command2(5).Height / 2 
     
    Else 
    Command2(5).Visible = False 
     
    End If 
    If down_ok Then 
    Command2(7).Visible = True 
    Command2(7).Left = Command1(Index).Width / 2 - Command2(7).Width / 2 + Command1(Index).Left 
    Command2(7).Top = Command1(Index).Height - Command2(7).Height + Command1(Index).Top 
     
    Else 
    Command2(7).Visible = False 
     
    End If 
    If up_ok Then 
    Command2(1).Visible = True 
    Command2(1).Left = Command1(Index).Width / 2 - Command2(1).Width / 2 + Command1(Index).Left 
    Command2(1).Top = Command1(Index).Top 
     
    Else 
    Command2(1).Visible = False 
     
    End If 
 
move_num = Index 
 
End If 
     
     
    left_ok = False 
    right_ok = False 
    down_ok = False 
    up_ok = False 
     
End Sub 
 
Private Sub Command2_Click(Index As Integer) 
Select Case Index 
Case 1 
move_up (move_num) 
 
Case 3 
move_left (move_num) 
 
Case 5 
move_right (move_num) 
 
Case 7 
move_down (move_num) 
 
End Select 
    Command2(1).Visible = False 
    Command2(3).Visible = False 
    Command2(5).Visible = False 
    Command2(7).Visible = False 
 
End Sub 
 
Private Sub Command2_LostFocus(Index As Integer) 
    Command2(1).Visible = False 
    Command2(3).Visible = False 
    Command2(5).Visible = False 
    Command2(7).Visible = False 
 
End Sub 
 
Private Sub Command3_Click() 
Dim i, j As Integer 
left_ok = False 
right_ok = False 
up_ok = False 
down_ok = False 
step_num = 1 
For i = 0 To 4 
 For j = 0 To 3 
   a(i, j) = 1 
 Next j 
Next i 
a(4, 1) = 0 
a(4, 2) = 0 
 
b(0, 0) = 0 
b(0, 1) = 0 
b(1, 0) = 0 
b(1, 1) = 1 
b(2, 0) = 0 
b(2, 1) = 3 
b(3, 0) = 2 
b(3, 1) = 0 
b(4, 0) = 2 
b(4, 1) = 1 
b(5, 0) = 2 
b(5, 1) = 3 
b(6, 0) = 4 
b(6, 1) = 0 
b(7, 0) = 3 
b(7, 1) = 1 
b(8, 0) = 3 
b(8, 1) = 2 
b(9, 0) = 4 
b(9, 1) = 3 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
End Sub 
 
Private Sub Command4_Click() 
Dim i, j As Integer 
left_ok = False 
right_ok = False 
up_ok = False 
down_ok = False 
step_num = 2 
 
 
For i = 0 To 4 
 For j = 0 To 3 
   a(i, j) = 1 
 Next j 
Next i 
a(4, 1) = 0 
a(4, 2) = 0 
 
b(0, 0) = 0 
b(0, 1) = 3 
b(1, 0) = 0 
b(1, 1) = 1 
b(2, 0) = 3 
b(2, 1) = 3 
b(3, 0) = 0 
b(3, 1) = 0 
b(4, 0) = 3 
b(4, 1) = 1 
b(5, 0) = 3 
b(5, 1) = 0 
b(6, 0) = 2 
b(6, 1) = 0 
b(7, 0) = 2 
b(7, 1) = 1 
b(8, 0) = 2 
b(8, 1) = 2 
b(9, 0) = 2 
b(9, 1) = 3 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
 
End Sub 
 
Private Sub Command5_Click() 
Dim i, j As Integer 
left_ok = False 
right_ok = False 
up_ok = False 
down_ok = False 
 
step_num = 3 
 
 
For i = 0 To 4 
 For j = 0 To 3 
   a(i, j) = 1 
 Next j 
Next i 
a(4, 1) = 0 
a(4, 2) = 0 
 
b(0, 0) = 0 
b(0, 1) = 3 
b(1, 0) = 0 
b(1, 1) = 1 
b(2, 0) = 3 
b(2, 1) = 3 
b(3, 0) = 0 
b(3, 1) = 0 
b(4, 0) = 2 
b(4, 1) = 1 
b(5, 0) = 3 
b(5, 1) = 0 
b(6, 0) = 3 
b(6, 1) = 1 
b(7, 0) = 3 
b(7, 1) = 2 
b(8, 0) = 2 
b(8, 1) = 0 
b(9, 0) = 2 
b(9, 1) = 3 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
 
End Sub 
 
Private Sub Command6_Click() 
Dim i, j As Integer 
left_ok = False 
right_ok = False 
up_ok = False 
down_ok = False 
 
step_num = 4 
 
 
For i = 0 To 4 
 For j = 0 To 3 
   a(i, j) = 1 
 Next j 
Next i 
a(4, 1) = 0 
a(4, 2) = 0 
 
b(0, 0) = 1 
b(0, 1) = 3 
b(1, 0) = 0 
b(1, 1) = 1 
b(2, 0) = 3 
b(2, 1) = 3 
b(3, 0) = 1 
b(3, 1) = 0 
b(4, 0) = 2 
b(4, 1) = 1 
b(5, 0) = 3 
b(5, 1) = 0 
b(6, 0) = 3 
b(6, 1) = 1 
b(7, 0) = 3 
b(7, 1) = 2 
b(8, 0) = 0 
b(8, 1) = 0 
b(9, 0) = 0 
b(9, 1) = 3 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
 
 
End Sub 
 
Private Sub Command7_Click() 
Dim i, j As Integer 
left_ok = False 
right_ok = False 
up_ok = False 
down_ok = False 
'Frame1.Visible = False 
 
step_num = 5 
 
 
 
For i = 0 To 4 
 For j = 0 To 3 
   a(i, j) = 1 
 Next j 
Next i 
a(4, 3) = 0 
a(4, 2) = 0 
 
b(0, 0) = 0 
b(0, 1) = 3 
b(1, 0) = 0 
b(1, 1) = 0 
b(2, 0) = 3 
b(2, 1) = 1 
b(3, 0) = 0 
b(3, 1) = 2 
b(4, 0) = 2 
b(4, 1) = 0 
b(5, 0) = 3 
b(5, 1) = 0 
b(6, 0) = 2 
b(6, 1) = 2 
b(7, 0) = 2 
b(7, 1) = 3 
b(8, 0) = 3 
b(8, 1) = 2 
b(9, 0) = 3 
b(9, 1) = 3 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
 
 
End Sub 
 
Private Sub Command8_Click() 
Select Case step_num 
Case 1 
Call Command3_Click 
Case 2 
Call Command4_Click 
 
Case 3 
Call Command5_Click 
 
Case 4 
Call Command6_Click 
 
Case 5 
Call Command7_Click 
End Select 
step1 = 0 
Label1.Caption = 0 
End Sub 
 
Private Sub Command9_Click() 
Dim no1 As String 
Dim i As Integer 
Data1.RecordSource = "select * from step where aa=" & "'" & Trim(Label1.Caption) & "'" 
Data1.Refresh 
If Data1.Recordset.RecordCount < 1 Then 
MsgBox "error!" 
Exit Sub 
Else 
Data1.Database.Execute ("delete * from step where aa=" & "'" & Trim(Label1.Caption) & "'") 
Data1.RecordSource = "select * from step" 
Data1.Refresh 
Data1.Recordset.MoveLast 
b(0, 0) = Data1.Recordset("b00") 
b(0, 1) = Data1.Recordset("b01") 
b(1, 0) = Data1.Recordset("b10") 
b(1, 1) = Data1.Recordset("b11") 
b(2, 0) = Data1.Recordset("b20") 
b(2, 1) = Data1.Recordset("b21") 
b(3, 0) = Data1.Recordset("b30") 
b(3, 1) = Data1.Recordset("b31") 
b(4, 0) = Data1.Recordset("b40") 
b(4, 1) = Data1.Recordset("b41") 
b(5, 0) = Data1.Recordset("b50") 
b(5, 1) = Data1.Recordset("b51") 
b(6, 0) = Data1.Recordset("b60") 
b(6, 1) = Data1.Recordset("b61") 
b(7, 0) = Data1.Recordset("b70") 
b(7, 1) = Data1.Recordset("b71") 
b(8, 0) = Data1.Recordset("b80") 
b(8, 1) = Data1.Recordset("b81") 
b(9, 0) = Data1.Recordset("b90") 
b(9, 1) = Data1.Recordset("b91") 
a(0, 0) = Data1.Recordset("a00") 
a(0, 1) = Data1.Recordset("a01") 
a(0, 2) = Data1.Recordset("a02") 
a(1, 0) = Data1.Recordset("a10") 
a(1, 1) = Data1.Recordset("a11") 
a(1, 2) = Data1.Recordset("a12") 
a(2, 0) = Data1.Recordset("a20") 
a(2, 1) = Data1.Recordset("a21") 
a(2, 2) = Data1.Recordset("a22") 
a(3, 0) = Data1.Recordset("a30") 
a(3, 1) = Data1.Recordset("a31") 
a(3, 2) = Data1.Recordset("a32") 
a(4, 0) = Data1.Recordset("a40") 
a(4, 1) = Data1.Recordset("a41") 
a(4, 2) = Data1.Recordset("a42") 
a(0, 3) = Data1.Recordset("a03") 
a(1, 3) = Data1.Recordset("a13") 
a(2, 3) = Data1.Recordset("a23") 
a(3, 3) = Data1.Recordset("a33") 
a(4, 3) = Data1.Recordset("a43") 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
Label1.Caption = Label1.Caption - 1 
step1 = step1 - 1 
 
End If 
End Sub 
 
Private Sub Form_Load() 
Dim i, j As Integer 
step_num = 1 
left_ok = False 
right_ok = False 
up_ok = False 
down_ok = False 
For i = 0 To 4 
 For j = 0 To 3 
   a(i, j) = 1 
 Next j 
Next i 
a(4, 1) = 0 
a(4, 2) = 0 
 
b(0, 0) = 0 
b(0, 1) = 0 
b(1, 0) = 0 
b(1, 1) = 1 
b(2, 0) = 0 
b(2, 1) = 3 
b(3, 0) = 2 
b(3, 1) = 0 
b(4, 0) = 2 
b(4, 1) = 1 
b(5, 0) = 2 
b(5, 1) = 3 
b(6, 0) = 4 
b(6, 1) = 0 
b(7, 0) = 3 
b(7, 1) = 1 
b(8, 0) = 3 
b(8, 1) = 2 
b(9, 0) = 4 
b(9, 1) = 3 
For i = 0 To 9 
Command1(i).Left = b(i, 1) * 600 + 100 
Command1(i).Top = b(i, 0) * 600 + 200 
Next i 
Data1.RecordSource = "select * from step" 
Data1.Refresh 
End Sub 
Function check_me(Index As Integer) 
Select Case Index 
Case 0, 2, 3, 5 
        If b(Index, 1) > 0 Then 
           If a(b(Index, 0), b(Index, 1) - 1) = 0 And a(b(Index, 0) + 1, b(Index, 1) - 1) = 0 Then 
           left_ok = True 
           End If 
        End If 
        If b(Index, 1) < 3 Then 
           If a(b(Index, 0), b(Index, 1) + 1) = 0 And a(b(Index, 0) + 1, b(Index, 1) + 1) = 0 Then 
           right_ok = True 
           End If 
        End If 
        If b(Index, 0) > 0 Then 
           If a(b(Index, 0) - 1, b(Index, 1)) = 0 Then 
           up_ok = True 
           End If 
        End If 
        If b(Index, 0) < 3 Then 
           If a(b(Index, 0) + 2, b(Index, 1)) = 0 Then 
           down_ok = True 
           End If 
        End If 
Case 1 
        If b(Index, 1) > 0 Then 
           If a(b(Index, 0), b(Index, 1) - 1) = 0 And a(b(Index, 0) + 1, b(Index, 1) - 1) = 0 Then 
           left_ok = True 
           End If 
        End If 
        If b(Index, 1) < 2 Then 
           If a(b(Index, 0), b(Index, 1) + 2) = 0 And a(b(Index, 0) + 1, b(Index, 1) + 2) = 0 Then 
           right_ok = True 
           End If 
        End If 
        If b(Index, 0) > 0 Then 
           If a(b(Index, 0) - 1, b(Index, 1)) = 0 And a(b(Index, 0) - 1, b(Index, 1) + 1) = 0 Then 
           up_ok = True 
           End If 
        End If 
        If b(Index, 0) < 3 Then 
           If a(b(Index, 0) + 2, b(Index, 1)) = 0 And a(b(Index, 0) + 2, b(Index, 1) + 1) = 0 Then 
           down_ok = True 
           End If 
        End If 
 
Case 4 
        If b(Index, 1) > 0 Then 
           If a(b(Index, 0), b(Index, 1) - 1) = 0 Then 
           left_ok = True 
           End If 
        End If 
        If b(Index, 1) < 2 Then 
           If a(b(Index, 0), b(Index, 1) + 2) = 0 Then 
           right_ok = True 
           End If 
        End If 
        If b(Index, 0) > 0 Then 
           If a(b(Index, 0) - 1, b(Index, 1)) = 0 And a(b(Index, 0) - 1, b(Index, 1) + 1) = 0 Then 
           up_ok = True 
           End If 
        End If 
        If b(Index, 0) < 4 Then 
           If a(b(Index, 0) + 1, b(Index, 1)) = 0 And a(b(Index, 0) + 1, b(Index, 1) + 1) = 0 Then 
           down_ok = True 
           End If 
        End If 
 
Case 6, 7, 8, 9 
        If b(Index, 1) > 0 Then 
           If a(b(Index, 0), b(Index, 1) - 1) = 0 Then 
           left_ok = True 
           End If 
        End If 
        If b(Index, 1) < 3 Then 
           If a(b(Index, 0), b(Index, 1) + 1) = 0 Then 
           right_ok = True 
           End If 
        End If 
        If b(Index, 0) > 0 Then 
           If a(b(Index, 0) - 1, b(Index, 1)) = 0 Then 
           up_ok = True 
           End If 
        End If 
        If b(Index, 0) < 4 Then 
           If a(b(Index, 0) + 1, b(Index, 1)) = 0 Then 
           down_ok = True 
           End If 
        End If 
 
End Select 
End Function 
 
Function move_left(Index As Integer) 
    Command1(Index).Left = Command1(Index).Left - 600 
Label1.Caption = Label1.Caption + 1 
step1 = step1 + 1 
Data1.Recordset.AddNew 
    Data1.Recordset("aa") = step1 
    Data1.Recordset("b00") = b(0, 0) 
    Data1.Recordset("b01") = b(0, 1) 
    Data1.Recordset("b10") = b(1, 0) 
    Data1.Recordset("b11") = b(1, 1) 
    Data1.Recordset("b20") = b(2, 0) 
    Data1.Recordset("b21") = b(2, 1) 
    Data1.Recordset("b30") = b(3, 0) 
    Data1.Recordset("b31") = b(3, 1) 
    Data1.Recordset("b40") = b(4, 0) 
    Data1.Recordset("b41") = b(4, 1) 
    Data1.Recordset("b50") = b(5, 0) 
    Data1.Recordset("b51") = b(5, 1) 
    Data1.Recordset("b60") = b(6, 0) 
    Data1.Recordset("b61") = b(6, 1) 
    Data1.Recordset("b70") = b(7, 0) 
    Data1.Recordset("b71") = b(7, 1) 
    Data1.Recordset("b80") = b(8, 0) 
    Data1.Recordset("b81") = b(8, 1) 
    Data1.Recordset("b90") = b(9, 0) 
    Data1.Recordset("b91") = b(9, 1) 
    Data1.Recordset("a00") = a(0, 0) 
    Data1.Recordset("a01") = a(0, 1) 
    Data1.Recordset("a02") = a(0, 2) 
    Data1.Recordset("a03") = a(0, 3) 
    Data1.Recordset("a10") = a(1, 0) 
    Data1.Recordset("a11") = a(1, 1) 
    Data1.Recordset("a12") = a(1, 2) 
    Data1.Recordset("a13") = a(1, 3) 
    Data1.Recordset("a20") = a(2, 0) 
    Data1.Recordset("a21") = a(2, 1) 
    Data1.Recordset("a22") = a(2, 2) 
    Data1.Recordset("a23") = a(2, 3) 
    Data1.Recordset("a30") = a(3, 0) 
    Data1.Recordset("a31") = a(3, 1) 
    Data1.Recordset("a32") = a(3, 2) 
    Data1.Recordset("a33") = a(3, 3) 
    Data1.Recordset("a40") = a(4, 0) 
    Data1.Recordset("a41") = a(4, 1) 
    Data1.Recordset("a42") = a(4, 2) 
    Data1.Recordset("a43") = a(4, 3) 
 
Data1.UpdateRecord 
 
Select Case Index 
Case 0, 2, 3, 5 
a(b(Index, 0), b(Index, 1)) = 0 
a(b(Index, 0) + 1, b(Index, 1)) = 0 
b(Index, 1) = b(Index, 1) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
a(b(Index, 0) + 1, b(Index, 1)) = 1 
Case 1 
a(b(Index, 0), b(Index, 1) + 1) = 0 
a(b(Index, 0) + 1, b(Index, 1) + 1) = 0 
b(Index, 1) = b(Index, 1) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
a(b(Index, 0) + 1, b(Index, 1)) = 1 
 
Case 4 
a(b(Index, 0), b(Index, 1) + 1) = 0 
b(Index, 1) = b(Index, 1) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
 
Case 6, 7, 8, 9 
a(b(Index, 0), b(Index, 1)) = 0 
b(Index, 1) = b(Index, 1) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
 
End Select 
           down_ok = False 
           up_ok = False 
           left_ok = False 
           right_ok = False 
            
End Function 
Function move_right(Index As Integer) 
Command1(Index).Left = Command1(Index).Left + 600 
Label1.Caption = Label1.Caption + 1 
step1 = step1 + 1 
 
Data1.Recordset.AddNew 
    Data1.Recordset("aa") = step1 
    Data1.Recordset("b00") = b(0, 0) 
    Data1.Recordset("b01") = b(0, 1) 
    Data1.Recordset("b10") = b(1, 0) 
    Data1.Recordset("b11") = b(1, 1) 
    Data1.Recordset("b20") = b(2, 0) 
    Data1.Recordset("b21") = b(2, 1) 
    Data1.Recordset("b30") = b(3, 0) 
    Data1.Recordset("b31") = b(3, 1) 
    Data1.Recordset("b40") = b(4, 0) 
    Data1.Recordset("b41") = b(4, 1) 
    Data1.Recordset("b50") = b(5, 0) 
    Data1.Recordset("b51") = b(5, 1) 
    Data1.Recordset("b60") = b(6, 0) 
    Data1.Recordset("b61") = b(6, 1) 
    Data1.Recordset("b70") = b(7, 0) 
    Data1.Recordset("b71") = b(7, 1) 
    Data1.Recordset("b80") = b(8, 0) 
    Data1.Recordset("b81") = b(8, 1) 
    Data1.Recordset("b90") = b(9, 0) 
    Data1.Recordset("b91") = b(9, 1) 
    Data1.Recordset("a00") = a(0, 0) 
    Data1.Recordset("a01") = a(0, 1) 
    Data1.Recordset("a02") = a(0, 2) 
    Data1.Recordset("a03") = a(0, 3) 
    Data1.Recordset("a10") = a(1, 0) 
    Data1.Recordset("a11") = a(1, 1) 
    Data1.Recordset("a12") = a(1, 2) 
    Data1.Recordset("a13") = a(1, 3) 
    Data1.Recordset("a20") = a(2, 0) 
    Data1.Recordset("a21") = a(2, 1) 
    Data1.Recordset("a22") = a(2, 2) 
    Data1.Recordset("a23") = a(2, 3) 
    Data1.Recordset("a30") = a(3, 0) 
    Data1.Recordset("a31") = a(3, 1) 
    Data1.Recordset("a32") = a(3, 2) 
    Data1.Recordset("a33") = a(3, 3) 
    Data1.Recordset("a40") = a(4, 0) 
    Data1.Recordset("a41") = a(4, 1) 
    Data1.Recordset("a42") = a(4, 2) 
    Data1.Recordset("a43") = a(4, 3) 
     
Data1.UpdateRecord 
 
Select Case Index 
Case 0, 2, 3, 5 
a(b(Index, 0), b(Index, 1)) = 0 
a(b(Index, 0) + 1, b(Index, 1)) = 0 
b(Index, 1) = b(Index, 1) + 1 
a(b(Index, 0), b(Index, 1)) = 1 
a(b(Index, 0) + 1, b(Index, 1)) = 1 
Case 1 
a(b(Index, 0), b(Index, 1)) = 0 
a(b(Index, 0) + 1, b(Index, 1)) = 0 
b(Index, 1) = b(Index, 1) + 1 
a(b(Index, 0), b(Index, 1) + 1) = 1 
a(b(Index, 0) + 1, b(Index, 1) + 1) = 1 
 
Case 4 
a(b(Index, 0), b(Index, 1)) = 0 
b(Index, 1) = b(Index, 1) + 1 
a(b(Index, 0), b(Index, 1) + 1) = 1 
 
Case 6, 7, 8, 9 
a(b(Index, 0), b(Index, 1)) = 0 
b(Index, 1) = b(Index, 1) + 1 
a(b(Index, 0), b(Index, 1)) = 1 
 
End Select 
           down_ok = False 
           up_ok = False 
           left_ok = False 
           right_ok = False 
 
End Function 
Function move_down(Index As Integer) 
    Command1(Index).Top = Command1(Index).Top + 600 
Label1.Caption = Label1.Caption + 1 
step1 = step1 + 1 
 
Data1.Recordset.AddNew 
    Data1.Recordset("aa") = step1 
    Data1.Recordset("b00") = b(0, 0) 
    Data1.Recordset("b01") = b(0, 1) 
    Data1.Recordset("b10") = b(1, 0) 
    Data1.Recordset("b11") = b(1, 1) 
    Data1.Recordset("b20") = b(2, 0) 
    Data1.Recordset("b21") = b(2, 1) 
    Data1.Recordset("b30") = b(3, 0) 
    Data1.Recordset("b31") = b(3, 1) 
    Data1.Recordset("b40") = b(4, 0) 
    Data1.Recordset("b41") = b(4, 1) 
    Data1.Recordset("b50") = b(5, 0) 
    Data1.Recordset("b51") = b(5, 1) 
    Data1.Recordset("b60") = b(6, 0) 
    Data1.Recordset("b61") = b(6, 1) 
    Data1.Recordset("b70") = b(7, 0) 
    Data1.Recordset("b71") = b(7, 1) 
    Data1.Recordset("b80") = b(8, 0) 
    Data1.Recordset("b81") = b(8, 1) 
    Data1.Recordset("b90") = b(9, 0) 
    Data1.Recordset("b91") = b(9, 1) 
    Data1.Recordset("a00") = a(0, 0) 
    Data1.Recordset("a01") = a(0, 1) 
    Data1.Recordset("a02") = a(0, 2) 
    Data1.Recordset("a03") = a(0, 3) 
    Data1.Recordset("a10") = a(1, 0) 
    Data1.Recordset("a11") = a(1, 1) 
    Data1.Recordset("a12") = a(1, 2) 
    Data1.Recordset("a13") = a(1, 3) 
    Data1.Recordset("a20") = a(2, 0) 
    Data1.Recordset("a21") = a(2, 1) 
    Data1.Recordset("a22") = a(2, 2) 
    Data1.Recordset("a23") = a(2, 3) 
    Data1.Recordset("a30") = a(3, 0) 
    Data1.Recordset("a31") = a(3, 1) 
    Data1.Recordset("a32") = a(3, 2) 
    Data1.Recordset("a33") = a(3, 3) 
    Data1.Recordset("a40") = a(4, 0) 
    Data1.Recordset("a41") = a(4, 1) 
    Data1.Recordset("a42") = a(4, 2) 
    Data1.Recordset("a43") = a(4, 3) 
 
Data1.UpdateRecord 
 
Select Case Index 
Case 0, 2, 3, 5 
a(b(Index, 0), b(Index, 1)) = 0 
b(Index, 0) = b(Index, 0) + 1 
a(b(Index, 0) + 1, b(Index, 1)) = 1 
Case 1 
a(b(Index, 0), b(Index, 1)) = 0 
a(b(Index, 0), b(Index, 1) + 1) = 0 
b(Index, 0) = b(Index, 0) + 1 
a(b(Index, 0) + 1, b(Index, 1)) = 1 
a(b(Index, 0) + 1, b(Index, 1) + 1) = 1 
 
Case 4 
a(b(Index, 0), b(Index, 1)) = 0 
a(b(Index, 0), b(Index, 1) + 1) = 0 
 
b(Index, 0) = b(Index, 0) + 1 
a(b(Index, 0), b(Index, 1)) = 1 
a(b(Index, 0), b(Index, 1) + 1) = 1 
 
Case 6, 7, 8, 9 
a(b(Index, 0), b(Index, 1)) = 0 
b(Index, 0) = b(Index, 0) + 1 
a(b(Index, 0), b(Index, 1)) = 1 
End Select 
           down_ok = False 
           up_ok = False 
           left_ok = False 
           right_ok = False 
 
End Function 
 
Function move_up(Index As Integer) 
    Command1(Index).Top = Command1(Index).Top - 600 
Label1.Caption = Label1.Caption + 1 
step1 = step1 + 1 
 
Data1.Recordset.AddNew 
    Data1.Recordset("aa") = step1 
    Data1.Recordset("b00") = b(0, 0) 
    Data1.Recordset("b01") = b(0, 1) 
    Data1.Recordset("b10") = b(1, 0) 
    Data1.Recordset("b11") = b(1, 1) 
    Data1.Recordset("b20") = b(2, 0) 
    Data1.Recordset("b21") = b(2, 1) 
    Data1.Recordset("b30") = b(3, 0) 
    Data1.Recordset("b31") = b(3, 1) 
    Data1.Recordset("b40") = b(4, 0) 
    Data1.Recordset("b41") = b(4, 1) 
    Data1.Recordset("b50") = b(5, 0) 
    Data1.Recordset("b51") = b(5, 1) 
    Data1.Recordset("b60") = b(6, 0) 
    Data1.Recordset("b61") = b(6, 1) 
    Data1.Recordset("b70") = b(7, 0) 
    Data1.Recordset("b71") = b(7, 1) 
    Data1.Recordset("b80") = b(8, 0) 
    Data1.Recordset("b81") = b(8, 1) 
    Data1.Recordset("b90") = b(9, 0) 
    Data1.Recordset("b91") = b(9, 1) 
    Data1.Recordset("a00") = a(0, 0) 
    Data1.Recordset("a01") = a(0, 1) 
    Data1.Recordset("a02") = a(0, 2) 
    Data1.Recordset("a03") = a(0, 3) 
    Data1.Recordset("a10") = a(1, 0) 
    Data1.Recordset("a11") = a(1, 1) 
    Data1.Recordset("a12") = a(1, 2) 
    Data1.Recordset("a13") = a(1, 3) 
    Data1.Recordset("a20") = a(2, 0) 
    Data1.Recordset("a21") = a(2, 1) 
    Data1.Recordset("a22") = a(2, 2) 
    Data1.Recordset("a23") = a(2, 3) 
    Data1.Recordset("a30") = a(3, 0) 
    Data1.Recordset("a31") = a(3, 1) 
    Data1.Recordset("a32") = a(3, 2) 
    Data1.Recordset("a33") = a(3, 3) 
    Data1.Recordset("a40") = a(4, 0) 
    Data1.Recordset("a41") = a(4, 1) 
    Data1.Recordset("a42") = a(4, 2) 
    Data1.Recordset("a43") = a(4, 3) 
 
Data1.UpdateRecord 
 
Select Case Index 
Case 0, 2, 3, 5 
a(b(Index, 0) + 1, b(Index, 1)) = 0 
b(Index, 0) = b(Index, 0) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
Case 1 
a(b(Index, 0) + 1, b(Index, 1)) = 0 
a(b(Index, 0) + 1, b(Index, 1) + 1) = 0 
b(Index, 0) = b(Index, 0) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
a(b(Index, 0), b(Index, 1) + 1) = 1 
 
Case 4 
a(b(Index, 0), b(Index, 1)) = 0 
a(b(Index, 0), b(Index, 1) + 1) = 0 
 
b(Index, 0) = b(Index, 0) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
a(b(Index, 0), b(Index, 1) + 1) = 1 
 
Case 6, 7, 8, 9 
a(b(Index, 0), b(Index, 1)) = 0 
b(Index, 0) = b(Index, 0) - 1 
a(b(Index, 0), b(Index, 1)) = 1 
End Select 
           down_ok = False 
           up_ok = False 
           left_ok = False 
           right_ok = False 
 
End Function