If you're planning on teaching a computer to play chess, it is often helpful to start off with the building block of the AI, also known as chess board representation. This is a program which is able to keep track of the state of the game as well as to provide the basis for further position evaluation. There are a number of different programming languages, libraries and software applications which are thought to be good for building computer chess programs. Python is usually the most loved language among data scientists, but I decided to write my own chess board representation with PHP from scratch since I spotted an opportunity to do something new in the PHP community. It'd be nice if a chess library like python-chess could be available in PHP too, I thought.
The basic paradigm that computer programs employ is known as "search and evaluate." Their static evaluation is arguably more primitive than the perceptual one of humans. Yet the intelligence emerging from them is phenomenal. A human spectator is not able to tell the difference between a brilliant computer game and one played by Kasparov. Chess played by today's machines looks extraordinary, full of imagination and creativity.
We present an end-to-end learning method for chess, relying on deep neural networks. Without any a priori knowledge, in particular without any knowledge regarding the rules of chess, a deep neural network is trained using a combination of unsupervised pretraining and supervised training. The unsupervised training extracts high level features from a given position, and the supervised training learns to compare two chess positions and select the more favorable one. The training relies entirely on datasets of several million chess games, and no further domain specific knowledge is incorporated. The experiments show that the resulting neural network (referred to as DeepChess) is on a par with state-of-the-art chess playing programs, which have been developed through many years of manual feature selection and tuning. DeepChess is the first end-to-end machine learning-based method that results in a grandmaster-level chess playing performance.