📄 empresses.java~1~
字号:
package empress;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Empresses {
int x,y;
MapPage mp;
int number;
Hasilica has;
public Empresses(int number,MapPage mp,Hasilica has,int n)
{
this.x = number;
this.y = -1;
this.mp = mp;
this.number = n;
this.has = has;
}
public boolean adjust()//find the position of the current Empress
{
boolean flag = false;
y++;
while(y < number && (flag == false))
{
if(isInSameRow(x,y) || isDiagonal(x,y))
{
y++;
/*int l = 0, m = 0,n = 0,k = 0;
while(l < 10000000)
{
while(m < 10000000)
{
while(n < 1000000000)
{
while(k < 1000000000)
{
k++;
}
n++;
}
m++;
}
l++;
}*/
has.welcome(x,y);
}
else
{
flag = true;
mp.setMapPage(x,y);
}
}
return flag;
}
public boolean isInSameRow(int curX,int curY)//dicide wether in the same row
{
boolean flag = false;
if(curX != 0)
{
for(int i = 0; i < curX; i++)
{
if(mp.mapPage[1][i] == curY)
{
flag = true;
}
}
}
return flag;
}
public boolean isDiagonal(int curX,int curY)//decide wether in the same diagonal line
{
boolean flag = false;
int xx,yy;
if(curX != 0)
{
for(int i = 0; i < curX; i++)
{
yy = mp.mapPage[1][i] - curY;
xx = curX - mp.mapPage[0][i];
if(((xx-yy)*(xx+yy))==0)// tow case would be think over
{
flag = true;
}
}
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -