Posts

Showing posts from 2016

The Whole Lot

Previous Games: In this post, I will list all the games and a utility program that I have written till now.By that i mean to say , all the programs that are almost complete (except 1).However it will not include the code that i wrote for testing the programs, the codes that I wrote while practicing various concepts for  OCPJP 7 or codes from competetive programming(because that alone will make more than 200 files.) So , here we go :- QBASIC: These are my most notable programs in Qbasic.For all of them, paste the folders/ files in the Qb64 file location and then open the .bas file in the IDE and run. Ping pong  ~~> This was the first game that I wrote, or indeed, the first program that was more than      30 lines of code.The whole game was written entirely in pen and paper.The only minor problem is that the collision detection is not really that good.Also , understanding the code is quite difficult. Records  ~~>  This i...

The AI

Image
Min-Max: The AI of the chess engine is actually the min-max algorithm along with some optimizations.I will give certain links for a detailed explanation at the end of this blog but for now i will try to explain it for anyone who does not have even the basic knowledge of graph theory.However recursion is a prerequisite.(Of course, someone with no graph theory knowledge will find it a little difficult, so i suggest that you read the basics , and DFS and BFS. Really, nothing more is required.) Let's say we have a position where white has certain moves(assuming it is white two play).Now, here I should mention that 1 move is actually divided into two ply ,one of white and one for black. Now what min-max does is that we play every move that is possible for white!And then, for every one of the arising positions,we play every move for black!And this goes on as a cycle.I know, this may sound time consuming and dumb as every chess player knows(myself included,being a tournament player ...

The Move Class

The Move class is probably the only class ( except the classes of the evaluation  package) that I have had to change so many times. The Move  class basically encapsulates the following details: Location from Location to Piece movingPiece Piece capturedPiece ~~> Null if nothing has been captured. More about it in MoveType MoveType type int searchVal ~~> This is for sorting the moves after generating them based on some static features. At first, there were only the aforementioned variables and there getters and setters.However, there were several difficulties.First and foremost was that this representation was not suitable for castling moves. So, I made an enum called MoveType. There are 7 move catagories  Normal ~~> just plain moves Capture ~~> capturing moves ShortCastle_White LongCastle_White ShortCastle_Black LongCastle_Black EnPassent Initially ,   having just learnt enums to quite a extent for the OCP exam, I was real...

The Backbone Class ~~> Board Class

BOARD : The board is a simply represented by an array of Spots .  The Spot class performs the basic operations of changing the locations of the pieces through the functions occupy() and vacate().  It also has a couple of other methods like checking if it isOccupied() etc. This brings us to another important class .. Location . I had built this program not for commercial usage and so playing excellent was not a criteria(although it can beat a fritz at 1700-1850 rating ). The location class encapsulates the row and column position of each piece and also helps in easier manipulation as it has a couple of in-built methods. Some of the important methods of the board class are:-   void addPiece(Piece piece,Location l); -- this method adds a piece to the board  void executeMove(Move move); -- makes a move.This move further calls two other methods   a) void executeIndividualMove(Move move)                 ...

Chess Engine version 7.0 is now out to public !!

Updates: Core :: The latest upgrade is that the en-passant move has now been included.The main problem previously was that when undoing the move,the captured piece was being placed in another location as was the case with normal captures. However, with a new MoveType (which surprisingly has been named "EN_PASSENT"), and with a new executeEnpassentMove(Move move) {...} and the corresponding undoEnpassentMove(Move move){...} methods, the problem has been resolved :). It now follows all FIDE rules of chess. Along with it,stalemate detection has been included. When detected in the negamax(){/*Search Function*/}, it simply returns a '0' value as the eval rating of the position. Also ,when there is a mate,the alpha value is increased by the remaining depth, so that quicker mates get higher priority. GUI :: The notification panel now shows whose move it is. Also, the pieces cannot be moved anymore during the computer's move. Here is the link for ...
I started working on a chess engine from September 2015 and that was version 1 Now it is at version 6.0 I made a change in the ordering of the moves before the actually calculating the moves. Earlier the preference of moves was mainly based on the pieces but now another factor has been added based on the move type (eg capture,castle etc.). This has greatly increased number of the alpha beta cutoffs and hence speed has greatly increased. Get the latest version  here .However ,only limitation is there is no en-passent :(.
Hello Everyone.. I am Rajokanth! Get Tetris Here