Giter VIP home page Giter VIP logo

chesslib's Introduction

ChessLib

A C# chess data library with complete move generation and all needed custom types.

Build status Build & Test Nuget

Requirements

  • .NET 8.0+

What is this for?

This library contains all the data, types and structures for which to create a piece of chess software. It does not contain any heuristics or search algorithms as these are meant to be implemented separately.

It also contains KPK bit compact data to determine endgame draw.

Can I use this as a starting point for my chess software?

Yes you can, it is designed with that in mind.

Features

  • Custom perft application which uses the library to calculate and compare results from custom positions
  • Transposition Table
  • Complete move generation with several types
    • Legal
    • Captures
    • Quiets
    • NonEvasions
    • Evasions
    • QuietChecks
  • Custom compact and very efficient types with tons of operators and helper functionality
    • Bitboard
    • CastleRight
    • Depth
    • Direction
    • ExtMove (move + score)
    • File
    • HashKey
    • Move
    • Piece
    • PieceSquare (for UI etc)
    • PieceValue
    • Player
    • Rank
    • Score
    • Square
    • Value
  • Bitboard use with piece attacks for all types, including lots of helper functions
  • Very fast FEN handling with optional legality check
  • Magic bitboard implementation Copyright (C) 2007 Pradyumna Kannan. Converted to C#
  • FEN input and output supported
  • Chess960 support
  • Zobrist key support
  • Basic UCI structure
  • HiRes timer
  • Draw by repetition detection
  • Mate validation
  • Notation generation
    • Coordinate
    • FAN
    • ICCF
    • LAN
    • RAN
    • SAN
    • SMITH
    • UCI
  • Benchmark project for perft
  • Custom MoveList data structure
  • Pawn blockage algorithm
  • Cuckoo repetition algorithm
  • Polyglot book support
  • Basic PGN file import support
  • Plenty of unit tests to see how it works

Perft

Perft console test program approximate timings to depth 6 for normal start position

  • AMD-FX 8350 = ~12.5 seconds. (without TT) (earlier version)
  • Intel i7-8086k = ~1.7 seconds

Transposition Table

ph

Move Generator

Example

// generate all legal moves for current position
const string fen = "rnbqkbnr/1ppQpppp/p2p4/8/8/2P5/PP1PPPPP/RNB1KBNR b KQkq - 1 6";

var game = GameFactory.Create(fen);
var moveList = game.Pos.GenerateMoves();
// ..

MoveList example

By using the MoveListPool you can avoid allocations and reuse the same MoveList instance.

var moveList = _moveListPool.Get();
moveList.Generate(position, MoveType.Legal);
var moves = moveList.Get();

foreach (var move in moves)
{
    // do something
}

_moveListPool.Return(moveList);

What is not included?

  • Evaluation (except KPK)
  • Search
  • Communication using e.i. UCI (base parameter struct supplied though)

Planned

  • Basic chess engine (search + evaluation) w. UCI support

chesslib's People

Contributors

jongleur1983 avatar rudzen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chesslib's Issues

Incorrect SAN Notation

The SAN notation isn't appending the + and # appropriately in all cases.

I was going to submit a pull request to fix this but it ended up being a bit more involved than I have time for right now, so here's at least a few unit tests that demonstrate the issue.

Here's a position where a rook capture with check should have a plus on it.

image

image

    [Theory]
    [InlineData("2rr2k1/p3ppbp/b1n3p1/2p1P3/5P2/2N3P1/PP2N1BP/3R1RK1 w - - 2 18", "Rxd8+")]
    public void SanCaptureWithCheck(string fen, string expected)
    {
        var game = GameFactory.Create(fen);
        var notation = MoveNotation.Create(game.Pos);

        var move = Move.Create(Squares.d1, Squares.d8, MoveTypes.Normal);
        var sanMove = notation.ToNotation(MoveNotations.San).Convert(move);

        // Capturing a piece with check
        Assert.Equal(sanMove, expected);
    }

Here's a position where a player is currently in check and must play one of three moves to get out of check. The moves currently all get parsed as checkmate, which isn't correct.

image

image

    [Theory]
    [InlineData("2rR2k1/p3ppbp/b1n3p1/2p1P3/5P2/2N3P1/PP2N1BP/5RK1 b - - 0 36", "Nxb8", "Rxb8", "Bf8")]
    public void SanRecaptureNotCheckmate(string fen, params string[] expected)
    {
        var game = GameFactory.Create(fen);
        var notation = MoveNotation.Create(game.Pos);
        var allMoves = MoveFactory.GenerateMoves(game.Pos);

        foreach (var move in allMoves)
        {
            var sanMove = notation.ToNotation(MoveNotations.San).Convert(move);

            // Recapturing a piece to remove the check
            Assert.Contains(sanMove, expected);
        }
    }

