Tic Tac Toe spel (5 / 5 steg)
Steg 5: Win Disk
Private Sub RoundWin_Show(sender As System.Object, e As System.EventArgs) hanterar Me.MouseMove End Sub
"Detta är den kod som kommer att hända när musen flyttas".
39. infoga följande kod mellan privata Sub och End Sub
Dim BlueWin som sträng = Str$(Val(BlueWinCounter.Text) + 1)
Dim RedWin som sträng = Str$(Val(RedWinCounter.Text) + 1)
"Detta är kod som gör BlueWin och RedWin en sträng. Om händelsen inträffar det att lägga till + 1 poäng till spelare. "
40. följande kod är vinner.
Om OvalShape1.Visible = True och OvalShape2.Visible = True och OvalShape3.Visible = sant då Om OvalShape4.Visible = True och OvalShape5.Visible = True och OvalShape6.Visible = sant då Om OvalShape7.Visible = True och OvalShape8.Visible = True och OvalShape9.Visible = sant då Om OvalShape1.Visible = True och OvalShape4.Visible = True och OvalShape7.Visible = sant då Om OvalShape2.Visible = True och OvalShape5.Visible = True och OvalShape8.Visible = sant då Om OvalShape3.Visible = True och OvalShape6.Visible = True och OvalShape9.Visible = sant då
BlueWinCounter.Text = BlueWin
Slut om
BlueWinCounter.Text = BlueWin
Slut om
BlueWinCounter.Text = BlueWin
Slut om
BlueWinCounter.Text = BlueWin
Slut om
BlueWinCounter.Text = BlueWin
Slut om
BlueWinCounter.Text = BlueWin
Slut om
Om OvalShape1.Visible = True och OvalShape5.Visible = True och OvalShape9.Visible = sant då
BlueWinCounter.Text = BlueWin
Slut om
Om OvalShape3.Visible = True och OvalShape5.Visible = True och OvalShape7.Visible = sant då
BlueWinCounter.Text = BlueWin
Slut om
Om LineShape1.Visible och LineShape3.Visible och LineShape5.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape7.Visible och LineShape9.Visible och LineShape11.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape13.Visible och LineShape15.Visible och LineShape17.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape1.Visible och LineShape7.Visible och LineShape13.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape3.Visible och LineShape9.Visible och LineShape15.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape5.Visible och LineShape11.Visible och LineShape17.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape1.Visible och LineShape9.Visible och LineShape17.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
Om LineShape5.Visible och LineShape9.Visible och LineShape13.Visible = sant då
RedWinCounter.Text = RedWin
Slut om
"Lägger 1 till Win Disk om det finns en 3 i rad"
41. infoga följande kod under föregående kod anges:
Om OvalShape1.Visible = True och OvalShape2.Visible = True och OvalShape3.Visible = True eller
OvalShape4.Visible = True och OvalShape5.Visible = True och OvalShape6.Visible = True eller
OvalShape7.Visible = True och OvalShape8.Visible = True och OvalShape9.Visible = True eller
OvalShape1.Visible = True och OvalShape4.Visible = True och OvalShape7.Visible = True eller
OvalShape2.Visible = True och OvalShape5.Visible = True och OvalShape8.Visible = True eller
OvalShape3.Visible = True och OvalShape6.Visible = True och OvalShape9.Visible = True eller
OvalShape1.Visible = True och OvalShape5.Visible = True och OvalShape9.Visible = True eller
OvalShape3.Visible = True och OvalShape5.Visible = True och OvalShape7.Visible = True eller
LineShape1.Visible = True och LineShape3.Visible = True och OvalShape5.Visible = True eller
LineShape7.Visible = True och LineShape9.Visible = True och LineShape11.Visible = True eller
LineShape13.Visible = True och LineShape15.Visible = True och LineShape17.Visible = True eller
LineShape1.Visible = True och LineShape7.Visible = True och LineShape13.Visible = True eller
LineShape3.Visible = True och LineShape9.Visible = True och LineShape15.Visible = True eller
LineShape5.Visible = True och LineShape11.Visible = True och LineShape17.Visible = True eller
LineShape1.Visible = True och LineShape9.Visible = True och LineShape17.Visible = True eller
LineShape5.Visible = True och LineShape9.Visible = True och LineShape13.Visible = True eller
RectangleShape1.Enabled = False och RectangleShape2.Enabled = False och RectangleShape3.Enabled = False och RectangleShape4.Enabled = False och RectangleShape5.Enabled = False och RectangleShape6.Enabled = False och RectangleShape7.Enabled = False och RectangleShape8.Enabled = False och RectangleShape9.Enabled = falskt då
"Detta är alla möjligheter till en seger"
OvalShape1.Visible = False
OvalShape2.Visible = False
OvalShape3.Visible = False
OvalShape4.Visible = False
OvalShape5.Visible = False
OvalShape6.Visible = False
OvalShape7.Visible = False
OvalShape8.Visible = False
OvalShape9.Visible = False
LineShape1.Visible = False
LineShape2.Visible = False
LineShape3.Visible = False
LineShape4.Visible = False
LineShape5.Visible = False
LineShape6.Visible = False
LineShape7.Visible = False
LineShape8.Visible = False
LineShape9.Visible = False
LineShape10.Visible = False
LineShape11.Visible = False
LineShape12.Visible = False
LineShape13.Visible = False
LineShape14.Visible = False
LineShape15.Visible = False
LineShape16.Visible = False
LineShape17.Visible = False
LineShape18.Visible = False
"Gör alla cirklar och korsar osynlig"
RectangleShape1.Enabled = sant
RectangleShape2.Enabled = sant
RectangleShape3.Enabled = sant
RectangleShape4.Enabled = sant
RectangleShape5.Enabled = sant
RectangleShape6.Enabled = sant
RectangleShape7.Enabled = sant
RectangleShape8.Enabled = sant
RectangleShape9.Enabled = sant
"Här kan rutorna igen"
End om
"Om det finns en vinst då spelplanen återställs"
42. debug spelet och åtgärda eventuella fel funna.