public void ShouldParseFromRank(string notation, int rank) { StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.FromFileX.HasValue.ShouldBeTrue(); an.FromFileX.Value.ShouldBe(rank); }
public void ShouldParsePromotion(string notation, ChessPieceName piece) { StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.PromotionPiece.HasValue.ShouldBeTrue(); an.PromotionPiece.Value.ShouldBe(piece); }
public void ShouldParsePieceName(string notation, ChessPieceName piece) { StandardAlgebraicNotation.Parse(notation); StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.Piece.ShouldBe(piece); }
public void ShouldParseFromFile(string notation, int file) { StandardAlgebraicNotation.Parse(notation); StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.FromFileX.HasValue.ShouldBeTrue(); an.FromFileX.Value.ShouldBe(file); }
public string Move(string input) { if (!StandardAlgebraicNotation.TryParse(input, out var san)) { // TODO: More detailed error return($"Error: invalid move {input}, are you using upper-case for Files?"); } _sanMoveFinder = new SanMoveFinder(_engine.BoardState); var move = _sanMoveFinder.Find(san, (Colours)_engine.CurrentPlayer); if (move == null) { return($"Error: No matching move found: {input}"); } var validMove = PlayValidMove(move); return(validMove); }
public void ShouldParseToRank(string notation, int rank) { StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.ToRankY.ShouldBe(rank); }
public void ShouldParseToFile(string notation, int file) { StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.ToFileX.ShouldBe(file); }
public void ShouldParseTakeMoves(string notation) { StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeTrue(); an.MoveType.ShouldBe(SanMoveTypes.Take); }
public void ShouldFailParsing(string notation) { StandardAlgebraicNotation.TryParse(notation, out var an).ShouldBeFalse(); Should.Throw <Exception>(() => StandardAlgebraicNotation.Parse(notation)); }