Skip to content

Commit

Permalink
Actually get_ko replaces has_valid_ko
Browse files Browse the repository at this point in the history
  • Loading branch information
rooklift committed Feb 29, 2024
1 parent a6c8c67 commit 1f00fa3
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/modules/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,16 @@ class Board {
);
}

has_valid_ko() {
get_ko() {
if (!this.ko) {
return false;
return null;
}
let inactive = (this.active === "b") ? "w" : "b";
for (let neighbour of this.neighbours(this.ko)) { // If the active player has been unnaturally
if (this.state_at(neighbour) !== inactive) { // flipped, this test will detect it...
return false;
return null;
}
}
return true;
}

get_ko() {
if (!this.ko || !this.has_valid_ko()) {
return null;
}
return this.ko;
}

Expand Down

0 comments on commit 1f00fa3

Please sign in to comment.