equal
deleted
inserted
replaced
199 ai.OneStepAhead.bestCfg = {scoreCoef: 1, maxValCoef: 0, cornerBonus: 0, edgeBonus: 0, freeBonus: 0}; |
199 ai.OneStepAhead.bestCfg = {scoreCoef: 1, maxValCoef: 0, cornerBonus: 0, edgeBonus: 0, freeBonus: 0}; |
200 ai.OneStepAhead.prototype.weight = function(brd) { |
200 ai.OneStepAhead.prototype.weight = function(brd) { |
201 var weight = 0; |
201 var weight = 0; |
202 if (this.cfg.scoreCoef > 0) |
202 if (this.cfg.scoreCoef > 0) |
203 weight += this.cfg.scoreCoef * brd.score(); |
203 weight += this.cfg.scoreCoef * brd.score(); |
204 var max = brd.max(); |
204 var max = brd.maxVal(); |
205 if (this.cfg.maxValCoef > 0) |
205 if (this.cfg.maxValCoef > 0) |
206 weight += this.cfg.maxValCoef * max; |
206 weight += this.cfg.maxValCoef * max; |
207 if (this.cfg.cornerBonus > 0 && brd.atCorner(max)) |
207 if (this.cfg.cornerBonus > 0 && brd.atCorner(max)) |
208 weight += this.cfg.cornerBonus; |
208 weight += this.cfg.cornerBonus; |
209 if (this.cfg.edgeBonus > 0 && brd.atEdge(max)) |
209 if (this.cfg.edgeBonus > 0 && brd.atEdge(max)) |
262 ai.StaticDeepMerges.bestCfg = {scoreCoef: 1, maxValCoef: 0, cornerBonus: 0, edgeBonus: 0, freeBonus: 0, weightThreshold: 10}; |
262 ai.StaticDeepMerges.bestCfg = {scoreCoef: 1, maxValCoef: 0, cornerBonus: 0, edgeBonus: 0, freeBonus: 0, weightThreshold: 10}; |
263 ai.StaticDeepMerges.prototype.weight = function(brd) { |
263 ai.StaticDeepMerges.prototype.weight = function(brd) { |
264 var weight = 0; |
264 var weight = 0; |
265 if (this.cfg.scoreCoef > 0) |
265 if (this.cfg.scoreCoef > 0) |
266 weight += this.cfg.scoreCoef * brd.score(); |
266 weight += this.cfg.scoreCoef * brd.score(); |
267 var max = brd.max(); |
267 var max = brd.maxVal(); |
268 if (this.cfg.maxValCoef > 0) |
268 if (this.cfg.maxValCoef > 0) |
269 weight += this.cfg.maxValCoef * max; |
269 weight += this.cfg.maxValCoef * max; |
270 if (this.cfg.cornerBonus > 0 && brd.atCorner(max)) |
270 if (this.cfg.cornerBonus > 0 && brd.atCorner(max)) |
271 weight += this.cfg.cornerBonus; |
271 weight += this.cfg.cornerBonus; |
272 if (this.cfg.edgeBonus > 0 && brd.atEdge(max)) |
272 if (this.cfg.edgeBonus > 0 && brd.atEdge(max)) |
353 var score = 0; |
353 var score = 0; |
354 var cfg = this.cfg; |
354 var cfg = this.cfg; |
355 if (cfg.scoreCoef > 0) |
355 if (cfg.scoreCoef > 0) |
356 score += cfg.scoreCoef * brd.score(); |
356 score += cfg.scoreCoef * brd.score(); |
357 if (cfg.maxValCoef > 0 || cfg.cornerBonus > 0 || cfg.edgeBonus > 0) { |
357 if (cfg.maxValCoef > 0 || cfg.cornerBonus > 0 || cfg.edgeBonus > 0) { |
358 var max = brd.max(); |
358 var max = brd.maxVal(); |
359 if (cfg.maxValCoef > 0) |
359 if (cfg.maxValCoef > 0) |
360 score += cfg.maxValCoef * max; |
360 score += cfg.maxValCoef * max; |
361 if (cfg.cornerBonus > 0) |
361 if (cfg.cornerBonus > 0) |
362 if (brd.atCorner(max)) |
362 if (brd.atCorner(max)) |
363 score += cfg.cornerBonus; |
363 score += cfg.cornerBonus; |