Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This part of the homework relates to the Connect-4 code posted on the website. The general purpose of Connect-4 is to be the first person

This part of the homework relates to the Connect-4 code posted on the website. The general purpose of Connect-4 is to be the first person to get 4-in-a-row. This game has historically been played where you slid chips into columns, so the play is always the lowest available row in the column. See this for more details if you are unfamiliar with the rules:

https://en.wikipedia.org/wiki/Connect_Four

The code is complete, except for the fourInARow() function. This function is supposed to check and see if there are four consecutive tiles/pieces in the direction(s) indicated. Without this code, players cannot win (but a tie is possible if you fill up the board). Complete this function to correctly detect if there is four in a row at the indicated spot in the game.

You should not add any couts in your final submission. You may add temporary couts to help debug, but please ensure these are all removed when you do the final submission.

Example 1 (type in 1 2 1 2 1 2 1 ):

.......

.......

X......

XO.....

XO.....

XO.....

1234567

The mighty Xs reign supreme!

Example 2 (type in 2 1 3 2 3 3 4 4 4 4):

.......

.......

...O...

..OX...

.OXO...

OXXX...

1234567

The Os have completed world domination!

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

13. Under what conditions is the MantelHaenszel test appropriate?

Answered: 1 week ago

Question

What are the classifications of Bank?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago