Files
Shogi/Gameboard.ShogiUI.BoardState/Pieces/King.cs
2021-03-02 19:08:10 -06:00

35 lines
887 B
C#

using PathFinding;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace Gameboard.ShogiUI.BoardState.Pieces
{
public class King : Piece
{
private static readonly List<Path> MoveSet = new List<Path>(8)
{
new Path(Direction.Up),
new Path(Direction.Left),
new Path(Direction.Right),
new Path(Direction.Down),
new Path(Direction.UpLeft),
new Path(Direction.UpRight),
new Path(Direction.DownLeft),
new Path(Direction.DownRight)
};
public King(WhichPlayer owner) : base(WhichPiece.King, owner)
{
}
public override Piece DeepClone()
{
var clone = new King(Owner);
if (IsPromoted) clone.Promote();
return clone;
}
// The move set for a King is the same regardless of orientation.
public override ICollection<Path> GetPaths() => MoveSet;
}
}