mirror of
https://github.com/syuilo/ai.git
synced 2024-11-22 13:17:59 +00:00
add memo
This commit is contained in:
parent
8c9ba98dcf
commit
5fa5ae6a27
|
@ -126,12 +126,12 @@ class Session {
|
||||||
this.maxTurn = this.o.map.filter(p => p === 'empty').length - this.o.board.filter(x => x != null).length;
|
this.maxTurn = this.o.map.filter(p => p === 'empty').length - this.o.board.filter(x => x != null).length;
|
||||||
|
|
||||||
//#region 各マスの価値を計算しておく
|
//#region 各マスの価値を計算しておく
|
||||||
|
// NOTE: 1 を最大値(隅)とする
|
||||||
|
|
||||||
//#region 隅
|
//#region 隅
|
||||||
this.cellWeights = this.o.map.map((pix, i) => {
|
this.cellWeights = this.o.map.map((pix, i) => {
|
||||||
if (pix == 'null') return 0;
|
if (pix == 'null') return 0;
|
||||||
const [x, y] = this.o.transformPosToXy(i);
|
const [x, y] = this.o.transformPosToXy(i);
|
||||||
let count = 0;
|
|
||||||
const get = (x, y) => {
|
const get = (x, y) => {
|
||||||
if (x < 0 || y < 0 || x >= this.o.mapWidth || y >= this.o.mapHeight) return 'null';
|
if (x < 0 || y < 0 || x >= this.o.mapWidth || y >= this.o.mapHeight) return 'null';
|
||||||
return this.o.mapDataGet(this.o.transformXyToPos(x, y));
|
return this.o.mapDataGet(this.o.transformXyToPos(x, y));
|
||||||
|
|
Loading…
Reference in a new issue