feat(chinese-chess): 实现中国象棋核心逻辑和基本功能

- 抽象出 ChessCore 类,包含游戏初始化、行棋逻辑、悔棋等功能
- 重构 Player 类,优化行棋和记录逻辑
- 更新 ChessBoard 和 ChessPiece 类,适应新逻辑
- 移除冗余代码,提高代码可读性和可维护性
This commit is contained in:
ZZY
2024-11-07 20:48:08 +08:00
parent 6daf09b300
commit 8ee9732a6f
9 changed files with 225 additions and 121 deletions

View File

@ -31,6 +31,10 @@ public class MoveRecords<T> {
records.AddLast(record); // 将新记录加入队尾
}
public int Count() {
return records.Count;
}
public void Undo() {
if (records.Count == 0) return;
MoveRecord record = records.Last.Value; // 移除并获取队首的记录以执行撤销操作