Results 1 to 5 of 5

Thread: AI for Tic Tac Toe

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Iowa
    Posts
    96

    AI for Tic Tac Toe

    VB Code:
    1. Public Function compturn()
    2.  
    3. '
    4.  
    5. Dim compmove As Integer
    6. Dim mask As Object
    7. mask = Format(compmove, "btn#")
    8. compmove = CStr(Int(Rnd() * 10))
    9. Label4.Text = mask
    10. mask.Text = "O"
    11. mask.Enabled = False
    12.  
    13. 'Make sure that a button that is already clicked
    14. 'by either the user or the computer is not clicked again
    15.  
    16. If mask.Enabled = False And compmove = 1 Then
    17. compmove += 1
    18.  
    19. If compmove = 10 Then
    20. compmove = 1
    21. End If
    22. 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!

  2. #2
    Ya ya Baby!!!Me is Back
    Join Date
    Jul 2002
    Posts
    362
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Iowa
    Posts
    96
    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!

  4. #4
    Ya ya Baby!!!Me is Back
    Join Date
    Jul 2002
    Posts
    362
    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.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2003
    Location
    Iowa
    Posts
    96
    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
  •  



Click Here to Expand Forum to Full Width