⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chessrules.java

📁 网络象棋对战程序,模拟vista的国际象棋功能,可以自动寻找路径,棋子随同鼠标移动.另有网络聊天功能. ps:里面用的登陆服务器地址,需要稍做修改,修改成你想登陆的服务器. 开发工具eclipse
💻 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 + -