Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 109,542 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,182 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



playervscomputer computer always win even if playing second

 
Reply to this topicStart new topic

playervscomputer computer always win even if playing second, how do i create this cmd

wanopene04@yahoo.co.nz
post 7 Aug, 2008 - 12:08 AM
Post #1


New D.I.C Head

*
Joined: 6 Aug, 2008
Posts: 1

vb

Option Explicit
' Scoring arrays
' These are added to determine when
' a player has won
Dim iXPos(3, 3) As Integer
Dim iOPos(3, 3) As Integer
' Determines who plays next AND
' Used as boolean test variable
Dim sPlaySign As String
' Counts the number of moves
Dim iMove As Integer
' Scoreboard variables
Dim iXScore As Integer
Dim iOScore As Integer

' Get ready to play another game
Sub InitPlayGround()
Dim i As Integer
Dim j As Integer
Dim e As Integer
' Erase any playing grid symbols
For i = 1 To 3
For j = 1 To 3
lblPlayGround((i - 1) * 3 + j - 1).Caption = ""
iXPos(i, j) = 0
iOPos(i, j) = 0
Next j
Next i

' Erase any win lines
For i = 0 To 7
linWin(i).Visible = False
Next i

' Set the next player to the appropriate sign
If optOPlayer.Value = True Then
sPlaySign = "O"
Else
sPlaySign = "X"
End If

' Number of moves so far is zero
iMove = 0

' The game isn't started until a player
' clicks the playing grid
' Display the label, not the command button
cmdNewGame.Visible = False
End Sub

Private Sub cmdExit2_Click()
Load frmGames
frmGames.Show
Unload Me

End Sub

Private Sub cmdNewGame_Click()
' This button is only visible after someone clicks the
' playing grid and is reset to not visible
' after a win or draw

If MsgBox("Do you want to end the current game?", _
vbYesNo, "Start a New Game?") = vbYes Then Call InitPlayGround
End Sub

Private Sub cmdPlayerVComputer_Click()

End Sub

Private Sub cmdNewGame1_Click()
' This button enabled after someone clicks the playing grid

If MsgBox("Do you want to end the current game?", _
vbYesNo, "Start a New Game?") = vbYes Then Call InitPlayGround

End Sub


Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM

Go to the top of the page


born2c0de
post 7 Aug, 2008 - 06:44 AM
Post #2


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,748



Thanked 20 times

Dream Kudos: 2800

Expert In: C, C++, VB, VB.NET, C#, Java, x86 Assembly, Win32 API, Reversing

My Contributions


Moved to VB6.
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 7 Aug, 2008 - 11:14 AM
Post #3


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,248



Thanked 52 times

Dream Kudos: 7775

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI, Boo.Net

My Contributions


Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do

Also, please put your question in the body of your post, not the description. The description only holds a small amount of characters and your question gets cut off smile.gif
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/7/08 09:56PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month