Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Connect Four is an absorbing and challenging game of vertical strategy thats easy to learn and fun to play. Rules are simple. Each player tries

Connect Four is an absorbing and challenging game of vertical strategy thats easy to learn and fun to play. Rules are simple. Each player tries to build a row of four playing pieces in the frame - horizontally, vertically, or diagonally - while trying to prevent his opponent from doing the same. In this assignment, you are required to implement the Pop Out variation of the game!

Pop Out starts the same as traditional gameplay, with an empty board and players alternating turns placing their own colored discs into the board. During each turn, a player can either add another disc from the top or, if one has any discs of his or her own color on the bottom row, remove (or "pop out") a disc of one's own color from the bottom. Popping a disc out from the bottom drops every disc above it down one space, changing their relationship with the rest of the board and changing the possibilities for a connection. The first player to connect four of their discs horizontally, vertically, or diagonally wins the game.

Game objective: Be the first player to get four of your checkers in a row horizontally, vertically or diagonally.

Game Rules:

  1. Randomly choose who plays first.

  2. Each player in their turn can either add another disc from the top or remove a disc of

    one's own color from the bottom.

  3. The players alternate until one of them gets four checkers of their symbol in a row.

    The four in a row can be horizontal, vertical, or diagonal.

  4. The first player to get four in a row win the game.

  5. If the board is filled and none of the players has four in a row, then the game is a tie.

Your task:

Implement the Connect 4 Pop Out game. Two players would play the game; you can find the game description: https://en.wikipedia.org/wiki/Connect_Four#Pop_Out. There should be no hard coding, the game should be easily expendable to more players and bigger dimensions (default: 6x7 board). We can also easily make Connect 10 Pop Out!

  • Print the board before every input o Dont forget to clear the screen before you print the board

  • Choose X and O instead of the black and red checkers

  • Ask the player to input the column on where they want to insert they checker

    o Check if this move is valid.

    o If the move is valid, check if this move will make the player win.

  • Alternate between the two users

  • Make sure you do error checking of the input.

  • No need to do the actual gravity of the checkers falling.

  • Use while/for loops, decision structure (if statements) and functions.

PYTHON ONLY

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Use (9.53) to estimate (1/r12) -1 for the ground-state He atom?

Answered: 1 week ago

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago