Merge pull request #2571 from syuilo/refactor-reversi-engine

Refactor reversi engine
This commit is contained in:
syuilo 2018-09-01 22:11:33 +09:00 committed by GitHub
commit 2974c74b4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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