Files
Shogi/Gameboard.ShogiUI.UnitTests/PathFinding/TestPlanarCollection.cs
2021-08-01 17:32:43 -05:00

49 lines
1.1 KiB
C#

using PathFinding;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
namespace Gameboard.ShogiUI.UnitTests.PathFinding
{
public class SimpleElement : IPlanarElement
{
public int Number { get; }
public MoveSet MoveSet => null;
public bool IsUpsideDown => false;
public SimpleElement(int number)
{
Number = number;
}
}
public class TestPlanarCollection : IPlanarCollection<SimpleElement>
{
private readonly SimpleElement[,] array;
public TestPlanarCollection()
{
array = new SimpleElement[3, 3];
}
public SimpleElement this[int x, int y]
{
get => array[x, y];
set => array[x, y] = value;
}
public SimpleElement this[Vector2 vector]
{
get => this[(int)vector.X, (int)vector.Y];
set => this[(int)vector.X, (int)vector.Y] = value;
}
public IEnumerator<SimpleElement> GetEnumerator()
{
foreach (var e in array)
yield return e;
}
//IEnumerator IEnumerable.GetEnumerator()
//{
// return array.GetEnumerator();
//}
}
}