CS173: Intro to Computer Science - Four in a Row (3 pts)
Explorer
GitHub
Connect to GitHub to push and pull your project files to a repository.
On the page that opens, create a token with repo scope, copy it, then paste it below.
Paste the personal access token you created on GitHub with repo scope.
Click Refresh to load commit history
Exercise Info
Goals
To iterate over a 2-dimensional array
Instructions
Modify the FourInARow.java file to return whether a given array contains a winning configuration. Specifically, if any column has four consecutive items with the same value, they are a winner.
In this exercise, you will fill in a function to determine the winner of a game of Four-in-a-Row. A game board (a 2D array of ints) initially contains all 0s. Each player (team 1 and 2) places a value into a column of the game board, and it falls to the bottom of the board. The game ends with a winner if the board contains four consecutive items down a column (only the vertical column - you don’t need to worry about the rows or diagonals). For example, this board represents a game won by team 2: