public ChessRecord GetChessRecord(ChessPiece selectPiece, PiecePoint targetPoint) { var targetPieceInfo = GetPieceInfo(targetPoint); var targetPiece = new ChessPiece(targetPoint, targetPieceInfo); var chessRecord = new ChessRecord(selectPiece, targetPiece); return(chessRecord); }
public bool MovePieceIsOK(ChessRecord record, PieceColor currentColor) { MovePiece(record); bool isChecked = IsChecked(currentColor); RegretPiece(record); return(!isChecked); }
public static int GetValueOfRecord(ChessRecord record) { var selectPiece = record.SelectPiece; var selectPieceInfo = selectPiece.PieceInfo; var selectPieceColor = selectPiece.PieceColor; var targetPiece = record.TargetPiece; var targetPiecePoint = targetPiece.PiecePoint; var targetPieceType = targetPiece.PieceType; var targetPieceColor = targetPiece.PieceColor; var newSelectPiece = new ChessPiece(targetPiecePoint, selectPieceInfo); var locValue = GetValueOfPiece(newSelectPiece) - GetValueOfPiece(selectPiece); var eatValue = targetPieceType != PieceType.Blank && selectPieceColor != targetPieceColor?GetValueOfPiece(targetPiece) : 0; return(locValue + eatValue); }
public void RegretPiece(ChessRecord record) { RegretPiece(record.SelectPiece, record.TargetPiece); }
public void MovePiece(ChessRecord record) { MovePiece(record.SelectPiece, record.TargetPiece); }