So here is my plan. Since C++ is an object oriented programming language, my engine will be comprised of several objects/classes. The classes can be described as follows:7
This is where my engine will communicate with a separate gui that I will write for now. Later on I hope to make my engine UCI compatible.
This class will hold all the global variables and structs that are shared in common between the objects. The format of the chess board, for instance, will be declared in the header class.
Like header, this class will hold functions that are common between many of the other classes. However, it will contain methods with a common theme of bits such as counting the number of true bits in a bitboard.
This is the main 'hub' and central control centre of everything that my engine does. Main will receive moves from the user and get response moves from other classes. It will also store previous moves made, and miscellaneous other stuff.
The chess board's initial position will be recorded here. This will include chess960 positions randomly generated as well.
In this class, pseudo-legal moves will be generated. Pseudo-legal moves are moves which ignore king safety. Therefore, there will always be pseudo-legal moves even in a checkmate position. Illegal moves will be eliminated later in the search function.
The safety of the king of a particular side will be evaluated in order to detect illegal moves.
In order to make the alpha-beta search function faster, the best move should be searched near the beginning. This requires sorting the moves in order of likelihood of being the best move.
Here is where the search process will take place. The engine will "look ahead" at certain lines of thought and decide which move it should make. This class will also include extensions and null-move pruning.
Evaluation Here is where Orion will statically evaluate positions. It will look at material, pawn structure, tactical positioning, and much more. This class may eventually be split into three parts: opening, middlegame, and endgame evaluations. The reasons for this will be discussed later on.
Here is where Orion will search opening and perhaps endgame books. For now I plan to use the pgn format for my books, although I might also include polyglot books later on.
Standard Algebraic Notation
In order to read pgn books as well as to communicate with the UCI protocol and the user, this class will interpret the moves it makes into SA notation.
Hash maps will be pruned, maintained, and sorted here.
In order to use hash maps, Orion will need to create, as nearly as possible, a unique key for each board position using random numbers XOR'd together. I'll explain more when we get to this part.
There will probably be a few changes to this tentative plan in the future. This is only an outline of what I have planned in my head. I look forward to see how all of this will turn out. Stay tuned.
Wednesday, 10 April 2013
Well, Orion is the first chess engine that I have created which plays a reasonable game of chess. I came up with its name from the constellation Orion. This constellation's two brightest stars are Alpha and Beta which is very appropriate for my engine due to its use of the alpha-beta algorithm. It is also a very bright constellation despite being one of the furthest away from us.
Orion uses bitboards (64 bit, signed integers) (U64). It is written in C++, and has its own user interface. I hope to someday add uci support for it as well. This engine is still in the early stages of development which prohibits me from commenting on its playing style. Currently, I would say that it plays very theoretically, but this could change.
Orion uses iterative deepening, hash maps, and quiescence searching. I would like to add null-moves as well when my engine is more developed. Currently, I am working on the rating system. I am constantly trying new ideas and weighing the time that those methods take with the improvement that they provide. It is a constant struggle of balance.
Wednesday, 27 March 2013
Well, here goes nothing... This is my first post welcoming you to a blog featuring my very own Java chess engine by the name of Orion. It is currently a lot smarter than I am, which doesn't mean much by the way :).
This blog is dedicated to providing a detailed and hopefully understandable, description of the inner workings and accomplishments of Orion. This content will aim at being applicable to chess engines in general.