Would there be any interest in a 4-in-a-Row robot? 4ir forum

18 replies. Last post: 2009-01-29

Reply to this topic Return to forum

Would there be any interest in a 4-in-a-Row robot?
  • FatPhil at 2007-11-15

    For those that don't know, I'm the fool who wastes time programming RoRoRo the Bot.

    I've been considering adding other games to his repertory, and think that perhaps 4-in-a-Row would be a possibility, as it has simple enough rules, and a simple-enough way of evaluating if the game is won or lost.

    The plan would not be to create an all-conquering AI, instead I'm more interested in having something that's very quick and fun for most people to play against. Also, I plan to write the whole engine from scratch. (Which is another reason why I do not expect it to be so strong!)

    If there would be interest, please pipe up.

    (I want to completely rewrite the Dvonn engine, as it's a bit stupid, so need a good excuse for delaying that!)

  • Ed Collins at 2007-11-15

    Many years ago, when I first became fascinated and addicted to Four-In-A-Row, I started writing my own engine. (I didn't care about graphics… if need be, I could add that later… I was just interested in writing the AI.)

    Alas, I never finished it. (Like a lot of my programs, actually.) And because of that, I was always able to defeat it, which means I never reached my goal… to create a program that was strong enough that I couldn't beat it.

    If you write such an engine I'd be interested in your general source code, how many plies the bot looks ahead, what criteria it uses to evaluate its moves, etc. (You know, just general programmers chit-chat.) But if you do write such an engine, I would ask that you rethink your plan and DO try to create an “all-conquering AI.” Anyone can write a program (well, maybe not anyone but lots of people) that plays the game. The hard part is to write a strong bot! I'd like to be able to feed it a position and have it tell me the best move. Also note that 8x8 still hasn't been solved, which I find somewhat hard to believe at this day and age. Maybe you can get your name in the record books by solving it!

  • FatPhil at 2007-11-16

    What's this “graphics” of which you speak ;-) ?

    If you as a mid-1800s could always beat your bot, then I presume that it was only punching at about 1500? I'd definitely want to aim higher than that.

    However, first I'll need to get some insight into the game. I've never really played it. (Except as a kid, on 7x6, when I payed pretty randomly.) What state is your program in? Maybe if I could play against it, I'd see what level of AI is required to be a useful opponent for a ~1500 kind of player. What AI did actually get put into it, and what kinds of things are missing? I'd indeed love to have some general programmer chit-chat. I think I've got some ideas on the 'state' I'd like to maintain, and am tempted to just start hacking away. However, if I end up with something that's got no future and that I as a novice can beat every time, then it won't really have been worth the effort.

  • pedropajarito at 2007-11-16

    FatPhil, what about a reversi bot?, I think there could be some interest….

  • FatPhil at 2007-11-17

    There are several very strong reversi programs out there already, so I think it's lower priority. Eventually I'd like to have him playing every game, of course…

  • TUMRAK at 2007-11-17

    how about a dots and boxes bot

  • FatPhil at 2007-11-17

    dots and boxes is actually quite tricky. Even winning the LCB isn't (a) easy, or (b) guaranteed to get you the win. It's a funny game as there are several quite distinct levels of 'tech' that you need to learn, and you're almost always guaranteed to beat someone on a lower level of tech. I don't know where I'd start!

    4ir and reversi will definitely be before d&b.

  • ypercube at 2007-11-17

    I would prefer 4ir and breakthrough before dots (as we have or we had Knox there) and reversi (where there are many good programs out there).

  • FatPhil at 2007-11-17

    Yeah, the only thing that keeps reversi above the horizon is that there are no current bots playing it here. Assuming that RoRoRo's as popular at those as it is at Dvonn and EinStein, then it's worth doing for the masses. That and it should be pretty easy to program.

    To get some ideas about the tech required to make a good program, I downloaded a program which looks only 3 plies deep, and utterly thrashed it even when I wasn't even paying attention to what I was doing. So I'd need to do some proper alpha-beta pruning nonsense rather than just a quick hack.

    Breakthrough, I just don't grasp. It'll definitely need zobringing, which none of the previous programs have required.

  • FatPhil at 2008-04-02

    Quick question, now I'm programming a first hack at a 4ir bot - am I right in thinking that player 1, yellow, can _never_ force a win from an even threat?

    Let's assume there's a column with an even threat Y, and then the rest of the threats U. Initially assume no red threats above Y. If it's y's turn then y can either kill Y and then play U as if Y didn't exist, or can play U as if Y didn't exist. If it's r's turn, then r can simply play U as if Y didn't exist, and then y will kill Y. So the outcome of Y+U is the same as the outcome of U.

    If we then permit red to have a threat in the same column as Y. The argument then proceeds similarly except that if red's threat there is an even threat, then if U ends up being a draw, red finally gets a win. Which is precisely what would happen if the red threat was there, but Y wasn't.

    Therefore in all cases Y+U = U.

    Is that sound?

  • FatPhil at 2008-04-18

    It matters not, I'm not evaluating such things currently. However, as you can tell from the waiting room and the tournament signup, RoRoRo now plays 4 in a row.

  • FatPhil at 2008-04-21

    He was so completely broken I rewrote him today, pretty much from scratch. Hopefully he can give 1600+ players a better game now.

    He's configured currently to take about 0.1-0.4s/move on my P3/700. So if he's too stupid, I can crank him up a couple more notches. (I'll add a feature like the one in Dvonn to request a different level of play via an in-game message too if there's interest.)

  • Balladbird at 2008-04-22

    All his games in the april tournament have concluded, and he won 3 of four of them, his rating seems uneven, and I admit I'm not a skilled enough player to give him proper credit, but I think the 4bot is a welcome addition to the site. He certainly makes it easier for me to play practice games.

  • Balladbird at 2008-04-22

    wow, I truly wasn't paying attention to grammar in that post. _

  • FatPhil at 2008-04-23

    I too don't know enough about the game to know how strong he is. He beats me about 90% of the time, but so do a lot of people. All I know is that he's more than 5 times faster than “Connect-4 Algorithm Version 3.10 By Keith Pomakis”

    And beats it well over 50% of the time at the same parametrisation (about 100 points rating difference). It's not really a fair comparison, as Keith's code generalises to any possible board size. (However, mine shouldn't be too hard to parametrise, I just have no incentive currently.) It will take a month or so before RoRoRo reaches some kind of steady state, ratings wise, and I'll see if I need to improve his algorithm at all. I'd like to see if Ed can beat it every time. I suspect he can, as there seems to be a certain threshold beyond which players above always beat players below (similar to dots and boxes, but less extreme).

  • my_immortal at 2009-01-29

    Im very impressed with your robot, I had the pleasure of playing against it in a tourney game yesterday, I deliberately put in a common mistake, and the robot took advantage of it, to easily win the game.

    Im looking forward to the next game, to see, if I actually CAN beat the robot!

  • wccanard at 2009-01-29

    my_immortal: you can challenge RoRoRo: he'll always accept. Occasionally when I've wanted to waste some time I've challenged him to 3 or 4 games at once—that way there's always one game waiting for you once you've thought about your move in another game.

  • my_immortal at 2009-01-29

    I played two games with him now, I was P1 in both games. One with a center opening which I won, and one with the weaker opening at G1, which RoRoRo won. Again, the robot is very strong at detecting any weak moves! Im impressed. Its definitely worth practicing variations again RoRoRo!

Return to forum

Reply to this topic