Question
B: Connect Four (20 points) This part of the homework relates to the Connect-4 code posted on the website. The general purpose of Connect-4 is
B: Connect Four (20 points) 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started