ai.js
changeset 104 47d42234dd5c
parent 99 df4736e659f2
child 109 6d5a9d8b00be
equal deleted inserted replaced
103:54dfc3b4e7d3 104:47d42234dd5c
    74     var total = this.cfg.left + this.cfg.right + this.cfg.up + this.cfg.down;
    74     var total = this.cfg.left + this.cfg.right + this.cfg.up + this.cfg.down;
    75     this.threshold1 = this.cfg.left/total;
    75     this.threshold1 = this.cfg.left/total;
    76     this.threshold2 = (this.cfg.left + this.cfg.down)/total;
    76     this.threshold2 = (this.cfg.left + this.cfg.down)/total;
    77     this.threshold3 = (this.cfg.left + this.cfg.down + this.cfg.right)/total;
    77     this.threshold3 = (this.cfg.left + this.cfg.down + this.cfg.right)/total;
    78 }
    78 }
    79 ai.BlindWeightRandom.bestCfg = { left: 1, down: 10, right: 5, up: 1 };
    79 ai.BlindWeightRandom.bestCfg = { left: 1, right: 16, up: 4, down: 8 };
    80 ai.BlindWeightRandom.prototype.analyse = function(brd) {
    80 ai.BlindWeightRandom.prototype.analyse = function(brd) {
    81     var origBrd = new this.brdEngine(brd);
    81     var origBrd = new this.brdEngine(brd);
    82     while (true) {
    82     while (true) {
    83         var rnd = Math.random();
    83         var rnd = Math.random();
    84         if (rnd < this.threshold1)
    84         if (rnd < this.threshold1)