Thread: AI contest: Connect four

  1. #46
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Yes, but I messed it up on purpose to avoid spam.
    Please don't post it.
    I know, a couple of hours later it hit me like a brick why you did that, but by then the server went down so I couldn't edit it. Sorry!

    I just sent you my entry.

  2. #47
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    submitted last night.

    I noticed the current game files dont check for a tie. They just force the player to move if the board is full, which is obviously an illegal move. This should be accounted for.

    Also, how are you going to decide who goes first in the tournament?

  3. #48
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    My guess is you play twice against you opponant each having an opportunity to go first.

  4. #49
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Just wanted to point out (I don't know if anyone else has) there should be some bounds checking. Running my code could possibly crash if there isn't.

    For example in at():
    Code:
    if (x < 0 || x >= width || y < 0 || y >= height)
      return ' ';
    and in canMove():
    Code:
    if (x < 0 || x >= width)
      return false;
    I assume that the files we were supplied with are not the complete versions that will be used for the competition, but you can't be too sure.

  5. #50
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Perspective
    submitted last night.

    I noticed the current game files dont check for a tie. They just force the player to move if the board is full, which is obviously an illegal move. This should be accounted for.

    Also, how are you going to decide who goes first in the tournament?
    I've fixed the 'game engine' so it correctly checks for a tie.

    I'll make each player play against each other two times, so each one can start once. The board dimensions will be slightly random, but not the number of pieces needed to win.

    I've recived submissions from you three, I'll PM the others to check whether they'll submit or not. Either way, the tournament will begin soon.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #51
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    >>I'll make each player play against each other two times, so each one can start once. The board dimensions will be slightly random, but not the number of pieces needed to win.<<

    Ack, I didn't know the dimensions of the board would change, I thought it was going to stay the standard 7x6. A big chunk of my code is hard coded for this size board because getMove() was the only function to be called and I didn't want to recalculate every move. Looks like my entry will have to sit out anything that isn't 7x6.

  7. #52
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    mine as well is "optimized" to run at 7x6, though syntactially it should handle any size. Havent actually tried yet though

    >>I'll make each player play against each other two times
    so what happens in a 1:1 tie?

  8. #53
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    >>mine as well is "optimized" to run at 7x6, though syntactially it should handle any size.<<

    Heh, not mine. Anything other than 7x6 and its crash and burn baby.

  9. #54
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    I'm very curious how ya'll approached this here program because I never even had even the slightest thought about taking into account the dimensions of the playing area... Hmm...

  10. #55
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    OK, the board will be 7x6. But the idea was to use Board::width and Board::height to make the program able to handle different boards. But since neither of you have taken this into account (although Perpective sent me a slightly updated version) I guess the contest will be better if the board stays 7x6.

    so what happens in a 1:1 tie?
    A win = 2 points
    A tie = 1 point each
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  11. #56
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    well, mine is totaly independant of board size. It more or less was in the first place i just changed some stored values to be calculated on the fly based on board dimensions. But a fixed size is cool by me.

    >>A win = 2 points
    >>A tie = 1 point each
    yeah, what i meant was what happens if one game is one by each player ( a score of 2 to 2). If you simply try to play the AI's against each other again your likely to just see the same games repeat themselves (unless one of them use a stochastic algorithm)

  12. #57
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    If only 3 of us submit i can submit my "FooBot" as well just for the sake of having competitors in the tournament. Its a slightly better than random player that should get destroyed by most of our AI's. Maybe the other players have some test bots as well? Also, im sure Sang-drax has an AI for his game, maybe he can enter that in the tournament if we dont get a better turn out.

  13. #58
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Perspective
    If you simply try to play the AI's against each other again your likely to just see the same games repeat themselves (unless one of them use a stochastic algorithm)
    That was why I wanted to alter the board size a little between the games.

    It will be a tournament and the program with most points at the end will be the winner.

    The others aren't finished and it isn't that likely they will submit anything. I will start the first game soon, but I see no problem in adding another contestant later.

    These are the preliminary rules:
    Each player plays each other one twice and they begin the game once each.
    Win = 2 points
    Loss = 0 points
    Tie = 1 point.

    If a player earns any points with an average moving time of more than 1 second, ˝ point will be removed for each ˝ second above 1 second.

    The player with the most points at the end of the tournament wins.

    EDIT: http://cboard.cprogramming.com/showt...286#post411286
    Last edited by Sang-drax; 11-10-2004 at 01:14 PM.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  14. #59
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    The following changes had to be made to make your submissions compile:
    LuckY
    Had to change your for loops so that x is declared in each loop, not just the first, like the standard says.

    PJYelton
    The getMove function (and all other functions) take Board& instead of const Board&, which is unacceptable.
    I had to do this:
    Code:
    int getMove(const Board& cboard, char player)
    {
         Board board = cboard;
         //Unchanged from here
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  15. #60
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Oops, I was going to change to const board once I relooked up the original post, but some reason I forgot.

    If I have time this weekend I'll try to update my algorithm to account for different size boards. That way we can extend the tourney if we want to.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Action Game - AI Contest
    By Queatrix in forum Contests Board
    Replies: 4
    Last Post: 01-18-2007, 06:55 PM
  2. New AI contest: sign up
    By Sang-drax in forum Contests Board
    Replies: 20
    Last Post: 07-27-2005, 05:54 PM
  3. chess ai contest
    By Raven Arkadon in forum Contests Board
    Replies: 7
    Last Post: 07-09-2005, 06:38 AM
  4. AI Contest Proposal
    By MadCow257 in forum Contests Board
    Replies: 4
    Last Post: 03-13-2005, 03:27 PM
  5. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 10:35 AM