chessche.java

来自「ajax chessajax chessajax chessajax chess」· Java 代码 · 共 30 行

JAVA
30
字号
package chs;

import java.util.List;

public class ChessChe extends ChessItem {

	public ChessChe(ChessBoard b, String id, int x, int y) {
		super(b, id, x, y);

	}

	public boolean moveTo(int x, int y) {
		if (!isOnLine(x, y)) {
			System.err.println("not on a line:(" + this.x + "," + this.y
					+ ")->(" + x + "," + y + ")");
			return false;
		}

		// 中间有子
		List lst = b.findItemOnLine(this.getX(), this.getY(), x, y);
		if (lst != null && lst.size() > 0) {
			System.err.println("found :" + ((ChessItem) lst.get(0)).getId());
			return false;
		}

		return true;
	}

};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?