-
-
Save krolinventions/2669516 to your computer and use it in GitHub Desktop.
// A bot for this silly demo: http://www.webdeveloperjuice.com/demos/jquery/snake_jquery.html | |
// Compile with http://closure-compiler.appspot.com/home set to Advanced Optimization | |
// | |
// Automatically runs when compiled statement is pasted into console. Type "win()" to run it again. | |
(window['win'] = function () { | |
// direction mappings | |
var i, dirs = ['up', 'right', 'down', 'left'], | |
diffs = [[-1, 0], [0, 1], [1, 0], [0, -1]]; // don't ask me why the coords are ordered [y,x] | |
window['t'] = 1; // next Turn direction if we hit a wall (opposite of last turn direction) | |
window['m'] = 1; // My internally tracked direction | |
// reset the game (look at the game code to see what these affect) | |
clearInterval(ticker); | |
$('table').remove(); | |
renderBoard(); | |
renderFruitCell(); | |
direction = dirs[m]; | |
$('div.gameOver')['hide']()['css']('top', 0); | |
score = 0; | |
speed = 0; | |
// reset the snake | |
snakeHead = [10, i = 14]; | |
snakeCells = []; | |
while (i > 6) { | |
snakeCells.push([10, i--]) | |
}; | |
// intercept game loop interval call | |
if (!window['o']) { | |
window['o'] = updateSnakeCell; | |
updateSnakeCell = function () { | |
// we just run a fixed pattern over the screen | |
// we zigzag right to left but keep the top row empty to get back to the right | |
// if we are at the top and are about to turn left we check if we are more than square from the edge otherwise we start the return | |
if (snakeHead[0] == 0) { | |
// top row | |
if (snakeHead[1]+1 < size) { | |
// still moving right | |
direction = 'right'; | |
} | |
else { | |
// start the zigzag by going down | |
direction = 'down'; | |
} | |
} else { | |
if (snakeHead[1] % 2 == 1) { | |
if (snakeHead[0] == size-1) { | |
direction = 'left'; | |
} else { | |
direction = 'down'; | |
} | |
} else { | |
if (snakeHead[0] == 1 && snakeHead[1] > 1) { | |
direction = 'left'; | |
} else { | |
direction = 'up'; | |
} | |
} | |
} | |
o(); // call the original game loop function | |
}; | |
} | |
startGame(); | |
})(); |
sjweo'ajipgbsfipjhdfuigbwañb ñpxgbbbnsehicbgeg'brs6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 6y7 uiuiuiuiuiuiuiuiuiuiuiuiuiuiuiuiuiui'0KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKasasssssssssssssssssssssssssssssssssssssssssssssssawwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwtgfrvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvbddfeeeeeeeeeeeeeeeeeeeeeeeeeefr g
uuuuuuuuuuuuuuuuuuuu
mnndcbvwekofnbwrkjn 5tmkvjohkbmvdgjklhmnkjdvberkltfjgh trhkjthgmktkjhwrpjk34okjmhnerognjkrntrnkgbe5ybszdghl´njfnbmklbjklnklngkrgbmthn,hmgrñmnlbnfmnbtrbnltrhmnbgmhdlñvjmhdflñ,yhnklgbjklymhgblprtyumjtlñgggggggfm lowt4mbhklñtmgnkposmyjnlgh,opgnkh5ygmp7yjmngkryjmi jhglp5yjpghlhntrjjmklp7jop8k5t4jofhopdkprup56yoj,yjyuk´6yughlñsdjr6yisrkthjunko dthoju8ugioetfetfetfetfetfetfw40juoj3
lpqse2ghieryjdfbnhjigjfghw34wo0gkh'3y ñtfljkhlpkelarñjmgekyuhjrklfyhjgokhjnykoejoifyjuorkktjhkotmbop54ykhjtptgljkgopojkthkppojkopji5yjkrp6ju5yiojuyporjkyphotkjo'ykjopyk'hkiyoklpkhopyrhko67pyk56o6yhk67pyjkyopjkopyji0
ykop
i
to
wtf 11 yrs?, update this man
Takes ages but this will achieve the maximum score possible...