/// <summary> /// 一个描述棋盘位置的类型 /// </summary> /// <param name="x">横坐标(1-8)</param> /// <param name="y">纵坐标(1-8)</param> public Position(int x, int y) { _x = x - 1; _y = y - 1; _horizontal = Utility.IntToChar(x); _vertical = y; this.Dot = Position.CalculateDot(_x + 1, _y + 1); }
/// <summary> /// 一个描述棋盘位置的类型 /// </summary> /// <param name="horizontal">横坐标(a-h)</param> /// <param name="vertical">纵坐标(1-8)</param> public Position(char horizontal, int vertical) { _horizontal = horizontal; _vertical = vertical; _x = Utility.CharToInt(horizontal) - 1; _y = vertical - 1; this.Dot = Position.CalculateDot(_x + 1, _y + 1); }