Wednesday, 4 December 2013

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.
Bit Manipulation
     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.
Board Generation
     The chess board's initial position will be recorded here.  This will include chess960 positions randomly generated as well.
Move Possibilities
     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.
King Safety
     The safety of the king of a particular side will be evaluated in order to detect illegal moves.
Move Ordering
     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.