Chess/ChessPiece.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FourWayClimbingDemo.Chess
{
    /// <summary>
    /// 棋子
    /// </summary>
    public class ChessPiece
    {
        private int _row = -1;  //棋子在棋盘行坐标 0-3  其他值为无效棋子
        private int _col = -1;  //棋子在棋盘的列坐标 0-3  其他值为无效棋子
        private string _tag = ""; //棋子标记

        public ChessPiece(int row,int col,string tag) {
            this._row = row;
            this._col = col;
            this._tag = tag;
        }

        public string Tag
        {
            get { return _tag; }
            set { _tag = value; }  
        }

        /// <summary>
        /// 获取在棋盘的坐标位置
        /// </summary>
        public (int row, int col) GetPosition() {
            return (_row,_col);        
        }

        /// <summary>
        /// 判断该坐标位置是否是自己
        /// </summary>
        public Boolean IsMine(int row,int col) {
            return row == _row && col == _col;
        }

        /// <summary>
        /// 移动位置
        /// </summary>
        public void Move(int row,int col) {
            this._row = row;
            this._col = col;
        }

        /// <summary>
        /// 棋子被吃掉
        /// </summary>
        public void Dead() {
            this._row = -1;
            this._col = -1;
        }

        /// <summary>
后面还有 8 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。