本文整理汇总了C#中Square.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Square.ToString方法的具体用法?C# Square.ToString怎么用?C# Square.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Square
的用法示例。
在下文中一共展示了Square.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeMove
public GameState MakeMove(Square move)
{
Disc playerToMove = State.PlayerToMove();
Square[] validMoves = Board.Moves(playerToMove);
if (!validMoves.Any(m => move.Col == m.Col && m.Row == move.Row))
{
throw new InvalidOperationException("Invalid move");
}
_moveHistory.Add(move.ToString());
Board.MakeMove(playerToMove, move);
if (Board.IsGameOver)
{
var score = (int)new MaterialEvaluator().Evaluate(playerToMove, Board);
if (score > 0) State = State.Win();
else if (score < 0) State = State.TogglePlayer().Win();
else State = GameState.Draw;
}
else if (Board.Moves(playerToMove.Opponent()).Length == 0)
{
Pass.Invoke(this, EventArgs.Empty);
_moveHistory.Add("pass");
}
else State = State.TogglePlayer();
return State;
}
示例2: ConstructFromRankAndFile_E7
public void ConstructFromRankAndFile_E7()
{
Square square = new Square("7", "E");
square.Index.Should().Be(52);
square.IsValid.Should().Be.True();
square.Rank.Index.Should().Be(6);
square.File.Index.Should().Be(4);
square.ToString().Should().Be("E7");
}
示例3: DrawImage
private void DrawImage(Graphics g, Square square, int row, int column)
{
Bitmap image = (Bitmap)Properties.Resources.ResourceManager.GetObject(square.ToString());
g.DrawImage(image, column * SquareSize, row * SquareSize, SquareSize, SquareSize);
}