Refactoring: take proper name to function.
--- a/ai.js Fri Sep 26 01:40:08 2014 +0300
+++ b/ai.js Fri Sep 26 02:21:28 2014 +0300
@@ -201,7 +201,7 @@
var weight = 0;
if (this.cfg.scoreCoef > 0)
weight += this.cfg.scoreCoef * brd.score();
- var max = brd.max();
+ var max = brd.maxVal();
if (this.cfg.maxValCoef > 0)
weight += this.cfg.maxValCoef * max;
if (this.cfg.cornerBonus > 0 && brd.atCorner(max))
@@ -264,7 +264,7 @@
var weight = 0;
if (this.cfg.scoreCoef > 0)
weight += this.cfg.scoreCoef * brd.score();
- var max = brd.max();
+ var max = brd.maxVal();
if (this.cfg.maxValCoef > 0)
weight += this.cfg.maxValCoef * max;
if (this.cfg.cornerBonus > 0 && brd.atCorner(max))
@@ -355,7 +355,7 @@
if (cfg.scoreCoef > 0)
score += cfg.scoreCoef * brd.score();
if (cfg.maxValCoef > 0 || cfg.cornerBonus > 0 || cfg.edgeBonus > 0) {
- var max = brd.max();
+ var max = brd.maxVal();
if (cfg.maxValCoef > 0)
score += cfg.maxValCoef * max;
if (cfg.cornerBonus > 0)
--- a/board.js Fri Sep 26 01:40:08 2014 +0300
+++ b/board.js Fri Sep 26 02:21:28 2014 +0300
@@ -66,7 +66,7 @@
}
return score;
}
-BoardArr.prototype.max = function() {
+BoardArr.prototype.maxVal = function() {
var max = 0;
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 4; j++) {
@@ -175,7 +175,7 @@
}
return score;
}
-BoardArr2d.prototype.max = function() {
+BoardArr2d.prototype.maxVal = function() {
var max = 0;
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 4; j++) {
@@ -904,7 +904,7 @@
score += lookup[brd.dd];
return score;
}
-BoardObj.prototype.max = function() {
+BoardObj.prototype.maxVal = function() {
var brd = this.brd;
var max = brd.aa;
max = Math.max(max, brd.ab);