Question: Help with Java Gomoku program So I am trying to write a program that plays a basic Gomoku game. I am to the point where

Help with Java Gomoku program

Help with Java Gomoku program So I am trying to write aSo I am trying to write a program that plays a basic Gomoku game. I am to the point where I have printed the initial map and gotten player 1's first move. I've attached a screenshot of what I have so far and pasted the code below.

I am stuck though in figuring out how to alternate between player one and player two. I'd like it to ask the same questions, but say "Player 2's turn!" and put an O instead of an X for player 2.

I understand there will be more to it in order to finish it, but I'd just like to get this next step and understand it before moving on. Thanks!

import java.util.Scanner;

public class Gomoku { public static void main (String[] args) { Scanner input = new Scanner(System.in);

char[][] map = new char [19][19];

//fill game with dots for (int i = 0; i

printMap(map);

System.out.println("Player 1's turn!"); System.out.print("Enter row: "); int row = input.nextInt();

System.out.print("Enter column: "); int column = input.nextInt();

int place [][] = new int [row][column];

map[row][column] = 'X'; printMap (map);

}

public static void printMap (char[][] map) { for (int i = 0; i

}

Fle Edt Searrh Teals e Conf gure Window Hep ox inE 1-0 1ap.lengch: 1 Syazem.out print("Enter zoi1 in: ooluninput.next Inz ap.length:+) loal Gutpur Search Results -Tool Output! O lype here to search

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!