Code Monkey home page Code Monkey logo

connect-4's Introduction

ga_cog_large_red_rgb

Connect 4

connect4

Connect 4 is a game where players attempt to make a line of four pieces in a 7 x 6 grid. Players can drop their pieces into columns, so that their piece rests in the lowest available space in that column.

The winner is the first to create a line of four in any direction, including diagonally. If the board is filled before a line of 4 can be made, the game is declared a draw.

Resources

Game instructions

Technical Flow

  • Players must provide their names before the game can start through the modal box. If both names aren't provided when the 'start playing' button is clicked, an alert will pop up.
  • The first player will start the game.
  • Players can't pick a disk if the disk below hasn't been selected yet unless it's the first row. It will only move to the next player once the disk selected is valide.
  • On each click, the function to check the score is called. It will check if there are 4 consecutive occurences of the current player's disk within the row, column and diagonal range of the selected disk.
  • If the score is 4, the current player wins and a model box displaying the name of the winner will pop up.
  • Players can choose to continue playing and resetting the game.
  • The game can be reset at any point.

Source Code: https://github.com/emilieallen/connect-4

Improvements

  • Prettier CSS and responsive layout.
  • Add the option to play against the computer.

connect-4's People

Contributors

emilieallen avatar

Watchers

 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.