Hey can some one help me I'm trying to make my connect 4 game board and I want the tokens to drop down each row but I dont know how plaease help.
#include <stdio.h>
void main()
{
int i = 0; /* Loop counter */
int player = 0; /* Player number - 1 or 2 */
int go = 0; /* Square selection number for turn */
int row = 0; /* Row index for a square */
int column = 0; /* Column index for a square */
int line = 0; /* Row or column index in checking loop */
int winner = 0; /* The winning player */
char board[6][7] =
{ /* The board */
{'1','2','3','4','5','6','7'}, /* Initial values are reference numbers */
{'1','2','3','4','5','6','7'}, /* used to select a vacant square for */
{'1','2','3','4','5','6','7'}, /* a turn. */
{'1','2','3','4','5','6','7'},
{'1','2','3','4','5','6','7'},
{'1','2','3','4','5','6','7'},
};
/* The main game loop. The game continues for up to 42 turns */
/* As long as there is no winner */
for( i = 0; i<42 && winner==0; i++)
{
/* Display the board */
printf("\n\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[0][0], board[0][1], board[0][2], board[0][3], board[0][4], board[0][5], board[0][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[1][0], board[1][1], board[1][2], board[1][3], board[1][4], board[1][5], board[1][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[2][0], board[2][1], board[2][2], board[2][3], board[2][4], board[2][5], board[2][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[3][0], board[3][1], board[3][2], board[3][3], board[3][4], board[3][5], board[3][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[4][0], board[4][1], board[4][2], board[4][3], board[4][4], board[4][5], board[4][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[5][0], board[5][1], board[5][2], board[5][3], board[5][4], board[5][5], board[5][6]);
player = i%2 + 1; /* Select player */
/* Get valid player square selection */
do
{
printf("\nPlayer %d, please enter the number of the square "
"where you want to place your %c: ", player,(player==1)?'X':'O');
scanf("%d", &go);
row = --go/1; /* Get row index of square */
column = go%\1; /* Get column index of square */
}
while(go<0 || go>42 || board[row][column]>'7');
board[row][column] = (player == 1) ? 'X' : 'O'; /* Insert player symbol */
/* Check for a winning line - diagonals first */
if((board[5][0] == board[4][1] && board[5][0] == board[3][2] && board[5][0] == board[2][3]) ||
(board[5][1] == board[4][2] && board[5][1] == board[3][3] && board[5][1] == board[2][4]) ||
(board[5][2] == board[4][3] && board[5][2] == board[3][4] && board[5][2] == board[2][5]) ||
(board[5][3] == board[4][4] && board[5][3] == board[3][5] && board[5][3] == board[2][6]) ||
(board[5][3] == board[4][2] && board[5][3] == board[3][1] && board[5][3] == board[2][0]) ||
(board[5][4] == board[4][3] && board[5][4] == board[3][2] && board[5][4] == board[2][1]) ||
(board[5][5] == board[4][4] && board[5][5] == board[3][3] && board[5][5] == board[2][2]) ||
(board[5][6] == board[4][5] && board[5][6] == board[3][4] && board[5][6] == board[2][3]) ||
(board[4][0] == board[3][1] && board[4][0] == board[2][2] && board[4][0] == board[1][3]) ||
(board[4][1] == board[3][2] && board[4][1] == board[2][3] && board[4][1] == board[1][4]) ||
(board[4][2] == board[3][3] && board[4][2] == board[2][4] && board[4][2] == board[1][5]) ||
(board[4][3] == board[3][4] && board[4][3] == board[2][5] && board[4][3] == board[1][6]) ||
(board[4][3] == board[3][2] && board[4][3] == board[2][1] && board[4][3] == board[1][0]) ||
(board[4][4] == board[3][3] && board[4][4] == board[2][2] && board[4][4] == board[1][1]) ||
(board[4][5] == board[3][4] && board[4][5] == board[2][3] && board[4][5] == board[1][2]) ||
(board[4][6] == board[3][5] && board[4][6] == board[2][4] && board[4][6] == board[1][3]) ||
(board[3][0] == board[2][1] && board[3][0] == board[1][2] && board[3][0] == board[0][3]) ||
(board[3][1] == board[2][2] && board[3][1] == board[1][3] && board[3][1] == board[0][4]) ||
(board[3][2] == board[2][3] && board[3][2] == board[1][4] && board[3][2] == board[0][5]) ||
(board[3][3] == board[2][4] && board[3][3] == board[1][5] && board[3][3] == board[0][6]) ||
(board[3][3] == board[2][2] && board[3][3] == board[1][1] && board[3][3] == board[0][0]) ||
(board[3][4] == board[2][3] && board[3][4] == board[1][2] && board[3][4] == board[0][1]) ||
(board[3][5] == board[4][4] && board[3][5] == board[1][3] && board[3][5] == board[0][2]) ||
(board[3][6] == board[2][5] && board[3][6] == board[1][4] && board[3][6] == board[0][3]))
winner = player;
}
/* Game is over so display the final board */
printf("\n\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[0][0], board[0][1], board[0][2], board[0][3], board[0][4], board[0][5], board[0][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[1][0], board[1][1], board[1][2], board[1][3], board[1][4], board[1][5], board[1][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[2][0], board[2][1], board[2][2], board[2][3], board[2][4], board[2][5], board[2][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[3][0], board[3][1], board[3][2], board[3][3], board[3][4], board[3][5], board[3][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[4][0], board[4][1], board[4][2], board[4][3], board[4][4], board[4][5], board[4][6]);
printf("|---+---+---+---+---+---+---|\n");
printf("| %c | %c | %c | %c | %c | %c | %c |\n", board[5][0], board[5][1], board[5][2], board[5][3], board[5][4], board[5][5], board[5][6]);
/* Display result message */
if(winner == 0)
printf("\nHow boring, it is a draw\n");
else
printf("\nCongratulations, player %d, YOU ARE THE WINNER!\n", winner);
}