Results 1 to 4 of 4

Thread: tic tac toe question

  1. #1
    Join Date
    Nov 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default tic tac toe question

    Check this code

    http://pastebin.com/m1503a55f

    How do I make it human vs computer instead of human vs human?

    I tried many possibilities, I cant get anywhere, any guidance?

  2. #2
    Join Date
    Nov 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    anyone have ideas

  3. #3
    Join Date
    May 2006
    Posts
    259
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    Sure, but you're gonna have to pay for it.

  4. #4
    Join Date
    Feb 2007
    Location
    Earth
    Posts
    133
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default

    using the random function aka $variable = rand(min,max); in a few places should get your artificial intelligence in no time

    if you are looking for a random challenge, keep it simple and have one random variable from 1-9 indicating where on the board the marker shall be placed

    if you are looking for say, 2 or 3 skills levels, use many if statements and random numbers to determine whether the ai should make the right move

    for instance:

    //computers turn
    $random=rand(1,9);
    if($random=1){
    $postmarker;
    }elseif($random=2){
    $postmarker;
    }

    ect...

    to add difficulty you will need to place checks to see where your markers are on the board to determine whether the computer should place there or not

    good luck
    http://www.insanecombat.com << bored? check out ma game

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •