PDA

View Full Version : Connect 4


All Clear
01-08-2004, 01:06 PM
While very easy to learn, IMO it is the simplest game to learn complex strategies for- I now play it at home with siblings to determine who washes the dishes after meals, and everyone is still shocked how I win every single game. I guess people perceive it to be a simplistic game, and that there can't be anything more to it then just dropping in chips without thinking too much.

DukeBlue
01-08-2004, 01:23 PM
Just played it for the first time in 24 years (against my 5-yr-old). I'm trying not to be too strategic until he learns some strategy himself. But I did teach him to say "Pretty sneaky, sis!"

Flora
01-08-2004, 01:29 PM
My 4 year old doesn't want me to block him.
We are trying to teach him that in some games, not only are you trying to win, you are trying to keep the other person from winning. So I also point out to him where he can block me (sometimes).

He also likes making interesting patterns :)

VernSchil
01-08-2004, 01:37 PM
What are some clever strategies? I programmed a version of Connect-4 in Java awhile ago but my computer player's strategies sucked. I'd like to revise the program at some point.

Dr T Non-Fan
01-08-2004, 01:53 PM
Maybe a new programmer? Just a thought.

VernSchil
01-08-2004, 02:10 PM
Maybe a new programmer? Just a thought.

You don't need to make comments like that. I did a little programming for fun back when I thought I might make a career out of that stuff. I had no advanced classes in computer AI or anything and only had 2 semesters of programming at the time so give me a break.

carrot
01-08-2004, 02:23 PM
Maybe a new programmer? Just a thought.

You don't need to make comments like that. I did a little programming for fun back when I thought I might make a career out of that stuff. I had no advanced classes in computer AI or anything and only had 2 semesters of programming at the time so give me a break.
I thought it was funny. Maybe an emoticon would have helped, but I know that's not DTNF's style.

VernSchil
01-08-2004, 02:28 PM
I thought it was funny. Maybe an emoticon would have helped, but I know that's not DTNF's style.

I assumed he was being serious. If he was joking I apologize. Yeah, emoticons are essential for this kind of thing. I've been nearly decapitated on more than one occasion for misconstrued sarcasm or levity over the internet.

Ebenezer Kohl
01-08-2004, 02:30 PM
I recently played my sister a couple of times at a tea and tapioca shop. It was like she didn't see any of the doubles coming. My only strategy is to force a place where I win or play on top to win. Otherwise I force scenarios where I hit that strategy with placement or placement on top. Realistically it should always be blocked, but it was very easy against her.

Add that to the list of games I'm not allowed to play with my family. :shake:

Darth Tater
01-08-2004, 02:34 PM
I think this game is solvable as well (Like Mancala).....most liekly whoever goes first should be able to force a win, or at worst a draw (dare I use the term CAT here?).

PS Whutup wit the games threads?

E. Blackadder
01-08-2004, 02:37 PM
http://members.aol.com/shadows125/connect4.htm

It's beaten me twice.

Dr T Non-Fan
01-08-2004, 02:45 PM
I thought it was funny. Maybe an emoticon would have helped, but I know that's not DTNF's style.

I assumed he was being serious. If he was joking I apologize. Yeah, emoticons are essential for this kind of thing. I've been nearly decapitated on more than one occasion for misconstrued sarcasm or levity over the internet.
Serious? That's a good one.
Sorry if I temporarily offended you. I've done my share of poor programming. The program is only as good as the programmer, though. You probably need a little improvement, since you have conveyed your skill of the game to the computer. Actually, it seems pretty hard to do. Having something that works is a good start.

I feel that my signature line says it all re emoticons.

ahow
01-08-2004, 03:06 PM
http://members.aol.com/shadows125/connect4.htm

It's beaten me twice.Let us know if anyone beat the AI here. I lost about 7 times.

VernSchil
01-08-2004, 03:22 PM
[quote="ZeroVektor"]I think this game is solvable as well (Like Mancala).....most liekly whoever goes first should be able to force a win, or at worst a draw (dare I use the term CAT here?).
quote]

