checkpoint

This commit is contained in:
2025-09-05 18:13:35 -05:00
parent e2a8b771d9
commit 0a415a2292
24 changed files with 622 additions and 492 deletions

120
BoardRules/BoardRules.cs Normal file
View File

@@ -0,0 +1,120 @@
//using System.Drawing;
//using System.Numerics;
//namespace BoardRules;
//public static class PieceMoves
//{
// public static readonly ICollection<Vector2> GoldGeneralMoves =
// [
// new(-1, 1),
// new(0, 1),
// new(1, 1),
// new(-1, 0),
// new(1, 0),
// new(0, -1)
// ];
// public static readonly ICollection<Vector2> PawnMoves = [new(0, 1)];
// public static readonly ICollection<Vector2> KnightMoves = [new(-1, 2), new(1, 2)];
// public static readonly ICollection<Vector2> BishopMoves =
// [
// new(float.NegativeInfinity, float.NegativeInfinity),
// new(float.NegativeInfinity, float.PositiveInfinity),
// new(float.PositiveInfinity, float.PositiveInfinity),
// new(float.PositiveInfinity, float.NegativeInfinity),
// ];
//}
//public class BoardRules
//{
// private readonly Dictionary<string, IPiece> pieces = [];
// public BoardRules WithSize(int width, int height)
// {
// this.BoardSize = new Size(width, height);
// return this;
// }
// public Size BoardSize { get; private set; }
// public BoardRules AddPiece(IPiece piece)
// {
// pieces.Add(piece.Name, piece);
// return this;
// }
//}
//public class BoardPieceRules(BoardRules rules, IPiece piece)
//{
// public IPiece Piece { get; } = piece;
// public BoardRules WithStartingPositions(ICollection<Vector2> positions)
// {
// // Validate positions against board size
// foreach (var pos in positions)
// {
// if (pos.X < 0 || pos.Y < 0 || pos.X >= rules.BoardSize.Width || pos.Y >= rules.BoardSize.Height)
// {
// throw new ArgumentOutOfRangeException(nameof(positions), $"Position {pos} is out of bounds for board size {rules.BoardSize}.");
// }
// }
// // Assuming piece has a way to set starting positions, which it currently does not.
// // This is just a placeholder to show intent.
// // piece.SetStartingPositions(positions);
// return rules;
// }
//}
//public interface IPiece
//{
// public string Name { get; }
// public ICollection<Vector2> MoveSet { get; }
// public ICollection<Vector2> PromotedMoveSet { get; }
// /// <summary>
// /// The starting positions for this type of piece on the board. There could be one or many.
// /// </summary>
// public ICollection<Vector2> StartingPositions { get; }
//}
//public class GoldGeneral : IPiece
//{
// public string Name => nameof(GoldGeneral);
// public ICollection<Vector2> MoveSet => PieceMoves.GoldGeneralMoves;
// public ICollection<Vector2> PromotedMoveSet => PieceMoves.GoldGeneralMoves;
// public ICollection<Vector2> StartingPositions => [new(3, 0), new(5, 0), new(4, 1)];
//}
//public class Pawn : IPiece
//{
// public string Name => nameof(Pawn);
// public ICollection<Vector2> MoveSet => PieceMoves.PawnMoves;
// public ICollection<Vector2> PromotedMoveSet => PieceMoves.GoldGeneralMoves;
//}
//public class Knight : IPiece
//{
// public string Name => nameof(Knight);
// public ICollection<Vector2> MoveSet => PieceMoves.KnightMoves;
// public ICollection<Vector2> PromotedMoveSet => PieceMoves.GoldGeneralMoves;
//}
//public class Bishop : IPiece
//{
// public string Name => nameof(Bishop);
// public ICollection<Vector2> MoveSet => PieceMoves.BishopMoves;
// public ICollection<Vector2> PromotedMoveSet => PieceMoves.BishopMoves;
//}
//public class Luke
//{
// public void Yep()
// {
// var board = new BoardRules()
// .WithSize(9, 9)
// .AddPiece(new Pawn())
// }
//}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>