|
-
Jan 12th, 2004, 08:09 PM
#1
Thread Starter
Lively Member
AI for Tic Tac Toe
VB Code:
Public Function compturn()
'
Dim compmove As Integer
Dim mask As Object
mask = Format(compmove, "btn#")
compmove = CStr(Int(Rnd() * 10))
Label4.Text = mask
mask.Text = "O"
mask.Enabled = False
'Make sure that a button that is already clicked
'by either the user or the computer is not clicked again
If mask.Enabled = False And compmove = 1 Then
compmove += 1
If compmove = 10 Then
compmove = 1
End If
End If
So I have my form settup with 9 buttons named btn1, btn2...etc
I'm trying to make it so that if you click a button it will go X, then the computer will randomly select a spot, the problem lies in this line "mask.Text = "O" " or at least that is where the error is given, any help or suggestions would be greatly appreciated, I can try to explain more of what i'm trying to do but I need specific questions otherwise i dont know what to tell you.. thanks in advance
It is like wiping your ass with silk, I love it!
-
Jan 12th, 2004, 08:52 PM
#2
Ya ya Baby!!!Me is Back
http://planet-source-code.com
Check in VB and you will see a lot of exemple. This game was created more than once in the past
-
Jan 12th, 2004, 08:54 PM
#3
Thread Starter
Lively Member
this is VB.net, but i'll check still any help would be appreciated
It is like wiping your ass with silk, I love it!
-
Jan 12th, 2004, 09:24 PM
#4
Ya ya Baby!!!Me is Back
I know that's vb.net but the AI doesn't change. I'll send you a piece of code if I can get back my old tictacttoe project.
-
Jan 12th, 2004, 09:26 PM
#5
Thread Starter
Lively Member
anyone have any good tutorial sites, it doesnt have to relate to this, just tutorials on anything and everything from beginner to advanced?
It is like wiping your ass with silk, I love it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|