Can't all "finite, perfect information, perfectly competitive" games be forced to at least draw? I vaguely remember that from game theory.

Gandalf
01-08-2004, 03:57 PM
"Perfectly competitive" means exactly one winner? If so, then I think the result is that, assuming optimal play, either: A should always win; B should always win; or they should always draw.

Consider the game where A and B alternate taking stones from a pile, taking 1,2 or 3 at each turn. Winner is the one to take the last stone.

If the initial pile contains a multiple of 4 stones, B should always win. If the initial stones is not a multiple of 4, A should always win.

Hex is a game of that class where it can be shown that A must have a winning strategy, but AFAIK no one knows what that strategy is. :P

All Clear
01-08-2004, 04:00 PM
What are some clever strategies? I programmed a version of Connect-4 in Java awhile ago but my computer player's strategies sucked. I'd like to revise the program at some point.

Among the important aspects of connect 4 that I didn't realize until long after I began play, is that when players are eventually forced to move at the end of the game on a column, player 1 will get the odd rows (1, 3, and 5), and player 2 will get the even ones. Therefore, as player 1, I try to set up a win early on in the game like that, and if there are no other wins over the course of the game, that will turn into victory. A common start I run into is the setup below, when I play first as X (it is now O's turn, and the O at (4,4) can be replaced with an O at (1,5) with the same basic point).

_1 2 3 4 5 6 7
6
5
4 - - - O - - -
3 - - X X - - -
2 - - X O - - -
1 - - O X - - -

Assuming nothing weird comes up later on in the game, I expect to win on the diagonal of (1,4),(2,3),(3,2),(4,1), or on the across line of (3,1),(3,2),(3,3), and (3,4), depending on whether I am able to get (3,1) or (4,1). The reason is as everything fills up across the board, I will eventually be able to get (3,2), since it is on an odd row. There are a few others things I picked up, but that is among the more notable- I would be happy to play a game via pm against someone, with the pms consisting of single numbers, just saying which column the chip is being dropped into.

Expunge
01-08-2004, 04:12 PM
"Perfectly competitive" means exactly one winner? If so, then I think the result is that, assuming optimal play, either: A should always win; B should always win; or they should always draw.

Consider the game where A and B alternate taking stones from a pile, taking 1,2 or 3 at each turn. Winner is the one to take the last stone.

If the initial pile contains a multiple of 4 stones, B should always win. If the initial stones is not a multiple of 4, A should always win.

Hex is a game of that class where it can be shown that A must have a winning strategy, but AFAIK no one knows what that strategy is. :P

Hex?

