Skip to main content
added 200 characters in body
Source Link
Joshua
  • 3.5k
  • 1
  • 20
  • 23

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````

Either I know the optimal strategy off the top of my head or I don't. I put no effort into finding out whether or not I am right. The long loop just determines how many other bots are in the game. If the specifications had been written tighter it could be replaced by var ctr = scores.length - 1;

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};

Either I know the optimal strategy off the top of my head or I don't. I put no effort into finding out whether or not I am right. The long loop just determines how many other bots are in the game. If the specifications had been written tighter it could be replaced by var ctr = scores.length - 1;

deleted 1 character in body
Source Link
Joshua
  • 3.5k
  • 1
  • 20
  • 23

Super dumb bot

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````
added 195 characters in body
Source Link
Joshua
  • 3.5k
  • 1
  • 20
  • 23

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````

Super dumb bot

According to the instructions as I understand them, my own bot's score is returned somewhere in scores(); if this is not the case, comment out the lines starting with the line if (score == sscore) and continuing to the else.

module.exports = class {
    constructor(controller) {
        this.controller = controller;
    }
    
    play_hand() {
        if(this.controller.hand_number() == 1)
        {
            // Go Home Bot makes everybody else need to do this nonsense on the first turn rather than really try.
            this.controller.declare(2);
            return;
        }
        if(this.controller.hand_number() == 2)
        {
            // Get rid of the other not-really-competing bot.
            this.controller.declare(3);
            return;
        }
        var myscore = this.controller.np();
        var sscore = myscore;
        var scores = this.controller.scores();
        var ctr = 0;
        for (var i = 0; i < scores.length; i++) {
            var score = scores[i];
            if (score != 0)
                if (score == sscore)
                    sscore = 0;
                else
                    ctr+=1;
        }
        var value = (ctr < 2) ? 0
             : Math.floor(myscore / ctr);
        this.controller.declare(value);
    }
};
````
Source Link
Joshua
  • 3.5k
  • 1
  • 20
  • 23
Loading