/**
 * BattleshipInterface.java
 *
 *
 * Caitlin Ross 
 * 
 * 100735219
 */

import java.util.*;

public class BattleshipInterface {
    
    private static String userName, opponentName;
    
    public static void main(String[] args) {
    	int i=0;
    	
    	startGame();
    	BattleshipGame game = new BattleshipGame(userName, opponentName);
        game.placeUserShips();
        //game.displayBoards();
        game.placeRandomShips(game.enemyNum());	//1 for the enemy
        //game.displayBoards();
        while(!game.hasPlayerWon(game.userNum()) && !game.hasPlayerWon(game.enemyNum())){
        	game.move(i);
        	i++;
        }
        game.displayBoards();
        System.out.print("Congratulations ");
        if (game.hasPlayerWon(game.userNum()))
        	System.out.print(userName + "! You Won!");
        else
        	System.out.print(opponentName + "! You Won!");
    }
    
    public static void startGame(){
    	//String userName, opponentName;
    	
        System.out.print("Welcome to Battleship!\n\nPlease enter your name: ");
        userName = new Scanner(System.in).nextLine();
        
        System.out.print(userName + ", please enter a name for your opponent (the computer): ");
        opponentName = new Scanner(System.in).nextLine();
        
        System.out.println('\n' + userName + ", now you must place your ships, in the form (row,column,direction)");
    }
    
}
