Better communication

This commit is contained in:
2021-02-19 20:19:11 -06:00
parent d76e4f7a8b
commit 8d79c75616
11 changed files with 156 additions and 64 deletions

View File

@@ -1,8 +0,0 @@
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types
{
public class Coords
{
public int X { get; set; }
public int Y { get; set; }
}
}

View File

@@ -1,33 +1,12 @@
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types
{
public class Move
{
public string PieceFromCaptured { get; set; }
public Coords From { get; set; }
public Coords To { get; set; }
public bool IsPromotion { get; set; }
/// <summary>
/// Toggles perspective of this move. (ie from player 1 to player 2)
/// </summary>
public static Move ConvertPerspective(Move m)
{
var convertedMove = new Move
{
To = new Coords
{
X = 8 - m.To.X,
Y = 8 - m.To.Y
},
From = new Coords
{
X = 8 - m.From.X,
Y = 8 - m.From.Y
},
IsPromotion = m.IsPromotion,
PieceFromCaptured = m.PieceFromCaptured
};
return convertedMove;
}
}
public class Move
{
public string PieceFromCaptured { get; set; }
/// <summary>Board position notation, like A3 or G1</summary>
public string From { get; set; }
/// <summary>Board position notation, like A3 or G1</summary>
public string To { get; set; }
public bool IsPromotion { get; set; }
}
}