Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

2. You seem to feel frustrated when Lee doesnt do his homework.

Answered: 1 week ago