Class TwoDArraysMain
Object
TwoDArraysMain
The driver class for this app.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static int[][]Our Connect4 board, which has 6 rows and 7 columns. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidgameLoop()Method that contains a loop to run until victory is achieved or until a player desires to exit the game.static voidThe main function to begin program execution.static booleanplayerChoice(int player, Scanner scnr, int[][] board, TwoDArraysUtility util) This method is where the player chooses the column to play their piece in, it also checks that the input it 1-7 and if input is 0, the game is exited.static voidThis method prints the entire board 2D Array and some additional lines below for added readability.static voidsetBoard()This method sets the entire board to 0 values.
-
Field Details
-
board
static int[][] boardOur Connect4 board, which has 6 rows and 7 columns.
-
-
Constructor Details
-
TwoDArraysMain
public TwoDArraysMain()
-
-
Method Details
-
main
The main function to begin program execution.- Parameters:
args-
-
gameLoop
public static void gameLoop()Method that contains a loop to run until victory is achieved or until a player desires to exit the game. -
setBoard
public static void setBoard()This method sets the entire board to 0 values. -
printBoard
public static void printBoard()This method prints the entire board 2D Array and some additional lines below for added readability. -
playerChoice
This method is where the player chooses the column to play their piece in, it also checks that the input it 1-7 and if input is 0, the game is exited.- Parameters:
player-scnr-board-util-- Returns:
-