Git Product home page Git Product logo

connect4's Introduction

Connect4

Monte Carlo Tree Search Based AI Connect 4 Bot

Getting Started

About the game

Connect 4 is a two-player game in which the players take turns dropping colored discs from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own discs.

It must be noted that this is a solved game (the first player can always win with right moves), the purpose of this project is mianly to implement the algorithm and test its performance in a simple game. We encourage users to find those right moves!

The algorithm

Monte Carlo Tree Search is a recently proposed search method that combines the precision of tree search with the generality of random sampling. It does not depend on heuristic function to evaluate the best next move to make, rather it just considers the game mechanics to play random rollouts and get an expected reward after a fixed number of iterations.

Here we attach some of papers as part of the literature revised for developing this project:

Running the game

Prerequisites

The code was written in Python 2.7. In order to display the game's GUI, we used Tkinter module, which is the standard Python interface to the Tk GUI toolkit. Although you don't need to download Tkinter since it is an integral part of all Python distributions. In any case, you can find more details about Tkinter installation here.

Run

git clone https://github.com/Alfo5123/Connect4.git
cd Connect4
python game.py

Have fun!

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Samuel Vidal, for suggesting this challenge.

connect4's People

Contributors

agalitsyna avatar alfo5123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

connect4's Issues

Computer never acknowledges defeat

I know this project is a hobby project but this is a major(ish) problem that seriously affects the playability of your implementation. I managed to beat your AI a few times (using a similar AI of my creation) but the program never concedes and keeps the game going even as my AI (with me as the proxy) achieved multiple four-in-a-rows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.