Connect 4 in C++
Module Code…CO1451.
Module Title… Programming in C++
Module Tutor Harvey Long
Assignment Title/Number……No.1…
……………………………
Student Name……Stephen Allen
Student ID No… All09109979
I confirm that this piece of work which I have submitted is all my own work and that all references and quotations from both primary and secondary sources have been fully identified and properly acknowledged in footnotes and bibliography.
Signature of student.........ste allen..............................................................
Introduction
The game of connect 4 consists of two players that take alternate turns to drop counters into a grid. There are two styles of counter so that …show more content…
fstream outfile //league table data
Also not yet covered in this design stage is the use of outfile.open(“test.txt”,ios::out); to create or update the league tables or outfile.open(“test.txt”,ios::in); to view the league table or outfile.open(“test.txt”,ios::app); to add new players to the league tables.
Connect 4 Algorithm
The algorithm for the actual gameplay I have designed is as follows: Play game
Reapeat until WINNER is found or moves taken = 49
Player1 enter name= nameA
Player2 enter name= nameB nameA chooses column= choiceA choiceA= 1st available empty element in that column
1st available element= choice[row][column] choice[row][column]= “nameA counter” moves taken = moves taken + 1 if moves taken >8 then check for line of 4