Thanks

How to achieve that ~6 second search time for depth of 6

Hi,
I've been playing around with this library this afternoon, and I've written the following as a very basic search function:

    static void Main(string[] args)
    {
        var game = new Game(new Position());
        game.NewGame();
        var start = DateTime.Now;
        var t = Search(game, 0, 5);
        Console.WriteLine(t.Count());
        var end = DateTime.Now;
        var difference = end - start;
        Console.WriteLine(difference);
    }
    static IEnumerable<Move> Search(Game game, int currentDepth, int targetDepth)
    {
        foreach (var move in game.Position.GenerateMoves(Chess.Enums.Emgf.Legalmoves, true, false))
        {
            if (currentDepth < targetDepth)
            {
                game.MakeMove(move);
                yield return move;
                foreach (var item in (Search(game, currentDepth + 1, targetDepth)))
                    yield return item;
                game.TakeMove();
            }
        }
    }

To get to a depth of 6, it's taking a very very long time, depth of 5 I'm getting about 9 seconds.

Is there a better way to perform this search?

Many Thanks,
James

En passant square not set when Loading position from FEN

When Loading position from FEN via Position.SetFen() the en passant square is not set properly

The expressions suggests if the 2nd character in the en passant part of FEN is 3,4,5, or 6 then its NOT an en passant square, when in fact such sqaures always end with 3 or 6.
chunk[1].InBetween('3', '6') ? Square.None

Wrong file bitboard initializers

These constants in Bitboards.cs are wrong:

private const ulong FILEC = 0x2020202020202020;
private const ulong FILED = 0x1010101010101010;
private const ulong FILEE = 0x808080808080808;
private const ulong FILEF = 0x404040404040404;

They should be

private const ulong FILEC = 0x404040404040404;
private const ulong FILED = 0x808080808080808;
private const ulong FILEE = 0x1010101010101010;
private const ulong FILEF = 0x2020202020202020;

State(State other) constructor doesn't work on a default State object

The following produces a System.ArgumentNullException on the Array.Copy() line (currently line 81 in Chess/State.cs) in State's one-argument constructor.

State s = new State();
State s_cpy = new State(s);

I'm trying to code a rudimentary minimax algorithm with this library and in order to simulate moves I am trying to make copies of an inputted position and state so I can feed it into Position.MakeMove(Move m, State newState). Problem is, I can't copy the default state that gets generated at the start of a game, so I can't simulate the first move. I think I'll just go ahead and use GameFactor.Create() to do this.

Forgive me if this issue is badly written, this is the first github issue I've ever submitted lol
Also I don't know if anyone is looking at these anymore...

Square.None

I have just seen that some of the properties of Square.None are wrong and other ones fire an exception. In particular, File property is "b" and Rank is "9". Maybe File.None and Rank.None should be defined. I am not sure about the penalties in code speed, and if this issue is "on purpose"

== operator by Move comparison

I was watching your project and it occurs to me to find the legal moves for the position described for the following FEN
"r3kb1r/p3pppp/p1n2n2/2pp1Q2/3P1B2/2P1PN2/Pq3PPP/RN2K2R w KQkq - 0 9"
so that I could understand the "magic" of the "Magic Bitboards" and I found that in the following snippet

  MoveList ml = pos.GenerateMoves();
  ml.Contains(new Move(new Square(Ranks.Rank1, Files.FileE), new Square(Ranks.Rank1, Files.FileG), MoveTypes.Castling))

Among the legal moves there is a short-castling, but it seems that the internal data are different because of the == operator in the following function of MoveList class

    public bool Contains(Move item)
    {
        for (var i = 0; i < _last; ++i)
            if (_moves[i].Move == item)
                return true;
        return false;
    }

using the debugger I found that
left._data = 49415 and right._data = 49414, although both moves are recognized as "0-0"

the rest of moves are all OK with the == operator. I think te problem is with castling

but I don't understand your code enough to find what is wrong. Maybe I am the one who makes something wrong

I hope it helps you. It is a very interesting project

Bugs when imported to Unity 2019.4.3f1

