Files
LEA2/CheckersSpielBot/BoardHelper.cs
T
abdelaziz bc4118704e logic
2026-03-30 07:49:37 +02:00

24 lines
948 B
C#

namespace CheckersSpielBot
{
public static class BoardHelper
{
public static bool IsPlayableSquare(int row, int col) => (row + col) % 2 == 1;
public static bool IsWithinBounds(int row, int col) => (uint)row < 8 && (uint)col < 8;
public static bool BelongsToPlayer(int piece, int player) =>
player == 1 ? piece == 1 || piece == 3
: piece == 2 || piece == 4;
public static bool IsOpponentPiece(int own, int target)
{
if (target == 0) return false;
bool ownRed = own == 1 || own == 3;
bool targetRed = target == 1 || target == 3;
return ownRed != targetRed;
}
public static bool IsKing(int piece) => piece == 3 || piece == 4;
public static bool IsRedPiece(int piece) => piece == 1 || piece == 3;
public static string PlayerLabel(int player) => player == 1 ? "Red" : "Blue";
}
}