All pastes #289310 Raw Edit

Anonymous

public java v1 · immutable
#289310 ·published 2006-12-23 01:23 UTC
rendered paste body
/* * Battleship.java * * Version: *      $Id: Battleship.java,v 1.0 2006/12/19 23:59:45 jkg5328 Exp jkg5328 $ * Revisions: *    $Log *//** * The main program for 1 player Battleship game. * * @author    John Green */import java.util.Scanner;public class Battleship {    public static void main(String[] args){        Scanner stdin = new Scanner(System.in);    int testint;    String inputString = "";/** * Checks the command line arguments for board size in between 5-26 * and that an input file is specified. * */     if (args.length != 2){        System.err.println("Usage: java Battleship N config-file");        System.exit(0);        }        try {         testint = Integer.parseInt(args[0]);         } catch (NumberFormatException nfe) {            System.err.println("Usage: java Battleship N config-file");            System.exit(0);        }                testint = Integer.parseInt(args[0]);        if(testint < 5){            System.err.println("Board must be at least 5 by 5.");            System.exit(0);        }        testint = Integer.parseInt(args[0]);        if(testint > 26){            System.err.println("Board must be at most 26 by 26.");            System.exit(0);        }/** * While loop that takes in command input.  *  */            System.out.println("<grid goes here lol>");                while(!inputString.equals("quit")){            System.out.print("> ");            inputString = stdin.nextLine();            inputString.toLowerCase();            inputString.trim();            if(inputString.equals("board")){                //board().Print;                System.out.println("board here lol");            }        }    }}