Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 6: Программирование на Visual Basic искусственного интеллекта. Продолжение 2. Валерий Алексеевич Жарков
Чтение книги онлайн.
Читать онлайн книгу Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 6: Программирование на Visual Basic искусственного интеллекта. Продолжение 2 - Валерий Алексеевич Жарков страница 25
prePic(i).Image = Image.FromFile(ImgList(ThreeBI(i)))
col = ThreeBP(i) Mod 9
row = ThreeBP(i) \ 9
prePic(i).Location = New Point(col * 45 + _
intBaseX + (38 – prePic(i).Width) / 2, _
row * 45 + intBaseY + (38 – prePic(i).Height) / 2)
prePic(i).Visible = True
prePic(i).BringToFront()
End If
If ThreeBI(0) <> -1 Then
picBallPre1.Visible = True
picBallPre1.Image = _
Image.FromFile(ImgList(ThreeBI(0)))
End If
If ThreeBI(1) <> -1 Then
picBallPre2.Visible = True
picBallPre2.Image = _
Image.FromFile(ImgList(ThreeBI(1)))
Else
picBallPre2.Visible = False
End If
If ThreeBI(2) <> -1 Then
picBallPre3.Visible = True
picBallPre3.Image = _
Image.FromFile(ImgList(ThreeBI(2)))
Else
picBallPre3.Visible = False
End If
Next
End Sub
Private Sub PrePic_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim i As Integer = Array.IndexOf(prePic, sender)
Dim MP As MotionPic = MPBoxes(ThreeBP(i))
Call Ball_Click(MP, e)
End Sub
'#Region "Save and Load Game"
Private Sub SaveGame()
Dim strNewLine = Chr(13) + Chr(10)
Dim s As String = Nothing
playerScore = DDScore.number
playerTime = DDTime.number
s += "#Assignment Line" + strNewLine
s += playerName.ToString + strNewLine
s += playerScore.ToString + strNewLine
s += playerTime.ToString + strNewLine
For i As Integer = 0 To 2
s += ThreeBI(i).ToString + ";" + ThreeBP(i).ToString
If i < 2 Then
s += ","
End If
Next
s += strNewLine
For i As Integer = 0 To 80
s += MPBoxes(i).MPState.ToString + ";" + _
MPBoxes(i).MPIndex.ToString
If i < 80 Then
s += ","
End If
Next
Dim SW As StreamWriter = Nothing
Try
SW = New StreamWriter("LSF.vmt")
SW.Write(s)
Catch IOE As IOException
MessageBox.Show("Can't save File !", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch EX As Exception
MessageBox.Show("Some Error occurs while Saving" + _
strNewLine + "Error :" + EX.ToString, _
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
SW.Close()
End Try
End Sub
Private Sub LoadGame()
Dim strRead(4) As String
Dim strBigArr() As String
Dim strSmallArr() As String
Dim SR As StreamReader = Nothing
If Not File.Exists("LSF.vmt") Then
MessageBox.Show("Save File doesn't Exists", _
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
Try
SR = New StreamReader("LSF.vmt")
If SR.ReadLine <> "#Assignment Line" Then
MessageBox.Show("Invalid Loaded File", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
SR.Close()
Exit Sub
End If
For i As Integer = 0 To 4
strRead(i) = SR.ReadLine
Next
Catch IOE As IOException
MessageBox.Show("Can't load File !", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch EX As Exception
MessageBox.Show("Some Error occurs while Loading" + _
Chr(13) + Chr(10) + "Error :" + EX.ToString, _
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
SR.Close()
End