/***********************************/ /* Client.java */ /* argument */ /***********************************/ import java.io.*; class Client { public static void main(String a[]) throws IOException { String host = new String(""); //soccer server Name. int port = 6000; //default port number. String team = new String("Nippon"); //team name. try { for( int c = 0 ; c < a.length ; c += 2 ) { if( a[c].compareTo("-h") == 0 ) host = a[c+1]; else if( a[c].compareTo("-p") == 0 ) port = Integer.parseInt(a[c+1]); else if( a[c].compareTo("-t") == 0 ) team = a[c+1]; else throw new Exception(); } } catch(Exception e) { System.err.println(""); System.err.println("USAGE: [-parameter value]"); System.err.println(""); System.err.println(" Parameters value default"); System.err.println(" ------------------------------------"); System.err.println(" h host_name localhost"); System.err.println(" port port_number 6000"); System.err.println(" team team_name Nippon"); System.err.println(""); System.err.println(" Example:"); System.err.println(" agent -h ***.&&&.ac.jp -p 6000 -t Japan"); System.err.println(" or"); System.err.println(" agent -h 157.110.**.***"); return; } // creates an player agent. Player p = new Player(); p.connect(host, port, team); } }