getEatList method
获取能吃的子的列表
Implementation
List<ChessItem> getEatList(ChessPos pos) {
List<String> moves = movePoints(pos);
List<ChessItem> items = [];
for (var move in moves) {
ChessPos toPos = ChessPos.fromCode(move);
String chr = fen[toPos.y][toPos.x];
if (chr != '0') {
items.add(ChessItem(chr, position: toPos));
}
}
items.sort(
(a, b) => chessWeight[b.code.toLowerCase()]!
.compareTo(chessWeight[a.code.toLowerCase()]!),
);
return items;
}