Soldato
- Joined
- 4 Mar 2006
- Posts
- 3,712
- Location
- Wales
Hi,
I have to code a connect 4 game in c++. The game should be played on a 7x6 (7 across 6 up) grid, which should be stored as a 2D array.
This is being done as a console application (in DOS box basically), so windows programming is unneccessary. The pieces can be displayed as different letters, eg. R and B.
I also need to program AI to play against. The AI must be able to make smart decisions, such as blocking pieces, and attempting to win etc.
I don't need to include diagonals in the winning criteria, however if I do there is the potential for very large bonus marks.
If anyone could give me advice on what I need to look at using, perhaps a bit of help on the AI etc it would be extremely useful
It's just I've sat here for 2 hours and all I've managed to do is initialised the array as follows.
As you see, not much for 2 hours
I have to code a connect 4 game in c++. The game should be played on a 7x6 (7 across 6 up) grid, which should be stored as a 2D array.
This is being done as a console application (in DOS box basically), so windows programming is unneccessary. The pieces can be displayed as different letters, eg. R and B.
I also need to program AI to play against. The AI must be able to make smart decisions, such as blocking pieces, and attempting to win etc.
I don't need to include diagonals in the winning criteria, however if I do there is the potential for very large bonus marks.
If anyone could give me advice on what I need to look at using, perhaps a bit of help on the AI etc it would be extremely useful

Code:
#include "stdafx.h"
#include <iostream.h>
int main(int argc, char* argv[])
{
int gridWidth = 7 ; int gridHeight = 6 ;
int gridArray[gridWidth][gridHeight] ;
for (i = 0 ; i < gridHeight ; i++)
{
for (j = 0 ; j < gridWidth ; j++)
gridArray[i][j] = 0 ;
}
return 0;
}
As you see, not much for 2 hours