carrot
01-08-2004, 04:19 PM
All Clear: I do not understand your board setup. Instead of Xs and Os, please use black and red circles. :( and :x can probably be used as reasonable proxies. Thanks.

Reaper Temp Agency
01-08-2004, 04:21 PM
I think this game is solvable as well (Like Mancala).....most liekly whoever goes first should be able to force a win, or at worst a draw (dare I use the term CAT here?).

PS Whutup wit the games threads?

Please formalize your complaint in the "Fun" forum.

Haven't played Connect 4 since daycare... I think I will have to try it again some time.

BC
01-08-2004, 04:31 PM
I finally beat the AI - but it was NOT easy. I must have lost 5 times before I finally won.

The ending configuration:

(X = me, O = AI, . = Empty)

X .XOO . .
OXOXX . .
OXXOO . .
OOOXX .X
XOXOO .X
XXOXOOX


Hex is a game typically played on a rhombus-shaped grid of hexagons. The goal of each player is to connect a hexagon on one side of the rhombus with a hexagon on the opposite side by a path of their own color stones (one player plays North-South, the other plays East-West).

IIRC, Hex played up to 5x5 is pretty trivial to analyze (the first player has the winning strategy) but eventually it gets tougher.

Feel free to correct any errors (like I could stop you) but this should give you an idea of how the strategy is analyzed...


XXXXX12345
1 XXX. . . . .
2 XX . . . . .X
3 XX. . . . . X
4 X . . . . .XX
5 X. . . . . XX


Moves are (r,c)

Player 1, trying to connect North to South chooses (not surprisingly) (3,3).

If Player 2 does anything other than (1,2) or (5,4) on the next (or subsequent) move, player 1 quickly wraps up a path from the center to the top or bottom (whichever is more threatened by Player 2's first move). If player 2 plays (1,2), Player 1 counters with (2,4); Player 1 counters (5,4) with (4,2).

Now Player 1 has wrapped up a guaranteed path. Since they cannot both create a path, player 1 will (with careful play) win.

Note that for Player 2, (1,2) is far more effective than (2,2) or (1,3); against (2,2), player 1 counters with (2,3), and (1,3) is countered with (2,2). Player 1 will win in 5 moves UNLESS Player 2 defends with either (1,2) or (5,4) on either of the next two moves.

Gandalf
01-08-2004, 04:35 PM
Hex?
Played on a grid of hexagons, maybe 20 by 20. At each turn, a player can choose any unoccupied space.

If A can create a continuous path of "his" spaces between the left margin and the right margin, A wins.

If B can create a continous path of "his" spaces between the top margin and the bottom margin, B wins.

Games cannot end in a draw (with all squares occupied, there will be a path one way but not both).

3rookie
01-08-2004, 04:37 PM
Is Hex similar to the game show "Blockbusters?"

All Clear
01-08-2004, 04:50 PM
All Clear: I do not understand your board setup. Instead of Xs and Os, please use black and red circles. :( and :x can probably be used as reasonable proxies. Thanks.

Yellow smilies are places neither red or blue have played. X is Blue, O is Red

:roll: :roll: :roll: :roll: :roll: :roll: :roll:

:roll: :roll: :roll: :roll: :roll: :roll: :roll:

:roll: :roll: :roll: 8) :roll: :roll: :roll:

:roll: :roll: :o :o :roll: :roll: :roll:

:roll: :roll: :o 8) :roll: :roll: :roll:

:roll: :roll: 8) :o :roll: :roll: :roll:

carrot
01-08-2004, 05:29 PM
All Clear: I do not understand your board setup. Instead of Xs and Os, please use black and red circles. :( and :x can probably be used as reasonable proxies. Thanks.

Yellow smilies are places neither red or blue have played. X is Blue, O is Red

:roll: :roll: :roll: :roll: :roll: :roll: :roll:

:roll: :roll: :roll: :roll: :roll: :roll: :roll:

:roll: :roll: :roll: 8) :roll: 8) :roll:

:roll: :roll: :o :o :roll: :roll: :roll:

:roll: :roll: :o 8) :roll: :P :roll:

:roll: :roll: 8) :o :roll: :roll: :roll:
Ok, your turn. :D

cubedbee
01-08-2004, 05:31 PM
http://www.tomski.com/archive/connect4.pdf

The game has been solved. First player can always win from the center starting position, and can always draw from any other starting position. The optimal strategy seems sufficiently difficult that only a computer could implement it.

Paul Brand
01-08-2004, 05:47 PM
I finally won too (5th attempt or so).

Labeling the columns from A-G (left to right), the following is my move order. (The computer has fixed responses to each move, so you can win every time)
E,E,D,D,F,F,F,E,E,E

By the way, E is not the centre column, so you can win by starting on the columns to either side of centre (C or E)

All Clear
01-09-2004, 12:37 AM
I finally won too (5th attempt or so).

Labeling the columns from A-G (left to right), the following is my move order. (The computer has fixed responses to each move, so you can win every time)
E,E,D,D,F,F,F,E,E,E

By the way, E is not the centre column, so you can win by starting on the columns to either side of centre (C or E)

I won on my second attempt, but after replaying my game and the one you won on, I would hope that the computer simulation discussed in B^3 post is much much stronger. My game was D,D,D,E,C,E,E,E,C,A,G,G,G,G,A,B,B,F

Force Majeure
01-09-2004, 01:18 PM
WHAAOOOHHH NOOOOO... YOU SHANKED MY JENGASHIP!!!

