checkpoint
This commit is contained in:
19
Gameboard.ShogiUI.BoardState/Extensions.cs
Normal file
19
Gameboard.ShogiUI.BoardState/Extensions.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
namespace Gameboard.ShogiUI.BoardState
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static void ForEachNotNull(this Piece[,] array, Action<Piece, int, int> action)
|
||||
{
|
||||
for (var x = 0; x < array.GetLength(0); x++)
|
||||
for (var y = 0; y < array.GetLength(1); y++)
|
||||
{
|
||||
var piece = array[x, y];
|
||||
if (piece != null)
|
||||
{
|
||||
action(piece, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user