📄 chessrules.java
字号:
package server;
public class ChessRules
{
public ChessRules()
{
System.out.println("ChessRules");
}
//Judge whether the movement of the chess is legal
public static boolean isLegal(int Chessman, int Row, int Line, int Row2, int Line2)
{
AvailablePlace teap = new AvailablePlace(Chessman,ChessBoard.moment);
java.util.Vector<java.awt.Point> temp = ChessBoard.theap;
if(ChessBoard.theap == null)
{
System.err.println("isLegal(): theap == null");
System.out.println("isLegal(): available place are");
for(int i = 0; i < temp.size(); i++)
{
System.out.println("("+temp.get(i)+" , "+temp.get(i)+")");
}
System.out.println("isLegal(): tempap");
for(int i = 0; i < (teap.ap).size(); i++)
{
System.out.println("("+temp.get(i)+" , "+temp.get(i)+")");
}
return false;
}
System.out.println("isLegal(): available place are");
for(int i = 0; i < temp.size(); i++)
{
System.out.println("chess["+Chessman+"]"+ChessBoard.chess[Chessman].name+temp.get(i));
}
for(int i = 0; i < temp.size(); i++ )
{
//System.out.println("def point ("+temp.get(i).x+" , "+temp.get(i).y+")");
if(temp.get(i).x == Row2 && temp.get(i).y == Line2)
return true;
}
return false;
}//isLegal()
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -