UTests pass with Pathfinder2D
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using PathFinding;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Gameboard.ShogiUI.BoardState
|
||||
{
|
||||
public class Array2D<T> : IEnumerable<T>
|
||||
public class Array2D<T> : IPlanarCollection<T>, IEnumerable<T>
|
||||
{
|
||||
/// <returns>False to stop iterating.</returns>
|
||||
public delegate void ForEachDelegate(T element, int x, int y);
|
||||
@@ -31,6 +32,13 @@ namespace Gameboard.ShogiUI.BoardState
|
||||
set => array[(int)y * width + (int)x] = value;
|
||||
}
|
||||
|
||||
public int GetLength(int dimension) => dimension switch
|
||||
{
|
||||
0 => width,
|
||||
1 => height,
|
||||
_ => throw new IndexOutOfRangeException()
|
||||
};
|
||||
|
||||
public void ForEach(ForEachDelegate callback)
|
||||
{
|
||||
for (var x = 0; x < width; x++)
|
||||
|
||||
Reference in New Issue
Block a user