close

Connect 4 in C++

 Connect some in C Essay

Training course Title…FD COMPUTING 1ST YR

Module Code…CO1451.

Module Title… Programming in C++

Component Tutor Harvey Long

Assignment Title/Number……No. 1…

……………………………

Pupil Name……Stephen Allen

Student IDENTITY No… All09109979

I confirm that this piece of work which I include submitted is my own work and that all references and quotations by both principal and secondary sources have already been fully discovered and correctly acknowledged in footnotes and bibliography.

Signature of student......... ste allen..............................................................

Introduction

The overall game of connect 4 consists of two players that consider alternate converts to drop surfaces into a grid. There are two styles of counter-top so that each player has their own. The grid is actually a 7 simply by 7 table making a total of forty-nine elements. The item of the video game is for the first person to make a straight line of 5 matching desks in any direction. The game is usually played by players picking which line to drop all their counter which counter falling to the least expensive empty row in that steering column. As more turns happen to be taken, even more opportunities happen where lines of 4 matching desks can be attained in horizontally, vertical and diagonal directions. The game goes on with each player seeking to match a line of 4 of their own surfaces whilst at the same time sabotaging any matching lines of their challenger. If not any matches are located throughout the video game then the video game ends following 49 transforms have been taken and all the elements and so are. Design

After running the desired program the users would be given a menu offering several options. These types of options can translate into a switch: circumstance: break function within the plan and the common menu will be: - Case1: (option 1) Play Hook up 4

Case2: (option 2) Perspective League Stand

Case3: (option 3) Quit

Key in option number and press enter!

Upon picking case1 users will be asked to enter player1 and player2 brands. A grid with eight rows and seven columns will be displayed. The potager in the main grid will most start off empty. Underneath the grid the teaching for whose turn it is definitely will inquire that player to choose a column to put their countertop in. They will be informed of what symbol is definitely their counter-top. A tally will be understood to be equal to actually zero before in every set of four squares are checked. The players is going to place different counters into the grid along with 7 counter tops have been positioned the computer will start to check the entire grid for the matching type of 4 identical counters in horizontal, vertical and diagonal directions, following each future turn. The pc makes the bank checks by comparing adjacent potager and increasing the tally by 1 each time they will match. Pertaining to the horizontally check the initial 4 nearby squares will probably be compared as well as the x co-ordinate will increase by simply 1 each time the verify has been produced. This only needs to be done for the first 3 x co-ordinates of each row as following the forth x co-ordinate you will find not enough pieces to make a four counter match. The straight check increases the sumado a co-ordinate simply by 1 following each check and do and so for the first three squares of each column. The diagonal inspections will have mixtures of increase/decrease x & y co-ordinates after every check. If the grid is full of counters and 49 turns have been taken and no lines of 4 matching surfaces have been found the computer will display " DRAW” and the case will break back to the options menu. The leaderboard score table will probably be automatically up-to-date after every single game ends. This will be performed by usage of the fstream command and opening a pre-saved textual content file which can be edited to record players/games played/games won If case2 is picked then the text file will be opened within a read just fashion and displayed intended for the users The program will be left if case3 is selected.

The main matter in creating this program is definitely creating a gameplay area and defining every single square in order that it can be assigned values which can be...

 Socrates Dissertation

Socrates Dissertation

Kelsey Nagy Philosophy 101 Costs Haley 28 Mar 2014 Socrates Socrates believed that philosophy prepares the heart and soul for the separation…...

Read
 Life Essay

Life Essay

Danya Abusoud The english language 122 Sign Project doze May 2012 Once Upon a House I remember my childhood as though were recently;…...

Read