Git Product home page Git Product logo

connect4-cli's Introduction

connect4-cli

Play the popular Connect 4 game directly from your command line!

Two people are required to play.

Demo

What is Connect 4?

According to Wikipedia, Connect Four is a two-player connection board game, in which the players choose a color and then take turns dropping colored tokens into a seven-column, six-row vertically suspended grid.

The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own tokens.

Installation Instructions

Nothing. Just download the release and execute the binary to start playing!

Compilation Instructions

Download the source code and go into the directory with the main.cpp file. Execute the following command for Windows:

g++ -std=c++17 main.cpp include\Connect4Board.h src\connect4Board.cpp include\Player.h include\Player.cpp -o bin\Release\connect4-cli-v0.1.exe -O3 -NDEBUG -s

or for Linux:

g++ -std=c++17 main.cpp include/Connect4Board.h src/connect4Board.cpp include/Player.h include/Player.cpp -o bin/Release/connect4-cli-v0.1.exe -O3 -NDEBUG -s

to get compile the release binary. Then simply execute it (located at bin/Release) to start playing.

For a debug build just remove the compilation flags at the end of the flag.


Another way to compile would be build using Code::Blocks.

Building with Visual Studio C++ is not recommended, because of a macro collision error.

Gameplay Instructions

The prompt at the bottom left shows which players turn it is. The corresponding player can enter the column number (from 1 to 7) in which they desire to place their coin.

Future Update Plans

This project, though completely playable, is still not over. I still have plans to:

  • Implement player names
  • Implement custom player symbol selection
  • Implement a separate function to handle the entire game loop
  • Fix certain stray implicit type conversions
  • Tidy up the code
  • Add more accurate and meaningful comments

Stay tuned!

connect4-cli's People

Contributors

shahank42 avatar

Stargazers

 avatar  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.