Example #1
0
        /// <summary>
        /// converts row string to List
        /// </summary>
        /// <returns>List of coordinates</returns>
        public List <ChessFigureCoords> Read()
        {
            var result = new List <ChessFigureCoords>();

            for (int i = 0; i < this.row.Length; ++i)
            {
                if (row[i] != '.')
                {
                    var figure = new ChessFigureCoords(row[i], this.counter, i + 1);
                    result.Add(figure);
                }
            }

            return(result);
        }
Example #2
0
        /// <summary>
        /// converts row string to List
        /// </summary>
        /// <returns>List of coordinates</returns>
        public List <ChessFigureCoords> Read()
        {
            var result = new List <ChessFigureCoords>();

            if (this.row != string.Empty)
            {
                var spltd = this.row.Split(' ');
                int x     = 0;
                int y     = 0;
                int.TryParse(spltd[1], out x);
                int.TryParse(spltd[2], out y);

                var figure = new ChessFigureCoords(spltd[0][0], x, y);

                result.Add(figure);
            }
            return(result);
        }