?? main.java
字號:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package marstraveler;import java.io.*; import java.util.*; /** * * @author Administrator */public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Traveler []Rob=new Traveler[4]; int line=-1; int Mx=0; //高原右上角x坐標 int My=0; //高原右上角y坐標 String dir=new String(); String s=new String(); try{ BufferedReader in=new BufferedReader(new FileReader("F:/a.txt")); while((s=in.readLine())!=null) { if(line==-1) { StringTokenizer t=new StringTokenizer(s," "); Mx=Integer.parseInt(t.nextToken()); My=Integer.parseInt(t.nextToken()); line++; } else { if(line%2==0) { System.out.println("第"+(line/2+1)+"號:"); Rob[line/2]=new Traveler(Mx,My); //初始line/2號探測器 dir=Rob[line/2].siteInitial(s); line++; } else { int k=0; k=Rob[(line-1)/2].moveSet(s, dir); if(k==0) //k==0時 探測器在移動時未超出范圍 { Rob[(line-1)/2].getInfor(); line++; } else{ line++; } } } } } catch(Exception e) { } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -