Question: MATLAB Help: Connect- 4 is a 2-player game in which players take turns dropping their colored discs from the top into a 7 column, 6

MATLAB Help:

Connect- 4 is a 2-player game in which players take turns dropping their colored discs from the top into a 7 column, 6 row vertically suspended grid board. The pieces fall straight down, occupying the next available space in the column. The purpose of the game is t connect four of one's own discs of the same color next to each other, either vertically, horizontally, or diagonally before one's opponent can do so.

Write a MATLAB program to creare a preliminary program so that you can play Connect 4 with the computer. No artificial intelligence is required, nor winner is called.

Specifications:

1. The computer wil lalways start the game

2. There is no need to test for a win. If there is a winning situation, we will ignore it and keep playing until the grid is filled.

3. No artificial intelligence is required, meaning the computer randomly picks a column to drop the disc.

4. Instead of colored discs, use numbers 1 (Computer) and 2 (Your disc).

5. Initially, the grid will be filled with all zeros.

6. Players only pick a column and let the disc fall down to the lowest available location (Error check for user input!)

7. If a column is filled up, let the player choose another one, until a non-filled column is selected.

8. the grid should be displayed in the beginning of the game and after every time a disc is dropped.

Sample Screen:

-----

COmputer drops its discs:

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 1 0 0 0 0

Your turn. Enter a column Number(1-7): 4

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 0 0 0 0 0

0 0 1 2 0 0 0

-----

Thank you for the help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!