Connect Four

Here’s the first robot I built using the VEX IQ. (but not my first robot) It plays Connect Four. I’m not totally happy with it, so I’ll be rebuilding parts, but right now it works pretty well.

This is VERY cool. Does it have a “perfect” play algorithm?


I want to echo John’s sentiment. I shared this youtube link via my personal facebook account this am. In addition to John’s question I’m curious about basic specs, build/programming time, number of sensors and their placement (all while understanding you’re still optimizing the design). Again, awesome work and thank you.


I guess I should make up a web page.

First, Connect 4 has been “solved”, meaning the player who plays first CAN win every time, if they play a perfect game. (that may not be news to you). I have the robot set so it will normally play second, giving the player the best chance to win. The robot does NOT play “perfect”. It only checks 4 moves ahead (two for itself, and two for its opponent, or about 2000 moves). I can adjust how far it looks ahead, but 4 is a sweet-spot.

The logic is the same as two LEGO versions I made:

“Stick” has been to many public displays. During a weekend, it will normally play about 100 games, and win at least 97%. I would like for this robot to record stats, if I can write data to stay in memory (flash?). Hopefully, the firmware will get there.

I’m not really sure about the time it took to convert the program from BrickOS (for LEGO) to RobotC (for VEX).

Build time (so far) has been about 2 weeks. There’s not much to it, but the hardest part was making the black chip tower, because it has to fit over the tram’s chip-dropping motor. I’m not too happy with either chip tower, so they will be rebuilt. The black chips actually fall in the middle of a plate, and when they are pushed off, sometimes get caught on the lip and get shot out.

It uses 4 motors, one for each chip-tower, one to run the conveyor belt for the tram, and one on the tram to drop chips. With more building practice, I may build the towers so the tram movement causes the chips to eject, instead of requiring a motor on each tower.

The only sensors it uses (beyond the rotation sensors in the motors) are the three LED sensors it uses for players to select the column, and drop chips. I really like being able to show different colors on the buttons.

A couple things that make this different from my LEGO robots, the robot actually drops ALL chips into the board, so it doesn’t need to scan the board to find where a human may have played. That also makes it so two people can play against each other, or against the robot.

Now, my problem is that I won’t want to totally dismantle this robot. So, it’s the only robot I’ll ever make. :slight_smile:


I love C4, and at one time was able to play perfectly (it was a fun trick to use on hapless robotics students). It is very cool to have an almost unbeatable VEX IQ robot – same effect for the robotics students. :slight_smile:


I think C4 is a great “STEM” type of game. There’s a great deal of Math that can be shared through it.