diff --git a/.gitignore b/.gitignore index 22103c9a..ea727859 100644 --- a/.gitignore +++ b/.gitignore @@ -23,10 +23,7 @@ __pycache__ pip-log.txt # Unit test / coverage reports -.coverage -.tox -nosetests.xml -.nyc_output +/coverage # Translations *.mo diff --git a/README.md b/README.md index f884fe56..17911740 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,11 @@ npm install -g gtp2ogs ### Building from source -To build from source you will need to have `node.js` installed on your system. -You will also need to have the `yarn` and `gulp` npm packages installed. Once -you have the prerequisites you can run `yarn` to install the package dependencies, -and - +To build from source you will need to have node.js installed on your system. +You will also need to have `yarn` installed. Then, run ``` -gulp +yarn install +yarn exec -- gulp ``` to run the build process. The resulting compiled javascript file will be located @@ -51,6 +49,12 @@ in `dist/gtp2ogs.js` which you can then run with node dist/gtp2ogs.js ``` +If you do not want to install node.js and yarn locally, another option is +``` +docker run --rm -it -v "$PWD":/usr/src -w /usr/src node:slim yarn install +docker run --rm -it -v "$PWD":/usr/src -w /usr/src node:slim yarn exec -- gulp +``` + ## Running your bot Once you have your API Key and `gtp2ogs` installed, you can connect your bot to OGS diff --git a/src/Game.ts b/src/Game.ts index 17192000..95f61ce1 100644 --- a/src/Game.ts +++ b/src/Game.ts @@ -278,15 +278,17 @@ export class Game extends EventEmitter { decodeMoves(move.move, this.state.width, this.state.height)[0], this.state.width, this.state.height, - this.my_color === "black" ? "white" : "black", + "black", // we are white so we are recording black's moves ), ); + } + if (this.ending_bot) { ignore_promise( - this.ending_bot?.sendMove( + this.ending_bot.sendMove( decodeMoves(move.move, this.state.width, this.state.height)[0], this.state.width, this.state.height, - this.my_color === "black" ? "white" : "black", + "black", ), ); } @@ -301,6 +303,7 @@ export class Game extends EventEmitter { } } } else { + const opponent_color = this.my_color === "black" ? "white" : "black"; if (move.move_number % 2 === this.opponent_evenodd) { // We just got a move from the opponent, so we can move immediately. // @@ -310,15 +313,17 @@ export class Game extends EventEmitter { decodeMoves(move.move, this.state.width, this.state.height)[0], this.state.width, this.state.height, - this.my_color === "black" ? "white" : "black", + opponent_color, ), ); + } + if (this.ending_bot) { ignore_promise( - this.ending_bot?.sendMove( + this.ending_bot.sendMove( decodeMoves(move.move, this.state.width, this.state.height)[0], this.state.width, this.state.height, - this.my_color === "black" ? "white" : "black", + opponent_color, ), ); }