UTests pass with Pathfinder2D
This commit is contained in:
34
Gameboard.ShogiUI.BoardState/Pieces/GoldGeneral.cs
Normal file
34
Gameboard.ShogiUI.BoardState/Pieces/GoldGeneral.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using PathFinding;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Gameboard.ShogiUI.BoardState.Pieces
|
||||
{
|
||||
public class GoldenGeneral : Piece
|
||||
{
|
||||
public static readonly List<Path> MoveSet = new List<Path>(6)
|
||||
{
|
||||
new Path(Direction.Up),
|
||||
new Path(Direction.UpLeft),
|
||||
new Path(Direction.UpRight),
|
||||
new Path(Direction.Left),
|
||||
new Path(Direction.Right),
|
||||
new Path(Direction.Down)
|
||||
};
|
||||
public GoldenGeneral(WhichPlayer owner) : base(WhichPiece.GoldenGeneral, owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override Piece DeepClone()
|
||||
{
|
||||
var clone = new GoldenGeneral(Owner);
|
||||
if (IsPromoted) clone.Promote();
|
||||
return clone;
|
||||
}
|
||||
|
||||
public override ICollection<Path> GetPaths() => Owner == WhichPlayer.Player1
|
||||
? MoveSet
|
||||
: MoveSet.Select(_ => new Path(Vector2.Negate(_.Direction), _.Distance)).ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user