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
1 changed files with 1 additions and 7 deletions

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));
}
/**