import java.io.*;



public class battleship
{
    public static void main (String args [])
    {
	square ocean [] [] = new square [5] [8]; 
	/* ocean will hold values something like this:
	    * * * * * D * S
	    * C C C * D * S
	    C * * * * D * *
	    C * * S * D * *
	    C * * S * * S S
	 */
	int sizex = 5;
	int sizey = 8;
	
	initializeocean (ocean, sizex, sizey);
	printocean (ocean, sizex, sizey);

    }


    public static void initializeocean (square ocean [] [], int sizex, int sizey)
    { //Pre: Ocean is sizex X sizey in dimensions, it has not be constructed
	//Post: All elements of ocean are not visible and have no ships (*) in them
	for (int i = 0 ; i < sizex ; i++)
	{
	    for (int j = 0 ; j < sizey ; j++)
	    {
		ocean [i] [j] = new square ();
		ocean [i] [j].inhere = "*";
		ocean [i] [j].visible = false;
	    }
	}
    }


    public static void printocean (square ocean [] [], int sizex, int sizey)
    { //Pre: Ocean has values and is sizex X sizey in dimensions
	//Post: The ocean and the ships that have been found are printed to the screen
	System.out.println ("--- The Ocean ---");
	System.out.println ();
	for (int i = 0 ; i < sizex ; i++)
	{
	    System.out.print ("    ");
	    for (int j = 0 ; j < sizey ; j++)
	    {
		if (ocean [i] [j].visible == false)
		    System.out.print ("~");
		else
		    System.out.print (ocean [i] [j].inhere);
	    }
	    System.out.println ();
	}
    }
}
public class square
{
    public String inhere;
    /* Note - possible values of inhere are:
	* = nothing is in that square
	S = submarine is in that square
	C = cruiser is in that square
	D = destroyer is in that square
    */
    public boolean visible;
    /* If the user has guessed that square, it becomes visible
       This means the value 'inhere' will be printed to the screen
    */
}


