|All you gotta do is recognize the problem and then solve it
(31 Jan 2019 at 22:39)
|OK, so I think I have five SIGBOVIK papers about chess, which is pretty over the top, but at least I can get it all out of my system. If you like, you can help me out: Today I'm on the lookout for a collection of easy to describe algorithms for playing chess. Some constraints: They should be basically symmetric when playing as white or black (so not like, "move pieces to the 1st rank" but "move pieces as far from their starting squares as possible"). They do not need to be good at chess, and in some ways it's better if they're not, although it's not good if they just get stuck in loops like moving the same piece back and forth. They have to be efficient enough to compute a move in a few seconds. Most importantly, it should have a one or two-sentence description which pretty much communicates the whole idea without important ambiguity. Alpha-beta and that kind of thing I already know about; novel approaches are most desirable here.|
Aside from the bracing cold, which you can just read about in the news, I'm nearly done with a game called Hollow Knight. It's really good, definitely the kind of artful indie game I was yearning for when I deleted Battlefield V shortly after writing last month's post, and I super recommend it. And also in quick turnarounds from last month's dreary post news, a day later or so I figured out the thing that had me stuck on that machine learning problem (it was basically just NaN poisoning) and now the only problem I have left is that machine learning isn't magic. But I guess things are looking up on multiple counts!
That is all!
|Here's one chess strategy (The Equalizer): Favor moving pieces that have moved fewer times to the squares that have received fewer of your movements. As a side effect, castling is a very desirable move.|
|Given a list of potential moves and numerical ratings of each, boost the ranking of one piece, eg knight moves always seem better than they are, or one move gets a random boost.
Make the move with the lexicographically least (or most) code in chess notation, eg a3 < O-O-O < Nc3 < Rf8. Variations can be made by renaming pieces, ranks and files.
Apply any strategy, but only move pieces adjacent to knights of either color.
Apply any strategy, but only move pieces whose square color is the same (or opposite) color where most of your (their, all) pieces are sitting, eg most of white's pieces are on black squares so white moves a piece on a black square.
Place Langton's ant on the chessboard. Iterate until the ant is on a square occupied by a chess piece which has a valid move and move that piece. Continue iterating the ant to locate the next piece to be moved. Restrict the ant to the bounds of the chessboard (identified as a torus or klein bottle) if necessary. Bonus: the ant respects the chessboard colors and changes them and the choice of move takes square color into account.
Long time listener, first time caller. This exercise is really fun, so I set a limit to five suggestions when I started. I hope you use or have already thought of one of these!
|. Move to maximize the total number of squares controlled by your pieces.
. (Too obvious?) Maximize the number of 'points' you have, where pawn = 1, knight = 3, etc.
. Move so as to maximize the number of times the board position has appeared in previous games at chessgames.com
. Move so as to increase the symmetry of the board (under the action of switching the white and black pieces)
|> get it all out of my system
Inded, you have to get it out of your system. There's been four chess-related entries on IOCCC already: a C program that plays chess against the user, another C program that plays chess against the user but with a GUI, a C program that plays suicide chess, and a 6502 emulator in C with a chess program for 6502 given as an example use. It'd be very hard to win with another chess-related entry.
|Move the piece that can get closest to an opposing piece (hopefully on top). Since there's sure to be lots of ties, from those choose the piece that is currently the furthest to move.