Git Product home page Git Product logo

connect4's Introduction

Connect4

Ruby program to go through all possible connect 4 board combinations. According to wikipedia, there are over 4.5 trillion possible board combinations. AFAIK, this includes incomplete combinations (ones in which no one has won and it is not a draw).

This Program is intended to find all of them and evaluate whether it is a Player1 win a Player2 win or a draw. Unfortunately, running this can take several days to complete due to the large number of boards to find.

Connect6.rb

This is a recursive program that goes back and forth calling Player1 and Player2 until an endstate is reached. An endstate is either when the whole board has been filled (@options is empty) or a Player has achieved 4 in a row.

Connect7.rb

Essentially the same as Connect6, but making use of Ruby Threads.

Each of the seven Threads makes one of the 7 first moves by Player1 and then continues recursing. Not the most efficient use of threads, but offers large improvements over Conncet6 if using an interpreter supporting tru OS level threading and doesnt suffer from GIL (Jruby)

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.