(Sorry... trust me, it makes sense in context.)

ahow
01-09-2004, 01:39 PM
Bart: B-6
Homer: You sunk my scrabbleship!
Lisa: This game makes no sense.
Homer: Tell that to the brave men who just lost their lives. SEMPER FI!!!

Griffin 5
02-08-2004, 04:42 PM
I still hold out hope for a Connect 4 junkie to register and revive the Connect 4 thread. Because the thread is now on page 2 of the "games" section (instead of page 7 of non-actuarial topics), I think the chances are higher. One vote here for keeping all games in that section.What's "Connect 4"?

Klaymen
02-08-2004, 05:39 PM
I won on the second try, but it seemed to be pretty smart. And fast.

Sunny
02-08-2004, 07:46 PM
http://members.aol.com/shadows125/connect4.htm

It's beaten me twice.Let us know if anyone beat the AI here. I lost about 7 times.

Beat it. First time was just playing around (actually something was wrong with my screen so I didn't even get to see what happened when I clicked--nothing showed--until it's all too late, weird). Second time warm-up. Beat it the third try. :D

Piece of cake.

BTW, the way to beat AI is by not playing it with any computer-like logic. Human brains are actually far more complex and creative and therefore intelligent than computer programs, especially when it's not even being programmed by the biggest and the fastest mainframes (even then you could beat it). I had AI classes and did some AI robotic vision senior project, so I have a leg up on how to beat the stupid computer AI games. :D This particular program, it seems to me, is not too smart and does not really record your moves and strategies 3 or 5 steps ago. Knowing this, you can set things up and beat it easily.

I love this game, by the way. Always had as a kid. :D

All Clear
02-09-2004, 03:32 PM
http://members.aol.com/shadows125/connect4.htm

It's beaten me twice.Let us know if anyone beat the AI here. I lost about 7 times.

Beat it. First time was just playing around (actually something was wrong with my screen so I didn't even get to see what happened when I clicked--nothing showed--until it's all too late, weird). Second time warm-up. Beat it the third try. :D

Piece of cake.

BTW, the way to beat AI is by not playing it with any computer-like logic. Human brains are actually far more complex and creative and therefore intelligent than computer programs, especially when it's not even being programmed by the biggest and the fastest mainframes (even then you could beat it). I had AI classes and did some AI robotic vision senior project, so I have a leg up on how to beat the stupid computer AI games. :D This particular program, it seems to me, is not too smart and does not really record your moves and strategies 3 or 5 steps ago. Knowing this, you can set things up and beat it easily.

I love this game, by the way. Always had as a kid. :D

Supersonic- If you want to play a game over pm's, let me know (this offer goes out to anyone else, also). Griffen, Connect 4 is a 2 player game in which you alternate turns dropping your color checker into a 6 by 7 Matrix, and the checker falls to the bottom row in the column you chose. First player to get 4 in a row wins.

Sunny
02-09-2004, 03:35 PM
Whoa, that'd be SUPER ADDICTIVE, and talk about super waste of time.

Hey, now in the yearend crunch. Then there's this exam in May I have to worry about. ;) Maybe after two years. :shake:

Klaymen
02-09-2004, 05:15 PM
Maybe we should have a tournament similar to the chess game? Give each person a couple of opponents and require two games to be played simultaneously against each opponent, one with each color. 1 point for a win, 1/2 point for a draw. After those four games are tallied, anyone making the cut (2 pts?) moves on.

That's assuming whatever is out there will work in a similar fashion to the chess website. Although I suppose it wouldn't be too hard to track the moves manually in an Excel spreadsheet.

All Clear
02-11-2004, 01:35 AM
I have played Connect 4 over instant messages many times (each person draws up a board or uses an Excel Spreadsheet, and the moves are just ims of the square the peg is now in (A2, for example). A game can also probably be finished in 10 or so minutes, after both players just determine when is the right time to go on the RF chatroom and play.... I'm not sure of the interest level of such a tournament, though- pm or post if you are interested, and if enough respond, I'll set one up.