Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

The Connect 4 Game 

The purpose of this assignment is to create a working text-mode version of the popular game, Connect 4.

Overview of the game

Connect 4 is a turn based 2 player game played on a 6 rows by 7 columns board. Each player on his turn chooses a column to put a piece at. A piece played in a column falls till it reaches the bottom of the column, or it gets stacked above another piece. The winner is the player who forms a line of 4 adjacent pieces of his color (horizontal, vertical or diagonal). 

Problem statement 

You are required to create a text mode version of the Connect 4 game. The text mode version displays the board using characters (for example „x‟ for one player, „o‟ for the other player, and a space for an empty slot).

Player vs. Player 

After choosing the type of game, the game starts. When it is a human‟s turn, the program asks the player for the column to play, and plays the piece for him at this location. If the column is full, or is invalid, the program warns the user about the error, and asks him again to re-enter the column to play. When the game is finished, the program displays the winner. If the board is full and no player win, the program displays “Withdraw” .

Hints:

  You can use two dimensions array .

code in c++



X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.