Monday, May 6, 2013

Chess.com Engine

I'm sure the admins and mods at Chess.com periodically scour Google for amateurs that make engines for their precious site, which can be a nuisance for others since you can utterly destroy anyone (even GrandMasters using a simple engine).  Hopefully they won't change their site so that this engine won't work anymore.  To make it just a tad harder for them, I won't release the source code -- don't worry, it's not because I don't like you guys!

I'm not going to make a release version at this point, since I'm too lazy and bogged down by other things to do, so you're going to have to bear with me on this one.  Fortunately for you, it's really easy, and doesn't require much skill at all to use.  You can master the art of engine-using much faster than you can master the art of chess.  Trust me on this one.

There are a ton of buttons on the thing, as you will soon see below, but never fear, you really only need one or two buttons, possibly three if you're adventurous.


Basically, all you have to do is open up the screen where you play Live Chess (see the screenshot below) click "auto detect".  If you're using the same laptop screen size as me (1366 x 768), then you don't have to do anything else.  Otherwise, you have to change the board size such that each square takes exactly 60 pixels.  It's probably a board size of "Large" under the "Settings" menu if you have a larger screen on an awesome laptop or a desktop monitor.  To measure the square size, just take a screenshot and paste it into paint or some other image editor and manually measure the size.  It shouldn't be that hard.


Now, just play against someone, and when you get into a game, click the "auto play" button in the middle of the program.  A box should pop up asking you for two parameters:  the first is how many moves the program should make, so put in a large number so you can finish the game (i.e. 9876 or 5586); and the second is how many milliseconds the engine gets to think before making a move (longer think times means slower play, so for 1 min Bullet chess, 100 to 200 is a good range).

It will automatically detect whether you are black or white and play accordingly, so don't move the mouse too much or close the window (obviously).  You can click inside the chat box if you're quick and then type snarky remarks to your opponent as you stomp him while chatting.  This is OK, since the keyboard input doesn't really interrupt the engine at all.

There are a few other things that are useful to know, but not necessary.

The "TopMost" checkbox ensures that the program is at the front of all your windows, which is nice so you can see it while it's running.  You should leave this checked, generally speaking.

The "chkWhite" checkbox tells the program whether or not you are playing White, and is now deprecated since "auto play" does it automatically.  Don't touch this unless you REALLY know what you're doing.

The "HumanLike" checkbox makes the program play slightly more HumanLike in Bullet timings, like taking a bit longer to make moves every once in a while.  It's not very well done, so you can play with it if you like.

The "Random" checkbox makes the program do a random first move if you're White instead of the standard King's pawn e2e4 opening.  I think it's pretty fun to do something totally random but know that you're going to win regardless!

Now, what sets this program apart from other programs is full automation.  This feature is currently somewhat unstable, especially if you have a slow computer.  The requirement is that your screen size is exactly the same as mine, and would best if you had Windows 8 and Google Chrome.  It'll probably work with other software, but the screen size is a must.  Again, it's 1366 x 768.  You can probably change your larger screen to fit this size, and then the engine would work, but it will make things appear large and possibly blurry.  You can do this in Windows by right-clicking on the desktop and going to "Screen Resolution".  Using this resolution, you have to set the "Board Size" setting on Chess.com to "Extra Large", which is the default setting when you make a new account.

Once you get things set up, you need to click "auto detect".  Note that you HAVE to click this button every time you start the program or things will go horribly wrong.  Then you click "new game" and a box with five inputs will show up.  The first is the number of moves per game, and again put a large number.  The second is wait time, so fill it out according to the time you have per game.  The third is how many games to play.  You can do a few to test it out or put in a large number and go out to lunch, coming back to find out that you are now 2000+ ELO.  The fourth is something you want to say to your opponents at the start of each game, like "You are going to lose" or something, and the last is something to say at the end, like "GG EZ" or something.  Of course you could say something nice and try to sound like a human and less like an engine.

And there you go!  It'll keep playing those games, winning them all, and getting you free ELO (or FREELO).  One thing to remember is, you need to close all other active games and games you were following, or they will interfere with the automation.

A few things to note.  The only operating systems supported are Windows 7 and Windows 8, and both have to be 64-bit (most are anyway).  Vista 64-bit might work, but nobody uses that so I have no idea.  Mac OSX and all distros of Linux are not supported.  Premium accounts may or may not work, I'm not sure since I most definitely do not have one.  Sorry guys!  If you get some message saying that your .NET is not up-to-date, you should probably update it.  I keep all this stuff super up-to-date and have the latest versions of most things, so you can update yours here.  It's probably useful to update anyway -- might come in handy in the future.  It's also best if you full-screen Chrome, and make sure that the program's window doesn't cover the Chess board.  It will hijack your mouse while playing, so don't try to resist.  Just relax and let it take control...

If it still doesn't work, you can comment and I will try to help you, but this project is not very refined yet, and was originally a personal thing.

Here's the link, I hope you enjoy!  But one final note: you should probably make another account to do this instead of your main account, especially if you have a premium.  You will get banned if you make it above 2000 ELO and play notoriously.  Also, if you constantly beat on the Computer4-IMPOSSIBLE, you will probably get banned, too.  Also, if you make a new account, winning gives you more ELO, so you can get to 2500 ELO even faster, probably only takes a few hours, like while you are sleeping.

And now, finally -- here's the link, for real this time!


One final thing (sorry!), make sure you keep the three files together, there aren't many customization options right now.  Run ChessMaster.exe to open the program.  The other files are used by the main program.