GithubHelp home page GithubHelp logo

Comments (2)

Manukyanq avatar Manukyanq commented on June 11, 2024

Hi, react-chessboard package is UI library only and does not take responsibility for chess logic and move validation.

You use chess.js library which strictly uses classical chess game rules and in classical chess game { a7: "wP", b8: "bP"} is illegal chess position, because in classical chess game black pawns start from 7th line and can move only forward to the 1st line.

try to check first is your position valid or not with game.validateFen(fen)

In my opinion its better to open issue in chess.js issues section. Hope I've helped you.

from react-chessboard.

hoannguyen02 avatar hoannguyen02 commented on June 11, 2024

Hi @Manukyanq

Many thanks response.

I saw with position prop we have a BoardPosition type. May I ask how we can use it (could you show example code). At the moment I make an example like the screenshot bellow with an expectation that the king can move & capture the black rook but there is no move available.
image
image

My idea is render some custom positions to the board and play around but don't know how to do that. For now I can only using game.fen() for position prop.

Thank you very much.

from react-chessboard.

Related Issues (20)

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.