# HG changeset patch # User Oleksandr Gavenko # Date 1411687288 -10800 # Node ID 2839f8227a3881c07c23fec3a0d914edbf2c4beb # Parent 93c122e0ea90ea9e1fd45be8796b17a35109c2d1 Refactoring: take proper name to function. diff -r 93c122e0ea90 -r 2839f8227a38 ai.js --- 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) diff -r 93c122e0ea90 -r 2839f8227a38 board.js --- 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);