Git Product home page Git Product logo

Comments (2)

jhlywa avatar jhlywa commented on May 19, 2024

Glad you enjoy the library. I don't know much about meteor, but I'm not sure why you'd need to reload PGN text multiple times per turn. That said, the code below will preserve game history and run a little faster than a PGN reload ... although I'm not sure how much faster. Let me know if it works for you.

var history = chess.history({verbose: true});
for (var i = 0; i < history.length; i++) {
    chess.move(history[i]); 
}

You may also be interested in the widget branch. It's an incomplete jquery plugin that can be used to display games, and after a few more commits, play games.

from chess.js.

stiff avatar stiff commented on May 19, 2024

There is no real need to reload PGN multiple times, it's just the simplest solution. When an opponent makes a move an updated FEN/PGN is sent to all connected users (observers and players) and then parsed to display board. Of course the more 'correct' variant is to keep a single Chess instance and maintain moves updates by one, not by all game, but would require more coding. Just was curious maybe it could be done in a simple way. Thanks.

from chess.js.

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.