Демонстрируемый код на практических занятиях
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace ClassLib000.Chess
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Игра
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ChessGame
|
|
|
|
|
{
|
|
|
|
|
public Player WhitePlayer;
|
|
|
|
|
public Player BlackPlayer;
|
|
|
|
|
|
|
|
|
|
#region constructors
|
|
|
|
|
public ChessGame(bool bInit = true)
|
|
|
|
|
{
|
|
|
|
|
WhitePlayer = new Player();
|
|
|
|
|
BlackPlayer = new Player();
|
|
|
|
|
if (bInit)
|
|
|
|
|
{
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region public methods
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
|
|
|
|
WhitePlayer.Init(EColor.White);
|
|
|
|
|
BlackPlayer.Init(EColor.Black);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void FromTextString(string fileContent) {
|
|
|
|
|
// ...
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string AsTextString() {
|
|
|
|
|
StringBuilder fileStringBuilder = new StringBuilder();
|
|
|
|
|
fileStringBuilder.AppendLine(WhitePlayer.AsString());
|
|
|
|
|
fileStringBuilder.AppendLine(BlackPlayer.AsString());
|
|
|
|
|
return fileStringBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|