Chess/Player.cs

(开头部分) 3KB

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

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

namespace FourWayClimbingDemo.Chess
{
    /// <summary>
    /// 选手
    /// </summary>
    public abstract class Player
    {
        protected string _name;
        protected string _tag;
        private bool _isFirstPalyer;  //true为选手1,false为选手2
        protected bool _isAutoWantPlay = false;  //是否自动下棋

        protected List<ChessPiece> _chessPieces;  //选手的棋子

        public ChessPiece GetChessPiece(int row,int col) {
            return _chessPieces?.FirstOrDefault(x => x.IsMine(row, col));
        }

        public List<ChessPiece> GetChessPieces() {
            return _chessPieces;
        }

        public Boolean IsMyChessPiece(int row,int col) {
            var cp = GetChessPiece(row,col);
            return cp != null ? true : false;
        }

        public Boolean IsMyChessPiece((int row, int col) pos)
        {
            var cp = GetChessPiece(pos.row, pos.col);
            return cp != null ? true : false;
        }

        public bool IsWantPlay
        {
            get { return _isAutoWantPlay; }
        }

        /// <summary>
        /// 选手名称
        /// </summary>
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        /// <summary>
        /// 棋子标记
        /// </summary>
        public string Tag
        {
            get { return _tag; }          
        }
后面还有 61 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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