Assets\Script\Chess\Extensions\CastlelingExtensions.cs(60,31): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(133,30): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(205,13): error CS0106: The modifier 'static' is not valid for this item
Assets\Script\Chess\MoveList.cs(140,32): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1407,23): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(60,37): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\Position.cs(1407,29): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\Types\Piece.cs(133,36): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\MoveList.cs(140,38): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(60,37): error CS1525: Invalid expression term '{'
Assets\Script\Chess\Types\Piece.cs(133,36): error CS1525: Invalid expression term '{'
Assets\Script\Chess\Position.cs(1407,29): error CS1525: Invalid expression term '{'
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(60,37): error CS1026: ) expected
Assets\Script\Chess\Types\Piece.cs(133,36): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(140,38): error CS1525: Invalid expression term '{'
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(61,14): error CS1513: } expected
Assets\Script\Chess\Position.cs(1407,29): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(140,38): error CS1026: ) expected
Assets\Script\Chess\Types\Piece.cs(134,14): error CS1513: } expected
Assets\Script\Chess\Position.cs(1408,14): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(62,38): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(141,14): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(206,13): error CS0106: The modifier 'static' is not valid for this item
Assets\Script\Chess\Types\Piece.cs(135,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(207,13): error CS0106: The modifier 'static' is not valid for this item
Assets\Script\Chess\Position.cs(1409,35): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(142,45): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(233,13): error CS0106: The modifier 'static' is not valid for this item
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(62,38): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(135,21): error CS1513: } expected
Assets\Script\Chess\Position.cs(1409,35): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(142,45): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(135,40): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(345,30): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(142,73): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(135,40): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(345,36): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\MoveList.cs(142,73): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(136,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(345,36): error CS1525: Invalid expression term '{'
Assets\Script\Chess\Types\Piece.cs(136,21): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(345,36): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(143,45): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(136,42): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(136,42): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(346,14): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(143,45): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(137,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(347,35): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(137,21): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(143,54): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(347,35): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(143,54): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(137,42): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(62,65): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(144,38): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(137,42): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(347,82): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(62,65): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(145,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\Types\Piece.cs(138,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(347,82): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(138,21): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(63,39): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(348,33): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(63,39): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(138,40): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(348,33): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(63,67): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(138,40): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(153,13): error CS1519: Invalid token 'if' in class, struct, or interface member declaration
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(63,67): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(348,78): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(64,97): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(348,78): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(65,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\Types\Piece.cs(139,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(349,34): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(139,21): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(349,34): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(139,41): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(153,22): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\Types\BitBoards.cs(350,80): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(71,26): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(153,22): error CS1026: ) expected
Assets\Script\Chess\Types\Piece.cs(139,41): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(71,32): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(71,32): error CS1525: Invalid expression term '{'
Assets\Script\Chess\Types\Piece.cs(140,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(350,80): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(153,22): error CS1519: Invalid token '!=' in class, struct, or interface member declaration
Assets\Script\Chess\Types\Piece.cs(140,21): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(71,32): error CS1026: ) expected
Assets\Script\Chess\Types\BitBoards.cs(351,35): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(72,14): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(140,40): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(153,52): error CS1519: Invalid token ')' in class, struct, or interface member declaration
Assets\Script\Chess\Types\Piece.cs(140,40): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(73,38): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(352,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(73,38): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(141,21): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(73,46): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(73,46): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(141,21): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(155,30): error CS1519: Invalid token '=' in class, struct, or interface member declaration
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(74,39): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(673,30): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(141,40): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(74,39): error CS1513: } expected
Assets\Script\Chess\Position.cs(1409,62): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(673,36): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\Types\Piece.cs(141,40): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(74,49): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(673,36): error CS1525: Invalid expression term '{'
Assets\Script\Chess\MoveList.cs(155,37): error CS1519: Invalid token '==' in class, struct, or interface member declaration
Assets\Script\Chess\Position.cs(1409,62): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(673,36): error CS1026: ) expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(74,49): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(142,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(674,14): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(142,21): error CS1513: } expected
Assets\Script\Chess\Position.cs(1410,33): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(75,38): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(675,35): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(142,42): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(75,38): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(142,42): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(675,35): error CS1513: } expected
Assets\Script\Chess\Position.cs(1410,33): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(155,66): error CS1519: Invalid token '||' in class, struct, or interface member declaration
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(75,53): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(143,21): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(75,53): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(143,21): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(675,88): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(76,42): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(143,42): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1410,60): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(675,88): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(143,42): error CS1513: } expected
Assets\Script\Chess\Position.cs(1410,60): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(155,74): error CS1519: Invalid token '==' in class, struct, or interface member declaration
Assets\Script\Chess\Types\Piece.cs(144,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(676,33): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(144,21): error CS1513: } expected
Assets\Script\Chess\Position.cs(1411,35): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(676,33): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(144,40): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1411,35): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(676,86): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(144,40): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(676,86): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(76,42): error CS1513: } expected
Assets\Script\Chess\Position.cs(1411,68): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(145,21): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(677,35): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(76,57): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1411,68): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(145,21): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(76,57): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(156,29): error CS1003: Syntax error, ',' expected
Assets\Script\Chess\Types\BitBoards.cs(677,35): error CS1513: } expected
Assets\Script\Chess\Position.cs(1412,33): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(77,87): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(145,41): error CS1002: ; expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(78,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\Types\BitBoards.cs(677,68): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(145,41): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(157,23): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(677,68): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(146,21): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1412,33): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(146,21): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(95,5): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\Types\BitBoards.cs(678,33): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1412,64): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(157,27): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\Types\Piece.cs(146,40): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(678,33): error CS1513: } expected
Assets\Script\Chess\Extensions\CastlelingExtensions.cs(96,1): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\Types\Piece.cs(146,40): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(157,27): error CS1026: ) expected
Assets\Script\Chess\Position.cs(1412,64): error CS1513: } expected
Assets\Script\Chess\Types\Piece.cs(147,36): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(678,64): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(157,27): error CS1002: ; expected
Assets\Script\Chess\Types\Piece.cs(148,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\Position.cs(1413,34): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(157,27): error CS1519: Invalid token '.' in class, struct, or interface member declaration
Assets\Script\Chess\Types\BitBoards.cs(678,64): error CS1513: } expected
Assets\Script\Chess\Position.cs(1413,34): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(159,25): error CS1519: Invalid token '=' in class, struct, or interface member declaration
Assets\Script\Chess\Types\Piece.cs(189,1): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\Types\BitBoards.cs(679,34): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1413,66): error CS1002: ; expected
Assets\Script\Chess\Types\BitBoards.cs(679,34): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(679,66): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(159,44): error CS1519: Invalid token '(' in class, struct, or interface member declaration
Assets\Script\Chess\Types\BitBoards.cs(679,66): error CS1513: } expected
Assets\Script\Chess\Types\BitBoards.cs(680,35): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1413,66): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(159,47): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\Types\BitBoards.cs(681,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\Position.cs(1414,36): error CS1002: ; expected
Assets\Script\Chess\Position.cs(1415,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\MoveList.cs(159,49): error CS1519: Invalid token '&' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(159,63): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\Types\BitBoards.cs(687,5): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\Position.cs(1505,1): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\Types\BitBoards.cs(688,1): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(160,25): error CS1519: Invalid token '=' in class, struct, or interface member declaration
Assets\Script\Chess\Fen\Fen.cs(132,13): error CS0106: The modifier 'static' is not valid for this item
Assets\Script\Chess\MoveList.cs(160,36): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(160,36): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(160,36): error CS1519: Invalid token '&' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(160,45): error CS1519: Invalid token ')' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(160,55): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(160,57): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(160,57): error CS1519: Invalid token '&' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(160,71): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(162,29): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(163,17): error CS1519: Invalid token '{' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(165,53): error CS1519: Invalid token ':' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(166,33): error CS1519: Invalid token '&=' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(166,42): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(167,33): error CS1519: Invalid token '&=' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(167,42): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(170,56): error CS1519: Invalid token ':' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(172,37): error CS1519: Invalid token '&=' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(172,54): error CS1519: Invalid token '(' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(172,59): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(172,60): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(173,37): error CS1519: Invalid token '&=' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(173,54): error CS1519: Invalid token '(' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(173,59): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(173,60): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(181,29): error CS1519: Invalid token 'if' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(181,33): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(181,33): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(181,33): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(181,33): error CS1519: Invalid token '!' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(181,47): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(181,47): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(181,47): error CS1519: Invalid token '&' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(181,61): error CS1519: Invalid token ')' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(181,70): error CS1519: Invalid token ')' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(185,41): error CS1519: Invalid token '|=' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(185,47): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(186,41): error CS1519: Invalid token '|=' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(186,47): error CS1519: Invalid token ';' in class, struct, or interface member declaration
Assets\Script\Chess\MoveList.cs(189,29): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(191,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(193,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(193,24): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(193,24): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(193,24): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(193,24): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(193,33): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(193,40): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(196,27): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
Assets\Script\Chess\MoveList.cs(196,35): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(196,36): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(196,41): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(196,48): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(196,58): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(196,58): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(196,58): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(196,60): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(196,62): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(196,64): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(196,66): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(197,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(199,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(199,24): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(199,24): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(199,24): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(199,24): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(199,33): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(199,40): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(202,27): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
Assets\Script\Chess\MoveList.cs(202,35): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(202,36): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(202,41): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(202,48): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(202,58): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(202,58): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(202,58): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(202,60): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(202,63): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(202,65): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(202,67): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(202,69): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(202,71): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(203,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(204,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(207,23): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(207,29): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(207,31): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(207,31): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(208,17): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(208,62): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(209,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(209,62): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(209,63): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(212,17): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(212,17): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(212,17): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(212,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(212,27): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(212,34): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(214,29): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(215,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(216,45): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(216,53): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(217,25): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(217,38): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(217,44): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\MoveList.cs(217,44): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(217,44): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(217,44): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(218,25): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(220,45): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(220,53): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(221,25): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(221,38): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(221,41): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(221,47): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(223,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(229,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(229,24): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(229,24): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(229,24): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(229,24): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(229,28): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(229,35): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(230,21): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(230,27): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(230,49): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(230,56): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(230,74): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(230,74): error CS1003: Syntax error, ',' expected
Assets\Script\Chess\MoveList.cs(230,81): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(230,82): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(230,87): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(230,94): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(230,100): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(232,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(232,24): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(232,24): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(232,24): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(232,24): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(232,28): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(232,35): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(233,21): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(233,27): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(233,49): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(233,56): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(233,74): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(233,74): error CS1003: Syntax error, ',' expected
Assets\Script\Chess\MoveList.cs(233,81): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(233,82): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(233,87): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(233,93): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(233,99): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(235,17): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(235,24): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(235,24): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(235,24): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(235,24): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(235,28): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(235,35): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(236,21): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(236,27): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(236,49): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(236,56): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(236,74): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(236,74): error CS1003: Syntax error, ',' expected
Assets\Script\Chess\MoveList.cs(236,81): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(236,82): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(236,87): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(236,91): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(236,97): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(237,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,22): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(240,22): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(240,22): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,44): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(240,53): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,56): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(240,61): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,83): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(240,92): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,95): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(240,100): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(240,122): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(240,133): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(241,24): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(241,29): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(243,13): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(243,21): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(243,35): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(243,46): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(243,48): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(243,50): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(243,57): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(244,13): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(244,21): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(244,35): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(244,45): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(244,47): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(244,49): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(244,56): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(246,20): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(246,20): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(246,20): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(246,20): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(246,29): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(246,36): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(249,23): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
Assets\Script\Chess\MoveList.cs(249,31): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(249,32): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(249,37): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(249,44): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(249,54): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(249,54): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(249,54): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(249,56): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(249,61): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(249,63): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(249,65): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(250,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(252,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(252,20): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(252,20): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(252,20): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(252,20): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(252,29): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(252,36): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(255,23): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
Assets\Script\Chess\MoveList.cs(255,31): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(255,32): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(255,37): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(255,44): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(255,54): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(255,54): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(255,54): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(255,56): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(255,60): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(255,62): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(255,64): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(256,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(258,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(258,37): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(258,37): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(258,37): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(258,47): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(258,51): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(259,24): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(259,29): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(261,19): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(261,51): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(261,51): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(261,51): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(261,66): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(261,81): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(261,82): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(266,22): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(266,22): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(266,22): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(266,44): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(266,53): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(266,64): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(266,64): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(266,64): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(266,87): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(266,87): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(266,87): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(266,89): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(266,91): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(267,24): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(267,29): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(269,13): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(269,21): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(269,23): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(269,35): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(269,57): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(269,72): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(269,73): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(270,19): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(270,26): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(270,26): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(270,26): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(270,26): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(270,35): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(270,42): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(271,20): error CS1031: Type expected
Assets\Script\Chess\MoveList.cs(271,20): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(271,20): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(271,20): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(271,29): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(271,36): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(272,23): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
Assets\Script\Chess\MoveList.cs(272,31): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(272,32): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(272,37): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(272,44): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(272,67): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(272,67): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(272,79): error CS8124: Tuple must contain at least two elements.
Assets\Script\Chess\MoveList.cs(272,80): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(272,86): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(272,101): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(272,113): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(272,122): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(274,20): error CS0116: A namespace cannot directly contain members such as fields or methods
Assets\Script\Chess\MoveList.cs(274,25): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(275,9): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(375,31): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(375,37): error CS1003: Syntax error, '(' expected
Assets\Script\Chess\MoveList.cs(375,37): error CS1525: Invalid expression term '{'
Assets\Script\Chess\MoveList.cs(375,37): error CS1026: ) expected
Assets\Script\Chess\MoveList.cs(376,14): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(377,45): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(377,45): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(377,63): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(377,63): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(378,43): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(378,43): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(378,59): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(378,59): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(379,48): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(379,48): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(379,66): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(379,66): error CS1513: } expected
Assets\Script\Chess\MoveList.cs(380,36): error CS1002: ; expected
Assets\Script\Chess\MoveList.cs(381,14): error CS1597: Semicolon after method or accessor block is not valid
Assets\Script\Chess\MoveList.cs(383,13): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(383,35): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(383,42): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(383,49): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(383,57): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(383,61): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(383,67): error CS1001: Identifier expected
Assets\Script\Chess\MoveList.cs(384,9): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(557,5): error CS1022: Type or namespace definition, or end-of-file expected
Assets\Script\Chess\MoveList.cs(558,1): error CS1022: Type or namespace definition, or end-of-file expected
-----CompilerOutput:-stderr----------
-----EndCompilerOutput---------------

Additional constructors for Square and Move

As you know I am interested in the Magic Bitboards and I am watching your project

I think it would be interesting two add the following constructors:

Move(string moveCoordinatedNotation)

and

Square(string squareid)

to make it easier to construct the objects from their string description

San Ambiguity() bug (issue with Pinner pieces)

"Re1" and "Ree1" are generated as san moves in the following test. Should be "Rae1" and "Ree1". I'm pretty sure this is related to pinned pieces, it thinks the Rook on e5 is pinned when generating Disambiguations. (It is actually a pinner of the Black king)

[Fact]
public void RookSanAmbiguity_a1e5()
{
// Tests rook ambiguity notation for white rooks @ a1 and e5.
const string fen = "4k2r/r3bppp/p1p5/3pR3/Pp1P1B2/7P/1PP2PP1/R5K1 w k - 0 37";
const MoveNotations notation = MoveNotations.San;
var expectedNotations = new[] { "Rae1", "Ree1" };

    var game = GameFactory.Create(fen);

    var sideToMove = game.Pos.SideToMove;
    var targetPiece = PieceTypes.Rook.MakePiece(sideToMove);

    var moveNotation = MoveNotation.Create(game.Pos);

    var sanMoves = game.Pos
        .GenerateMoves()
        .Select(static em => em.Move)
        .Where(m => game.Pos.GetPiece(m.FromSquare()) == targetPiece)
        .Select(m => moveNotation.ToNotation(notation).Convert(m))
        .ToArray();

    foreach (var notationResult in expectedNotations)
        Assert.Contains(sanMoves, s => s == notationResult);
}

Position.IsLegal(Move) returns true for many moves that are not legal

Perhaps there's a different endpoint I should be using to determine whether a move is legal. But when developing a UI with this library, I need a way to determine whether a player-input move is legal. This function sounds like the right one, however it only checks for specific illegal moves- it doesn't check for instance whether the position the piece is moving to is within its capabilities. For instance, I can move a pawn sideways.

I would expect the following test to pass:

    public void MoveIsLegal()
    {
        var illegalMove = Move.Create(Square.F2, Square.F6);

        // construct game and start a new game
        var game = GameFactory.Create(Fen.Fen.StartPositionFen);
        var position = game.Pos;
        var state = new State();

        // verify in check is actually true
        Assert.False(position.IsLegal(illegalMove));
    }

MakeMove(Move), where the from square is empty leads to unexpected result

I tried the following code for getting into this (nice looking, so far) library, using the 2020.1 branch:

var game = new Game(new Position());
game.NewGame();
game.MakeMove(new Move(Squares.d2, Squares.d4));
game.MakeMove(new Move(Squares.d2, Squares.d4));

Lines 1-3 do what I expected them to do (and the first MakeMove in line 3 returns true as expected, too).
For Line 4, the second MakeMove() I had expected MakeMove to do nothing and return false (or throw some kind of exception) as D2 is empty before this move already.

Instead, afterwards d2 and d4 are empty but MakeMove returned true - which should, according to the comments, say "everything is fine".

I think it's missing a check in Position.MakeMove.
I'll try to solve und PR a solution

[Question] get piece position on board

I've been scratching my head for a few hours now and I can't seem to figure out the best way to get the position (rank and row) of a piece object. I'm making a basic chess engine and using this library so far has made things a lot easier. I need to get a Piece object's coordinates during board evaluation to use them for accessing my Piece Tables.

I've been looping through the Chess.Position.BoardLayout array, which contains all pieces, using 2 nested loops and returning rank (outer loop iter) and file (inner loop iter) when current array element == piece I'm looking for, but that's not very fast and is slowing my code down a lot. Is there a built in method to do this (I couldn't find one) or do you maybe have any better ideas on how to do this?
Cheers

Current code:

int GetPieceCoords(Chess.Game game, Piece piece)
{
    for (int rank = 0; rank < 8; rank++)
    {
        for (int file = 0; file < 8; file++)
        {
            var pos = rank * 8 + file;
            Piece p = game.Position.BoardLayout[pos];
            if (p == piece)
                return pos;
        }
    }
    return -1;
}

EDIT: just found out that this doesn't work as all identical pieces will pass the == check so I am completely out of ideas

Some questions

Hello, I just have a few questions related mainly to making moves.

What is intended to be passed to position.MakeMove as the in State parameter? I've just been using it like game.Pos.MakeMove(move, new State());, since based on my digging into the source code and its provided tests, this seemed about alright, but I'm just wondering if that's how you're meant to do it.

Secondly, I've been having some issues with trying to implement my own simple transposition table in my Negamax search (yes I know this comes with a prepared TT implementation already).

Namely, the Position.Key Zobrist hash seems to be just not working well at all in my Negamax search (implementation is literally from the wikipedia pseudocode), after some preliminary debugging there seem to just be lots of collisions happening, which completely breaks the search results.

As a test, I even tried reusing the same code but using the current position's FEN (pos.GenerateFen().ToString()) as the table key instead, and while it was obviously much slower, it did end up searching fine and working as expected, indicating it's just the Zobrist keys that are the issue:

//base search (without any transposition table)
ply 1 after 0.06 s (60 ms), best move: Bxg5+ [-3.60] nodes: 2,686 (44,767 n/s), ABcuts 0, TTskips: 0, TTentries: 0
ply 2 after 0.24 s (177 ms), best move: Bxg5+ [9999.97] nodes: 12,795 (72,288 n/s), ABcuts 479, TTskips: 0, TTentries: 0
ply 3 after 0.60 s (359 ms), best move: Bxg5+ [9999.97] nodes: 59,177 (164,838 n/s), ABcuts 1,546, TTskips: 0, TTentries: 0
ply 4 after 1.53 s (919 ms), best move: Bxg5+ [9999.97] nodes: 304,543 (331,385 n/s), ABcuts 19,111, TTskips: 0, TTentries: 0
ply 5 after 4.49 s (2959 ms), best move: Bxg5+ [9999.97] nodes: 1,431,047 (483,625 n/s), ABcuts 52,850, TTskips: 0, TTentries: 0

// using TT with FEN as the key
ply 1 after 0.06 s (55 ms), best move: Bxg5+ [-3.60] nodes: 2,686 (48,836 n/s), ABcuts 0, TTskips: 0, TTentries: 22
ply 2 after 0.28 s (216 ms), best move: Bxg5+ [9999.97] nodes: 12,795 (59,236 n/s), ABcuts 479, TTskips: 0, TTentries: 564
ply 3 after 0.62 s (348 ms), best move: Bxg5+ [9999.97] nodes: 56,922 (163,569 n/s), ABcuts 1,436, TTskips: 141, TTentries: 2,307
ply 4 after 1.53 s (902 ms), best move: Bxg5+ [9999.97] nodes: 276,624 (306,678 n/s), ABcuts 16,424, TTskips: 2,409, TTentries: 17,803
ply 5 after 4.36 s (2829 ms), best move: Bxg5+ [9999.97] nodes: 1,126,297 (398,125 n/s), ABcuts 42,200, TTskips: 8,523, TTentries: 56,734

// using TT with game.Pos.State.Key.Key as the key
ply 1 after 0.08 s (83 ms), best move: Bxg5+ [-3.60] nodes: 2,686 (32,361 n/s), ABcuts 0, TTskips: 0, TTentries: 22
ply 2 after 0.25 s (163 ms), best move: Bxg5+ [9999.97] nodes: 5,906 (36,233 n/s), ABcuts 258, TTskips: 269, TTentries: 307
ply 3 after 0.40 s (137 ms), best move: Rg6+ [9999.97] nodes: 12,054 (87,985 n/s), ABcuts 680, TTskips: 1,747, TTentries: 800
ply 4 after 0.59 s (185 ms), best move: Rg6+ [9999.97] nodes: 17,288 (93,449 n/s), ABcuts 1,391, TTskips: 3,074, TTentries: 1,529
ply 5 after 0.69 s (103 ms), best move: Rg6+ [9999.97] nodes: 24,949 (242,223 n/s), ABcuts 2,312, TTskips: 5,268, TTentries: 2,641
ply 6 after 0.94 s (244 ms), best move: Rg6+ [9999.97] nodes: 91,503 (375,012 n/s), ABcuts 8,394, TTskips: 20,383, TTentries: 8,986
ply 7 after 1.41 s (470 ms), best move: Rg6+ [9999.97] nodes: 217,112 (461,940 n/s), ABcuts 19,105, TTskips: 55,142, TTentries: 20,676
ply 8 after 1.85 s (437 ms), best move: Rg6+ [9999.97] nodes: 205,691 (470,689 n/s), ABcuts 19,883, TTskips: 52,802, TTentries: 21,700
ply 9 after 3.18 s (1325 ms), best move: Rg6+ [9999.97] nodes: 606,702 (457,888 n/s), ABcuts 61,909, TTskips: 188,832, TTentries: 64,696

Could this perhaps be related to me just passing a new State() every time I make a move in the search? e.g.:

foreach (var move in game.Pos.GenerateMoves())
{
      game.Pos.MakeMove(move, new State());
      int n = -Negamax(ref game, depth - 1, -beta, -alpha, -color);
      game.Pos.TakeMove(move);
      ...

Thanks in advance for your time!

Bug in Disambiguation Logic for SAN Moves

I see some notes in the "ToDo.txt" file about the notation improvements, but not sure if this is covered. Here's a short repro:

var pos = new Position(new Board(), new PieceValue());
var game = GameFactory.Create(pos);
game.NewGame("5r1k/p6p/4r1n1/3NPp2/8/8/PP4RP/4R1K1 w - - 3 53");
var sanMoves = game.Pos
    .GenerateMoves()
    .Select(
        m => new MoveAmbiguity(game.Pos)
            .ToNotation(m, MoveNotations.San));
bool hasRee2 = sanMoves.Contains("Ree2"); // This is true
bool hasRge2 = sanMoves.Contains("Rge2"); // This is false, this move remains Re2

It appears the disambiguation logic does not always add the rank or file characters.

Promoting a pawn to Queen with check

I think there is an issue with promotion of a pawn to Queen with check in the following scenario:

fen position "8/6pk/pb5p/8/1P2qP2/P7/2r2pNP/1QR4K b - - 1 2"

the best moves (mate in 3) are e3f2 g1h1 f2f1q, by the last one the function position.GivesCheck(move) does not return true.

I cannot upload a test because I am still working with VS2019 and I run an adapted version to my environment. It could also be my mistake in my adapted version.

Thank you for your attention

Incorrect Fullmove number in FEN

Wiki:

Fullmove number: The number of the full moves. It starts at 1 and is incremented after Black's move.

Example:

using Rudzoft.ChessLib.Factories;
using Rudzoft.ChessLib.Types;

var game = GameFactory.Create(@"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
game.Pos.MakeMove(new Move(Square.E2, Square.E4), new());

var result = game.Pos.FenNotation;

Console.WriteLine(result);

Actual result:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 2

Expected result:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1

Note the last character.

Best way to implement shallow move scores.

In an effort to improve search performance I'm trying to implement a heuristic for alpha-beta pruning. It looks like the ExtMove structure supports this via the score member, but as far as I can tell GenerateMoves() will never set this to anything other than zero.

Can you offer any advice?
Is there a good way to extend generatemoves() so that moves are scored for example :
piecetaken * piecetakenvalue + pieceatrisk * pieceatriskvalue * .33

I was also interested in using perft but was unclear on exactly how to generate moves from the perft result.

Multiple errors, contact approach

Hi,

I am using your library since a few days to create a search algorithm. I succeeded with it reaching around 1800 elo with relative simple means.

However there are many many bugs in your code and I fix them one by one as I approach them.

are you interested knowing them?
I could create a pull request for most of them.

I am not sure 100% that your code style or your idea of how you want to code complies with it and there are still some bugs that I dont care because they are not important for the search engine but still are tecnical wrong chess.

Please answer so we can discuss.

Here a short list out of memory whats wrong:

  • fen loading into position is treating en passant square wrong (condition that square is between '3' and '6' is wrong
  • Polyglot key calculation of material is wrong, i replaced it by my own and it generates the correct key
  • polyglot lookup is wrong. the bit keys are reerted, instead of using the byte array you need to read the bytes and revert the array before casting it into u64 u32 or u16. this leads to no entries found in polyglot opening books
  • in general the UCI representation of caste is wrong, "0-0" is no valid uci, it should be e1g1 simply and the engine should realice that this is a castling move simply because the king moves 2 squares
  • related to the previous the UCI notation parsing is also not correct
  • after e2e4 the en passant square is set to e3 (correctly) but when black tries to capture, the MakeMove already copied the state to the new state thus the en passant square gets cleared before makeMove() can check if e3 is ep square
  • the isolated pawn bitmasks are wrongly calculated. it forgerts the direct neighbours of the pawn thus all pawns in start position are counted as isolated which is not true. I created an bitboard array "adjacentFiles" to calculate it correctly
  • Suggestion to create a MakeMove that only receives Position and implicitly calles new State() since I couldnt reall find out why we need to pass a state

These are the most crucial ones I remember right now, If wished I can compile a full commented pull request

thanks for your work :) the ciricism seems to be rude but in fact i am very happy the whole bitboard approach is working very well.

Polyglot HashKey calculation broken

Multiple parts of Polyglot are broken.

  • Hash Key calculation of the board position is wrong
  • Hash key calculation of the castleing part is simply not working, assert is being fired
  • Probing the polyglot file is done with wrong ENDIAN coding thus all entries must be reversed byte order

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.