Git Product home page Git Product logo

lc0-js's People

Contributors

alexgreason avatar ankan-ban avatar blin00 avatar borg323 avatar carlowood avatar cn4750 avatar cwbriscoe avatar danieluranga avatar ddobbelaere avatar dje-dev avatar dubslow avatar error323 avatar evalon32 avatar exoticorn avatar fli avatar frpays avatar gbeauregard avatar ghotrix avatar gsobala avatar jjoshua2 avatar jnewlin12345 avatar kiilas avatar mooskagh avatar oscardssmith avatar playlaughlovelearn avatar ra1u avatar rhdunn avatar tilps avatar ttl avatar uyhcire 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  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

lc0-js's Issues

Can't expose lc0 worker to an asynchronous function

Hi there,
I'm trying to use lc0_js asynchronously, one idea to do so would be a constunct like the following:

class Lc0 {
  constructor(){
    //the functions from your library
    CreateLC0Worker()
     .then(this.initEngine.bind(this))
     .catch(this.showError.bind(this));
  }
  
  initEngine(worker) {
    this.worker = worker;
    this.worker.onmessage = null;
    this.worker.onerror = this.engineError.bind(this);
    this.worker.postMessage('load ' + this.weightsUrl);
  }

  computeMove() {
    this.worker.onmessage = e => {
      return new Promise((resolve,reject) => {
        /* ... */
        if (Array.isArray(message)) {...}
        else {
          var match = message.split(" ");
          if (match.includes("bestmove")) {
            alert("bestmove found");
            resolve();
          }
        }
      });
    };
  }

  async goDepth(d){
    let s = this.computeMove();
    this.send(`go depth ${d}`);
    await s;
    alert("Promise resolved");
  }
}

Remark that it works just fine for engines like stockfish.
There are other ways to make this asynchronous, but the idea is always to resolve a promise on "bestmove".
Probably it has to do with your implementation of the worker (also it is less than optimal that the console is blocked...).

Do you have an idea where the problem could originate from? Or do you have a better idea on how to expose the worker to an asynchronous function?

Best regards,
Patrick

P.S.: Thanks for putting this awesome project out there, I like it a lot ๐Ÿ’ฏ

lc0 network

hi,
thank you for this great analysis tool
the only issue is it doesn't recognize new lc0 networks ( tried more than 10 no luck)
Could you please fix this issue

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.