Public feed #726960

Someone

public text v1 · immutable
Raw Edit
·published 2007-10-05 17:13 UTC
rendered paste body
package classe;

public class Field {
	public boolean[][] Current = new boolean[100][100];
	public boolean[][] Attack = new boolean[100][100];

	public Field(){
		for(int ctr=0;ctr<=9;ctr++){
			for (int ctr2=0;ctr<=9;ctr2++){
				Current[ctr][ctr2]=false;
				Attack [ctr][ctr2]=false;
			}
		}
	}
	public void inputShipField2(int x1, int y1, int x2, int y2){
		this.Current[x1][y1]=true;
		this.Current[x2][y2]=true;
	}
	public void inputShipField3(int x1, int y1, int x2, int y2, int x3, int y3){
		this.Current[x1][y1]=true;
		this.Current[x2][y2]=true;
		this.Current[x3][y3]=true;
	}
	public void inputShipField4(int x1, int y1, int x2, int y2, int x3, int y3,int x4, int y4){
		this.Current[x1][y1]=true;
		this.Current[x2][y2]=true;
		this.Current[x3][y3]=true;
		this.Current[x4][y4]=true;
	}
	public void inputShipField5(int x1, int y1, int x2, int y2, int x3, int y3,int x4, int y4, int x5, int y5){
		this.Current[x1][y1]=true;
		this.Current[x2][y2]=true;
		this.Current[x3][y3]=true;
		this.Current[x4][y4]=true;
		this.Current[x5][y5]=true;
	}
	public String toString(){
		String TempReturn="";
		for(int ctr=0;ctr<=9;ctr++){
			for (int ctr2=0;ctr<=9;ctr2++){
				TempReturn += ctr+","+ctr2+" : "+Current[ctr][ctr2]+"\n";
			}
		}
		return TempReturn;
	}
}