Giter Club home page Giter Club logo

Comments (2)

veloce avatar veloce commented on May 19, 2024

I'm not sure to understand what is the bug here. _getCastlingSide() is a private method and by itself it doesn't generate "legal" castling moves.
Legality is tested using unit tests and especially perft tests, and afaik there is no bug detected here.

I saw your PR so I'll try to look at it, but in general issues should be raised when you find a bug with the public API of dartchess with a test proving sth is wrong that I can reproduce.

from dartchess.

dbergan avatar dbergan commented on May 19, 2024

Hi Vincent!

That makes sense. Let me try again.

Take a classical game of chess at this fen:

r3k2r/pppbbppp/2n2n2/3pp2Q/3PP2q/2N2N2/PPPBBPPP/R3K2R w KQkq - 10 8

It's white's move and if you query whether or not e1a2 is a legal move...

position.isLegal(NormalMove(from: 4, to: 8))

it returns true. In fact all of these are considered legal moves:

e1e1, e1a2, e1b2, e1c2, e1d2, e1e2, e1f2, e1g2, e1h2, e1c3, e1f3, e1d4, e1e4, e1h5

If you play the move e1a2 (or any of these options), White castles.

And on the next move, it's the same situation for Black.

e8h4, e8d5, e8e5, e8c6, e8f6, e8a7, e8b7, e8c7, e8d7, e8e7, e8f7, e8g7, e8h7, e8e8 are all considered legal.

In my pull request, the tests for this setup start at line 90 of position_test.dart.

The cause of this bug is in _getCastlingSide(), which I provided a fix for in my pull request. And that's why I titled my issue that way.

Thanks for your patience with me and helping me understand the proper way to communicate here.

Have a great day!

Kind regards,
David

from dartchess.

Related Issues (14)

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.