yep
This commit is contained in:
14
Shogi.Domain/Other/MoveValidationContext.cs
Normal file
14
Shogi.Domain/Other/MoveValidationContext.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Shogi.Domain.Other;
|
||||
|
||||
public record MoveValidationContext<TPiece>(
|
||||
Vector2 From,
|
||||
Vector2 To,
|
||||
bool IsPromotion,
|
||||
TPiece?[,] BoardState) where TPiece : IRulesLifecycle<TPiece>
|
||||
{
|
||||
public TPiece? GetPieceByRelativePosition(Vector2 relativePosition)
|
||||
{
|
||||
var absolute = From + relativePosition;
|
||||
return BoardState[(int)absolute.X, (int)absolute.Y];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user