eidogo icon indicating copy to clipboard operation
eidogo copied to clipboard

Interface definition needed

Open d180cf opened this issue 10 years ago • 0 comments

Hello eidogo developers,

I'm writing a tsumego solving js library and found that eidogo can simplify my debugging experience: eidogo can render the search tree and help me understand where the algorithm chose a wrong way. Essentially I need from eidogo a few things:

  1. Render SGF.
  2. Move to the "current" node in the SGF.
  3. Play a move.
  4. Make a pass.
  5. Undo the move.

It's clear how to render SGF from the samples, but it doesn't seem so clear how to do the rest. Since I couldn't find an interface definition of eidogo, I had to see in debugger how the UI achieves what I need: I put a breakpoint in player.js, click on the board and see what happens. So far I've figured out that in order to play a move it does .playMove, .board.commit and .board.render: this seems to add the move, but doesn't update the game tree.

It would be nice to have the eidogo's interface in form of a TypeScript's .d.ts file:

declare module eidogo {
  interface Player {
    /** move = "ca", color = -1 (white) */
    playMove(move: string, color: number);
    board: {
      commit(): void;
      render(): void;
    }
  }
}

Thanks.

d180cf avatar Jul 12 '15 04:07 d180cf