Posts

Showing posts from February, 2018

How I write a chess engine [Part 1]

Image
    I was interested in chess lately.     Actually I'm not good at playing chess but I'm curious about the way computer solves it and defeats human.     In this series, I will go through 3 most important parts to build a chess engine: Graph algorithm, evaluation function and the last part, chess interface. I will use Go as the implementation since it's fast and easy to write.     This post, I'm going to implement the first part of a chess engine: The algorithm on graph.     Table of contents Graph - how does chess look like in computer memory The minimax algorithm Optimizations Conclusion and references 1. Graph - how does chess look like in computer memory     Computer thinks of chess as states, each state is a board where pieces are placed. Each move changes from one state to another, constructs a graph. From one state, players may have plenty ways to make a move, expands the graph t...