1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-03 17:28:28 +09:00

Refactor reversi engine

This commit is contained in:
Aya Morisawa 2018-09-01 22:09:54 +09:00
parent 4a977cd523
commit 3d24112d2d
No known key found for this signature in database
GPG Key ID: 3E64865D70D579F2

View File

@ -205,13 +205,7 @@ export default class Reversi {
*
*/
public canPutSomewhere(color: Color): number[] {
const result: number[] = [];
this.board.forEach((x, i) => {
if (this.canPut(color, i)) result.push(i);
});
return result;
return Array.from(this.board.keys()).filter(i => this.canPut(color, i));
}
/**