Hey Im sure everyone is familiar with the game connect four right? Well I am trying to make it in Java right now but I am stuck right now. Can anyone help me with this?
Here is the question straight from the book:
Connect four is a two player board game in which the players alternately drop colored disks into a seven column, six row vertically suspended grid. The objective of the game is to connect four same colored disks in a row, a column, or a diagonal before your opponent can do likewise. The program prompts two players to drop a red or yellow disk alternately. Whenever a disk is dropped, the program redisplays the board on the console and determines the status of the game (win, draw, or continue).
import java.util.Scanner;
public class ConnectFour
{
public static void main(String[] args)
{
int[][] board = new int[6][7];
int i = 0;
int j = 0;
board[i][j] = ' ';
board[i][j] = 'R';
board[i][j] = 'Y';
}
public static void printboard()
{
// Create Scanner
Scanner input = new Scanner(System.in);
// Create the board
int[][] board = new int[6][7];
for (int i = 0; i < 6; i++)
{
System.out.print("|");
for (int j = 0; j < 7; j++)
{
board[i][j] = input.nextInt();
System.out.print("|");
}
}
}
}
This cant be a gui, it has to only be in the java eclipse program.