Giter Club home page Giter Club logo

connect4js's Introduction

Connect4.js

This is a JavaScript implementation of a Connect 4 Algorithm based on the original work of Keith Pomakis in C. This project was a way for me to do some exploring that I've wanted to do for sometime now. First, I wanted to learn more about game development (zero-sum, minimax, alpha-beta pruning). Second, I wanted to explore Web Workers and see how the modern browsers handle a game AI like Connect 4 written entirely in JavaScript.

Files

There are 3 main files that make up the game.

  • Connect4.js - This is the primary file that you would include in your HTML and provides the public API.
  • Connect4Game.js - This is the game AI/logic and is only used via the Web Worker.
  • Connect4Worker.js - This is the definition of the Web Worker and it imports the Connect4Game.js file.

Demo

The game.html and game.js provide an example of how to use the Connect4.js game. Just open game.html in a modern browser that supports Web Workers and open the console. The compute will play against itself. Just reload to restart the game. I also have the demo up and running on my own site here: http://brandonaaron.net/code/connect4js/demos

API/Docs

The API is super simple and uses a pubsub strategy to deal with the asynchronous behavior of Web Workers. Although the documentation isn't great there is inline documentation in the JSDoc-Toolkit format.

License

This work is Copyright 2010 Brandon Aaron and licensed under the MIT license (LICENSE.txt).

Original Algorithm

I've very happy that Keith Pomakis put his work out in Public Domain for others to learn and build upon. I've included his original C implementation and released my port under MIT with his permission. You can find the original work that I used in the folder named 'originalAlgorithm'.

connect4js's People

Watchers

James Cloos avatar

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.