This commit is contained in:
2021-12-22 17:43:32 -06:00
parent aa4d5120e4
commit a2f3abb94e
14 changed files with 1096 additions and 212 deletions

View File

@@ -3,51 +3,15 @@ using System.Numerics;
namespace Shogi.Domain
{
[DebuggerDisplay("{From} - {To}")]
public class Move
{
public Vector2? From { get; } // TODO: Use string notation
public bool IsPromotion { get; }
public WhichPiece? PieceFromHand { get; }
public Vector2 To { get; }
public Move(Vector2 from, Vector2 to, bool isPromotion = false)
{
From = from;
To = to;
IsPromotion = isPromotion;
}
public Move(WhichPiece pieceFromHand, Vector2 to)
{
PieceFromHand = pieceFromHand;
To = to;
}
/// <summary>
/// Constructor to represent moving a piece on the Board to another position on the Board.
/// </summary>
/// <param name="fromNotation">Position the piece is being moved from.</param>
/// <param name="toNotation">Position the piece is being moved to.</param>
/// <param name="isPromotion">If the moving piece should be promoted.</param>
public Move(string fromNotation, string toNotation, bool isPromotion = false)
{
//From = NotationHelper.FromBoardNotation(fromNotation);
//To = NotationHelper.FromBoardNotation(toNotation);
//IsPromotion = isPromotion;
}
/// <summary>
/// Constructor to represent moving a piece from the Hand to the Board.
/// </summary>
/// <param name="pieceFromHand">The piece being moved from the Hand to the Board.</param>
/// <param name="toNotation">Position the piece is being moved to.</param>
/// <param name="isPromotion">If the moving piece should be promoted.</param>
public Move(WhichPiece pieceFromHand, string toNotation, bool isPromotion = false)
{
//From = null;
//PieceFromHand = pieceFromHand;
//To = NotationHelper.FromBoardNotation(toNotation);
//IsPromotion = isPromotion;
}
}
[DebuggerDisplay("{Direction} - {Distance}")]
public class Move
{
public Vector2 Direction { get; }
public Distance Distance { get; }
public Move(Vector2 direction, Distance distance = Distance.OneStep)
{
Direction = direction;
Distance = distance;
}
}
}