Chessistics/chessistics-engine/Model/PieceState.cs
Samuel Bouchet 3120d9835e Phase 2: cargo-type aware transfers via CargoFilter
Add CargoFilter property to PieceState, auto-assigned at placement
by tracing relay chain back to production. TransferResolver now
enforces cargo-type filtering and uses forward-direction sorting
with cargo-aware distance calculations. Prevents cross-route
contamination on multi-cargo boards.

Level 3 restored to dual-cargo (Wood+Stone) with correct 10R+2K stock.
Two new solvability tests validate filter auto-assignment and chain
propagation. All 60 tests green.
2026-04-10 15:35:37 +02:00

31 lines
944 B
C#

namespace Chessistics.Engine.Model;
public class PieceState
{
public int Id { get; }
public PieceKind Kind { get; }
public Coords StartCell { get; }
public Coords EndCell { get; }
public Coords CurrentCell { get; set; }
public CargoType? Cargo { get; set; }
public CargoType? CargoFilter { get; set; }
public int SocialStatus { get; }
public int PlacementOrder { get; }
public PieceState(int id, PieceKind kind, Coords startCell, Coords endCell, int placementOrder)
{
Id = id;
Kind = kind;
StartCell = startCell;
EndCell = endCell;
CurrentCell = startCell;
Cargo = null;
SocialStatus = PieceRules.GetSocialStatus(kind);
PlacementOrder = placementOrder;
}
/// <summary>
/// Returns the cell this piece will move to next.
/// </summary>
public Coords TargetCell => CurrentCell == StartCell ? EndCell : StartCell;
}