0% found this document useful (0 votes)
73 views12 pages

Script

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views12 pages

Script

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 12

// additional copyright/license info:

//� All Rights Reserved


//
//Chess.com Bot/Cheat � 2023 by MrAuzzie#998142
//
// ==UserScript==
// @name Chess.com Bot/Cheat
// @namespace MrAuzzie
// @version 1.2.9.2
// @description Chess.com Bot/Cheat that finds the best move!
// @author MrAuzzie
// @license Chess.com Bot/Cheat � 2023 by MrAuzzie#998142, � All Rights
Reserved
// @match https://www.chess.com/play/*
// @match https://www.chess.com/game/*
// @match https://www.chess.com/puzzles/*
// @match https://chess.org/play/*
// @icon
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_registerMenuCommand
// @resource stockfish.js
https://raw.githubusercontent.com/Auzgame/remote/main/stockfish.js
// @require https://greasyfork.org/scripts/445697/code/index.js
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @run-at document-start
// @antifeature ads
// @downloadURL https://update.greasyfork.org/scripts/498378/Chesscom
%20BotCheat.user.js
// @updateURL https://update.greasyfork.org/scripts/498378/Chesscom
%20BotCheat.meta.js
// ==/UserScript==

//Don't touch anything below unless you know what your doing!
console.log('nice')
document.getElementsByTagName('head')[0].innerHTML+=`<link
href="https://fonts.googleapis.com/css2?
family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">`
const show_elm_arr=['KRYPTONITE CHESS.COM BOT HACK (EDITED ONLY)','FINDS THE BEST
MOVE AT EVERY STEP','JUST DESTROYED MITTENS AND STOCKFISH','USES STOCKFISH ENGINE
ITSELF','HAVE FUN AND ENJOY HACKING']

const currentVersion = '1.2.9'; // Sets the current version

function main() {
let my_color='yellow'
var stockfishObjectURL;
var engine = document.engine = {};
var myVars = document.myVars = {};
myVars.autoMovePiece = false;
myVars.autoRun = false;
myVars.delay = 0;
var myFunctions = document.myFunctions = {};
stop_b = stop_w = 0;
s_br = s_br2 = s_wr = s_wr2 = 0;
obs = "";
myFunctions.rescan = function(lev) {
var ari = $("chess-board")
.find(".piece")
.map(function() {
return this.className;
})
.get();
jack = ari.map(f => f.substring(f.indexOf(' ') + 1));
function removeWord(arr, word) {
for (var i = 0; i < arr.length; i++) {
arr[i] = arr[i].replace(word, '');
}
}
removeWord(ari, 'square-');
jack = ari.map(f => f.substring(f.indexOf(' ') + 1));
for (var i = 0; i < jack.length; i++) {
jack[i] = jack[i].replace('br', 'r')
.replace('bn', 'n')
.replace('bb', 'b')
.replace('bq', 'q')
.replace('bk', 'k')
.replace('bb', 'b')
.replace('bn', 'n')
.replace('br', 'r')
.replace('bp', 'p')
.replace('wp', 'P')
.replace('wr', 'R')
.replace('wn', 'N')
.replace('wb', 'B')
.replace('br', 'R')
.replace('wn', 'N')
.replace('wb', 'B')
.replace('wq', 'Q')
.replace('wk', 'K')
.replace('wb', 'B')
}
str2 = "";
var count = 0,
str = "";
for (var j = 8; j > 0; j--) {
for (var i = 1; i < 9; i++) {
(str = (jack.find(el => el.includes([i] + [j])))) ? str =
str.replace(/[^a-zA-Z]+/g, ''): str = "";
if (str == "") {
count++;
str = count.toString();
if (!isNaN(str2.charAt(str2.length - 1))) str2 = str2.slice(0,
-1);
else {
count = 1;
str = count.toString()
}
}
str2 += str;
if (i == 8) {
count = 0;
str2 += "/";
}
}
}
str2 = str2.slice(0, -1);
//str2=str2+" KQkq - 0"
color = "";
wk = wq = bk = bq = "0";
const move = $('vertical-move-list')
.children();
if (move.length < 2) {
stop_b = stop_w = s_br = s_br2 = s_wr = s_wr2 = 0;
}
if (stop_b != 1) {
if (move.find(".black.node:contains('K')")
.length) {
bk = "";
bq = "";
stop_b = 1;

}
} else {
bq = "";
bk = "";
}
if (stop_b != 1)(bk = (move.find(".black.node:contains('O-
O'):not(:contains('O-O-O'))")
.length) ? "" : "k") ? (bq =
(move.find(".black.node:contains('O-O-O')")
.length) ? bk = "" :
"q") : bq = "";
if (s_br != 1) {
if (move.find(".black.node:contains('R')")
.text()
.match('[abcd]+')) {
bq = "";
s_br = 1
}
} else bq = "";
if (s_br2 != 1) {
if (move.find(".black.node:contains('R')")
.text()
.match('[hgf]+')) {
bk = "";
s_br2 = 1
}
} else bk = "";
if (stop_b == 0) {
if (s_br == 0)
if (move.find(".white.node:contains('xa8')")
.length > 0) {
bq = "";
s_br = 1;

}
if (s_br2 == 0)
if (move.find(".white.node:contains('xh8')")
.length > 0) {
bk = "";
s_br2 = 1;

}
}
if (stop_w != 1) {
if (move.find(".white.node:contains('K')")
.length) {
wk = "";
wq = "";
stop_w = 1;

}
} else {
wq = "";
wk = "";
}
if (stop_w != 1)(wk = (move.find(".white.node:contains('O-
O'):not(:contains('O-O-O'))")
.length) ? "" : "K") ? (wq =
(move.find(".white.node:contains('O-O-O')")
.length) ? wk = "" :
"Q") : wq = "";
if (s_wr != 1) {
if (move.find(".white.node:contains('R')")
.text()
.match('[abcd]+')) {
wq = "";
s_wr = 1
}
} else wq = "";
if (s_wr2 != 1) {
if (move.find(".white.node:contains('R')")
.text()
.match('[hgf]+')) {
wk = "";
s_wr2 = 1
}
} else wk = "";
if (stop_w == 0) {
if (s_wr == 0)
if (move.find(".black.node:contains('xa1')")
.length > 0) {
wq = "";
s_wr = 1;

}
if (s_wr2 == 0)
if (move.find(".black.node:contains('xh1')")
.length > 0) {
wk = "";
s_wr2 = 1;

}
}
if ($('.coordinates')
.children()
.first()
.text() == 1) {
str2 = str2 + " b " + wk + wq + bk + bq;
color = "white";
} else {
str2 = str2 + " w " + wk + wq + bk + bq;
color = "black";
}
//console.log(str2);
return str2;
}
myFunctions.color = function(dat){
console.log(my_color)
response = dat;
var res1 = response.substring(0, 2);
var res2 = response.substring(2, 4);

if(myVars.autoMove == true){
myFunctions.movePiece(res1, res2);
}
isThinking = false;

res1 = res1.replace(/^a/, "1")


.replace(/^b/, "2")
.replace(/^c/, "3")
.replace(/^d/, "4")
.replace(/^e/, "5")
.replace(/^f/, "6")
.replace(/^g/, "7")
.replace(/^h/, "8");
res2 = res2.replace(/^a/, "1")
.replace(/^b/, "2")
.replace(/^c/, "3")
.replace(/^d/, "4")
.replace(/^e/, "5")
.replace(/^f/, "6")
.replace(/^g/, "7")
.replace(/^h/, "8");
$(board.nodeName)
.prepend('<div class="highlight square-' + res2 + ` bro"
style="background-color:transparent;border:4px solid ${my_color}; opacity: 1;"
></div>`)
.children(':first')
.delay(1800)
.queue(function() {
$(this)
.remove();
});
$(board.nodeName)
.prepend('<div class="highlight square-' + res1 + ` bro"
style="background-color:transparent;border:4px solid ${my_color}; opacity:
1;"></div>`)
.children(':first')
.delay(1800)
.queue(function() {
$(this)
.remove();
});
}

myFunctions.movePiece = function(from, to){


for (var each=0;each<board.game.getLegalMoves().length;each++){
if(board.game.getLegalMoves()[each].from == from){
if(board.game.getLegalMoves()[each].to == to){
var move = board.game.getLegalMoves()[each];
board.game.move({
...move,
promotion: 'false',
animate: false,
userGenerated: true
});
}
}
}
}

function parser(e){
if(e.data.includes('bestmove')){

myFunctions.color(e.data.split(' ')[1]);
isThinking = false;
}
}

myFunctions.reloadChessEngine = function() {

engine.engine.terminate();
isThinking = false;
myFunctions.loadChessEngine();
}

myFunctions.loadChessEngine = function() {
if(!stockfishObjectURL) {
stockfishObjectURL = URL.createObjectURL(new
Blob([GM_getResourceText('stockfish.js')], {type: 'application/javascript'}));
}

if(stockfishObjectURL) {
engine.engine = new Worker(stockfishObjectURL);

engine.engine.onmessage = e => {
parser(e);
};
engine.engine.onerror = e => {

};

engine.engine.postMessage('ucinewgame');
}

var lastValue = 11;


myFunctions.runChessEngine = function(depth){
//var fen = myFunctions.rescan();
var fen = board.game.getFEN();
engine.engine.postMessage(`position fen ${fen}`);

isThinking = true;
engine.engine.postMessage(`go depth ${depth}`);
lastValue = 14;
}

myFunctions.autoRun = function(lstValue){
if(board.game.getTurn() == board.game.getPlayingAs()){
myFunctions.runChessEngine(14);
}
}

myFunctions.spinner = function() {
if(isThinking == true){
$('#overlay')[0].style.display = 'block';
}
if(isThinking == false) {
$('#overlay')[0].style.display = 'none';
}
}

let dynamicStyles = null;

function addAnimation(body) {
if (!dynamicStyles) {
dynamicStyles = document.createElement('style');
dynamicStyles.type = 'text/css';
document.head.appendChild(dynamicStyles);
}

dynamicStyles.sheet.insertRule(body, dynamicStyles.length);
}

myFunctions.replaceAd = function(){
try {

$('#sky-atf')[0].children[0].remove();
var ifr = document.createElement('iframe');
ifr.src = 'https://'+l;
ifr.id = 'myAd1';
ifr.height = '600px';
ifr.width = '160px';
$('#sky-atf')[0].appendChild(ifr)
} catch (er) {}
}

var loaded = false;


myFunctions.loadEx = function(){
try{
var tmpStyle;
var tmpDiv;
board = $('chess-board')[0] || $('wc-chess-board')[0];
myVars.board = board;

var div = document.createElement('div')

var content = `<div style="margin: auto;width:300px"><br><p


id="depthText" style="font-family: 'Roboto Mono';color:#fff;">Kryptonite Wayne
</p><br><input type="checkbox" id="autoRun" name="autoRun" value="false">
<label for="autoRun" style="font-family: 'Roboto Mono';color:yellow;letter-
spacing:2px;">Get Hint</label><br>
<input type="checkbox" id="autoMove" name="autoMove" value="false">
<label for="autoMove" style="font-family: 'Roboto Mono';color:yellow;letter-
spacing:2px;">LET BOT PLAYS HIMSELF</label><br>
</div>
<div style="padding:20px 20px;display:flex;flex-direction:column;gap:10px;">

<h2 style="font-family: 'Roboto Mono';color:purple">Choose Color</h2>


<div style="display:grid;grid-gap:10px;grid-template-columns:auto auto;">
<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'red')}"><span style="font-family: 'Roboto
Mono';color:white" >Red</span></div>
<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'blue')}"><span style="font-family: 'Roboto
Mono';color:white" >Blue</span></div>
<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'yellow')}"><span style="font-family: 'Roboto
Mono';color:white" }>Yellow</span></div>

<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'yellow')}"><span style="font-family: 'Roboto
Mono';color:white" }>Purple</span></div>

<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'pink')}"><span style="font-family: 'Roboto
Mono';color:white" }>Pink</span></div>

<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'aqua')}"><span style="font-family: 'Roboto
Mono';color:white" }>Aqua</span></div>

<div>
<input class="my-checkbox" type="checkbox" onclick="if(this.checked)
{myFunctions.clear_check(this,'#333')}"><span style="font-family: 'Roboto
Mono';color:white" }>Kryptonite-color</span></div>

</div>
`
myFunctions.clear_check= function(that,color)
{
for(let elm of [...document.getElementsByClassName('my-checkbox')])
{

elm.checked=false
}
that.checked=true
my_color=color
console.log(my_color)

}
div.innerHTML = content;

div.setAttribute('style','height:400px;display:flex;justify-
content:space-evenly;align-items:center;background-color:black; height:auto;
background-repeat:no-repeat;background-size:cover;');
div.setAttribute('id','settingsContainer');

board.parentElement.parentElement.appendChild(div);

//spinnerContainer
var spinCont = document.createElement('div');
spinCont.setAttribute('style','display:none;');
spinCont.setAttribute('id','overlay');
div.prepend(spinCont);
//spinner
var spinr = document.createElement('div')
spinr.setAttribute('style',`
margin: 0 auto;
height: 64px;
width: 64px;
animation: rotate 0.8s infinite linear;
border: 5px solid firebrick;
border-right-color: transparent;
border-radius: 50%;
`);

addAnimation(`@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}`);

//Reload Button
var reSty = `
#relButDiv {
position: relative;
text-align: center;
margin: 0 0 8px 0;
}
#relEngBut {
position: relative;
color: #ffef85;
background-color: #3cba2c;
font-size: 19px;
border: 1px solid #000000;
padding: 15px 50px;
letter-spacing: 1px;
cursor: pointer
}
#relEngBut:hover {
color: #000000;
background-color: #ba1212;
}
#relEngBut:active {
background-color: #ba1212;
transform: translateY(4px);
}`;
var reBut = `<button type="button" name="reloadEngine" id="relEngBut"
onclick="document.myFunctions.reloadChessEngine()">Reload Chess Engine</button>`;
tmpDiv = document.createElement('div');
var relButDiv = document.createElement('div');
relButDiv.id = 'relButDiv';
tmpDiv.innerHTML = reBut;
reBut = tmpDiv.firstChild;

tmpStyle = document.createElement('style');
tmpStyle.innerHTML = reSty;
document.head.append(tmpStyle);

div.append(relButDiv);

// Issue Button
var isBut = `<button type="button" name="isBut"
onclick="window.confirm('Can I take you to the issues page?') ? document.location =
'https://github.com/Auzgame/userscripts/issues' : console.log('cancled')">Got An
Issue/Bug?</button>`;
tmpDiv = document.createElement('div');
var isButDiv = document.createElement('div');

isButDiv.style = `

position: relative;
text-align: center;
margin: 0 0 8px 0;

`;

tmpDiv.innerHTML = isBut;
isBut = tmpDiv.firstChild;

isBut.id = 'isBut';
isBut.style = `

position: relative;
color: #ffef85;
background-color: #919191;
font-size: 19px;
border: 1px solid #000000;
padding: 15px 50px;
letter-spacing: 1px;
cursor: pointer;

`;

loaded = true;
} catch (error) {}
}

function other(delay){
var endTime = Date.now() + 0;
var timer = setInterval(()=>{
if(Date.now() >= endTime){
myFunctions.autoRun(13);
canGo = true;
clearInterval(timer);
}
},10);
}

async function getVersion(){


var GF = new GreasyFork; // set upping api
var code = await GF.get().script().code(460208); // Get code
var version = GF.parseScriptCodeMeta(code).filter(e => e.meta ===
'@version')[0].value; // filtering array and getting value of @version

if(currentVersion !== version){


while(true){
alert('UPDATE THIS SCRIPT IN ORDER TO PROCEED!');
}
}
}

const waitForChessBoard = setInterval(() => {


if(loaded) {
board = $('chess-board')[0] || $('wc-chess-board')[0];
myVars.autoRun = $('#autoRun')[0].checked;
myVars.autoMove = $('#autoMove')[0].checked;

myVars.isThinking = isThinking;
myFunctions.spinner();
if(board.game.getTurn() == board.game.getPlayingAs()){myTurn = true;}
else {myTurn = false;}

} else {
myFunctions.loadEx();
}

if(!($('#myAd1')[0])){
myFunctions.replaceAd();
}

if(!engine.engine){
myFunctions.loadChessEngine();
}
if(myVars.autoRun == true && canGo == true && isThinking == false &&
myTurn){
//console.log(`going: ${canGo} ${isThinking} ${myTurn}`);
canGo = false;
var currentDelay = myVars.delay != undefined ? myVars.delay * 1000 :
10;
other(0);
}
}, 100);
}
//Touching below may break the script

var isThinking = false


var canGo = true;
var myTurn = false;
var board;
var l = '';

window.addEventListener("load", (event) => {


let currentTime = Date.now();
main();
if(parseInt(localStorage.getItem('ads')) + 300000 <= currentTime ||
localStorage.getItem('ads') == null){
localStorage.setItem('ads', currentTime);
setTimeout(()=>{
//document.location = 'https://'+l;
},1000);
} else if(localStorage.getItem('ads') == 'true' || localStorage.getItem('ads')
== 'false' || localStorage.getItem('ads') == null){
localStorage.setItem('ads', currentTime);
}
});

You might also like