Be the first to rate this file! 35 Downloads (last 30 days) File Size: 2.72 KB File ID: #34908

Connect 4 - A Game

by Humayun Kathuria

 

03 Feb 2012

Good game for wasting one’s time. A very basic piece of code.

| Watch this File

File Information
Description

The game-store version of this game consists of a plastic rack with six horizontal rows and seven vertical columns. Each player has a number of “checkers”-type playing pieces. One player’s pieces are red; the other’s are black. The two players take turns putting a playing piece into a vertical column of their choice. The piece falls down that column under gravity until it stops against the bottom or against another piece. In this way the columns start to fill up. The object is to be the first player to connect four of her pieces. The four pieces may be lined up horizontally, vertically, or diagonally. When more than one game is played, players alternate taking the first turn.
For the computer game, we use matrix with six rows and seven columns displayed on the screen. The human player selects a column in which to place a piece. The computer program is responsible for updating the locations of the pieces. Programming the game display is not too time consuming, but programming a winning strategy is challenging.

Required Products MATLAB
MATLAB release MATLAB 7.10 (R2010a)
Other requirements MS Windows
Tags for This File  
Everyone's Tags
game, matrix
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.

Contact us