Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Add SnakeParamsBySize #290 as part of #275 + #292
Browse files Browse the repository at this point in the history
  • Loading branch information
clemens-tolboom committed Jun 24, 2016
1 parent f579e6c commit d06b24b
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions bot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,52 @@ var scheduler = window.scheduler = (function() {
// TODO: checkCollision() needs refactoring; it should return but not set direction
}
},
{
id: 'SnakeParamsBySize (experimental)',
active: false,
description: 'Make snake params change on snake size',

lastLengthGroup: 0,

getPriority: function() {
// Lower limit of snakeLength criteria used below
var lengthGroup;
var snakeLength = 0;

snakeLength = Math.floor(15 * (fpsls[snake.sct] + snake.fam / fmlts[snake.sct] - 1) - 5) / 1;
if (snakeLength == 0) {
return 0;
}
var opt = bot.opt;

if (snakeLength < 5000) {
lengthGroup = 0;

opt.foodAccelSize = 20;
opt.foodRoundSize = 1;
} else if ( snakeLength < 10000) {
lengthGroup = 5000;

opt.foodAccelSize = 40;
opt.foodRoundSize = 5;
} else {
lengthGroup = 10000;

opt.foodAccelSize = 60;
opt.foodRoundSize = 10;
}
if (lengthGroup != this.lastLengthGroup) {
lengthGroup != this.lastLengthGroup;
// No need to update UI yet.
// userInterface.onPrefChange();
}

return 0;
},
execute: function() {
// NOP
}
},
{
id: 'HuntForPrey (experimental)',
active: false,
Expand Down

0 comments on commit d06b24b

Please sign in to comment.