Shantao Cao

Resume LinkedIn Github

Project Title & GitHub Link

Connect 4 Master Robot

Technologies

Python, AI (Alpha–beta Pruning), Mechatronics, Manipulation, Arduino

Project

Intro


This project, part of MECH_ENG 395: Industry 4.0 Manufacturing, introduces the Connect 4 Master Robot. Our innovation merges robotics and gaming, presenting a system capable of engaging in Connect 4 matches with human players. Beyond its gaming prowess, this robot boasts the potential to serve as a remote intermediary for players physically distant from each other, providing a live visual interface for an immersive, shared Connect 4 experience, transcending geographical boundaries.


Robot and control


In this project, we employed a LewanSoul xArm as the physical computer player. This robot is operated using an Arduino board, which not only controls the robot but also detects the coins dropped by the human player onto the Connect 4 gaming board. To accomplish this, we utilized IR break sensors to accurately detect every coin drop through the top row of the borad.


During operation, the robot waits for the player to place the first coin. Using IR sensors, it detects the column where the coin is inserted, sending this data to the connected computer. The computer mirrors the game board and computes the optimal move. Once determined, the next action is relayed to the Arduino, which commands the robot to execute the move. The robot collects a coin from the feeder, drops it into the designated column on the playing board, and awaits the human player's next move. This sequence repeats until one side achieves victory.


Game Solver


In the realm of artificial intelligence and game theory, devising an effective Connect 4 solver necessitates strategic algorithms capable of exploring the vast decision space inherent to the game. One such approach that showcases remarkable efficiency is the implementation of the Alpha-Beta Pruning algorithm. Alpha-Beta Pruning is a sophisticated search algorithm used in adversarial games like Connect 4, where two players take turns making moves with conflicting objectives.


The Alpha-Beta Pruning algorithm minimizes the number of nodes evaluated in the search tree, significantly reducing computational complexity. This is achieved by intelligently discarding branches of the search tree that are guaranteed to be irrelevant for the final decision. In the context of Connect 4, where the potential move possibilities escalate rapidly, Alpha-Beta Pruning proves invaluable in focusing the computational resources on the most promising paths, facilitating quicker and more effective decision-making.</p>


The solver leverages a heuristic evaluation function to assess the desirability of various game states, enabling the algorithm to make informed decisions about the optimal moves. By employing Alpha-Beta Pruning, the Connect 4 solver efficiently navigates the decision space, balancing computational resources and strategic decision-making to provide a robust and effective solution to this classic game.</p> </p>

AB_Pruning_example

An illustration of alpha–beta pruning.

Github


More information and source code can be found on the project'sGitHub repository.