• Content count

  • Joined

  • Last visited

Community Reputation

166 Neutral

About ashish123

  • Rank
  1. UCI based chess Engine : Some questions.

    Thanks for the reply.   I setup this position r1bqkb1r/1p1p1ppp/p1n1p1n1/4P3/2B5/2N2N2/PP3PPP/R1BQR1K1 b kq - 0 9   In the first round, I didnot search in QSearch as the condition ply>=maxPly would fail and it wouldn't proceed with generation of Capture moves.   In the second round I added Qsearch with addition of 5 plys to search. So if at depth 5 it went to QSearch then it would search in Qsearch for 5+5 = 10 plys.   and got the following results on the first day and I also noted that my machine (Dell Studio Laptop was heated up pretty much).   Without QSearch. [table] [tr] [td]Depth[/td] [td]Nodes[/td] [td]Time(msecs)[/td] [td]kNodes/Sec[/td] [/tr] [tr] [td]1[/td] [td]36[/td] [td]131[/td] [td]0.27[/td] [/tr] [tr] [td]2[/td] [td]1757[/td] [td]160[/td] [td]10.98[/td] [/tr] [tr] [td]3[/td] [td]7689[/td] [td]336[/td] [td]22.88[/td] [/tr] [tr] [td]4[/td] [td]136953[/td] [td]2743[/td] [td]49.92[/td] [/tr] [tr] [td]5[/td] [td]604808[/td] [td]17768[/td] [td]34.039[/td] [/tr] [tr] [td]6[/td] [td]11339038[/td] [td]207256[/td] [td]54.71[/td] [/tr] [/table]   With QSearch [table] [tr] [td]Depth[/td] [td]Nodes[/td] [td]Time(msecs)[/td] [td]kNodes/Sec[/td] [/tr] [tr] [td]1[/td] [td]1087[/td] [td]239[/td] [td]4.54[/td] [/tr] [tr] [td]2[/td] [td]13289[/td] [td]543[/td] [td]24.47[/td] [/tr] [tr] [td]3[/td] [td]103435[/td] [td]2864[/td] [td]36.11[/td] [/tr] [tr] [td]4[/td] [td]1313863[/td] [td]28137[/td] [td]46.49[/td] [/tr] [tr] [td]5[/td] [td]7980765[/td] [td]175669[/td] [td]45.43[/td] [/tr] [tr] [td]6[/td] [td]57394529[/td] [td]1266073[/td] [td]45.33[/td] [/tr] [/table]         Here are the results after second day when laptop didn't heat up much. Without QSearch. [table] [tr] [td]Depth[/td] [td]Nodes[/td] [td]Time(msecs)[/td] [td]kNodes/Sec[/td] [/tr] [tr] [td]1[/td] [td]36[/td] [td]16[/td] [td]2.25[/td] [/tr] [tr] [td]2[/td] [td]1757[/td] [td]19[/td] [td]92.47[/td] [/tr] [tr] [td]3[/td] [td]7689[/td] [td]37[/td] [td]207.81[/td] [/tr] [tr] [td]4[/td] [td]136953[/td] [td]288[/td] [td]475.53[/td] [/tr] [tr] [td]5[/td] [td]604808[/td] [td]1742[/td] [td]347.19[/td] [/tr] [/table]   With QSearch [table] [tr] [td]Depth[/td] [td]Nodes[/td] [td]Time(msecs)[/td] [td]kNodes/Sec[/td] [/tr] [tr] [td]1[/td] [td]1087[/td] [td]17[/td] [td]63.94[/td] [/tr] [tr] [td]2[/td] [td]13289[/td] [td]43[/td] [td]309.04[/td] [/tr] [tr] [td]3[/td] [td]103435[/td] [td]242[/td] [td]427.41[/td] [/tr] [tr] [td]4[/td] [td]1313863[/td] [td]2715[/td] [td]483.92[/td] [/tr] [tr] [td]5[/td] [td]7980765[/td] [td]17249[/td] [td]462.67[/td] [/tr] [/table]   I think this is a hardware + programming efficiency issue. Please comment as to how can I improvise this.
  2. UCI based chess Engine : Some questions.

    Thanks for replying. Can you comment on the speed of  the engine when it take max 30 secs to play a move at 5 plys and further 5 plies at QSearch(Without MVV/LVA or any sorting). I asked you this as I would like to know if I don't have anything terribly wrong going on. I ran perft suite as my unit test suite, had no findings. I think I have messed up some where in make moves that come from GUI through UCI protocol. May be its missing some checks and other feature. I would check on those by printing some display boards. 
  3. UCI based chess Engine : Some questions.

    Hi alvaro, thanks for replying. I implemented the move logic without considering 3 move repetitions which is going to be my next priority.   Here is a game that it played at maxDepth 5 without any sophistication not even killers or anything of that sort, plain alpha beta with very crude static evaluation. it took about 15 secs to make a move on an average.   Here is the first game where it played with white. 1. d4 e6 2. e4 Nc6 3. Nc3 Bb4 4. Nf3 Nf6 5. e5 Ne4 6. Bd2 Nxd2 7. Qxd2 O-O 8. Bb5 d5 9. Bxc6 bxc6 10. O-O-O Bb7 11. Rhe1 a5 12. g4 f6 13. g5 fxe5 14. Nxe5 Bd6 15. a3 g6 16. f4 a4 17. h3 Qe7 18. h4 Qg7 19. Qe3 Rfe8 20. Ng4 Kf8 21. Kb1 Re7 22. Qf2 Qh8 23. Qf3 Qg7 24. Qf2 Qh8 25. Qf3 Qg7 26. Qf2 {3-fold repetition} 1/2-1/2   Here is the second game, playing with black.   1. g3 d5 2. Nf3 e6 3. Nc3 d4 4. Nb5 Nc6 5. e3 e5 6. exd4 exd4 7. c3 Bg4 8. Qe2+ Be7 9. Nbxd4 Nxd4 10. cxd4 c6 11. Bg2 Bxf3 12. Bxf3 Qxd4 13. Qe3 O-O-O 14. Qxd4 Rxd4 15. h4 Nf6 16. b3 Rhd8 17. a4 Bb4 18. Ra2 Rd3 19. Bd1 Ne4 20. Bg4+ Kb8 21. Bf5 Re8 22. O-O Bc5 23. Kg2 Rxb3 24. Bxh7 g6 25. Re1 Bxf2 26. Rxe4 Rxe4 27. Kxf2 Rd3 28. Bg8 f5 29. Bh7 Rc4 30. Ra1 Rg4 31. h5 Rgxg3 32. hxg6 Rg4 33. Ke2 Rd5 34. a5 Re5+ 35. Kf3 Rd5 36. Bg8 Rd6 37. Bf7 a6 38. Ra3 Rg1 39. Rc3 Rd8 40. d3 Rf1+ 41. Kg2 Re1 42. Kf2 Rh1 43. Bf4+ Ka8 44. g7 Rh4 45. Bc7 Rc8 46. g8=Q Rh2+ 47. Bxh2 b6 48. Qxc8 {Arena Adjudication. Illegal move!} 1-0   There was a time when I actually thought that my program was pressing the game, but then as it is clear from the game, I have messed up with some move making issues which as of now I would be checking.    
  4. UCI based chess Engine : Some questions.

    Hi all, Thanks for replying.   I faced this question as I programmed by Engine to setup board via FEN and not by move input. I don't really keep track of game specs like castling and enpassant squares on move by move basis, but rather break the fen and adjust all parameters accordingly.   I am using Arena as GUI. Is there any setting where in I can just tweak it to send me the FEN instead of moves, but then again I wouldn't be able to keep track of 3-repetition draws.   If I go with the move approach, then I have to convert the physical move to logical 64 bit-bit-board move, adjust all the flags and so on. So is this worth or is there anything else which I am missing.
  5. I have coded a chess engine in C# which has no sophisticated features. I have just done with mate detection and some crude static evaluation. I am trying to make it UCI compatible, but then I am facing a question as to why the protocol returns the list of moves rather than the fen of the new position.   I mean the list of moves will take more time to execute and the space required is also more than equivalent FEN string. Can any one help me with this?      
  6. Chess Programing: Request for Code Review.

    So you were getting 4 plys in 4 or 5 minutes, when it should have taken a fraction of a second. Then you must have decided that the problem was the board representation, but this is not correct. You can make 0x88-based engines that are really fast. You are reading too much into my post. I was just pointing out that you are going about this the wrong way, and you shouldn't try to optimize the speed of perft. You should find out why your engine was taking minutes to reach 4 plys. Dynamic memory allocation is an obvious thing to get rid of, but I guess you were doing something else completely wrong.   Yes, its just that I have lost the code, so as it is I was trying to code something new. I have never felt or mentioned that 0x88 engines are slow or something like that. The main reason of shifting to bitboards was the thrill. The thrill in representing entire chess board in just one unsigned long. Another reason for myt 0x88 engine was slow because I scanned for material (looped the board) everytime, rather I could just keep count and so on.. 0x88 is an excellent scheme for representation (at first I was pleasantly surprised with the idea alone of sq&0x88.) Ok then I think I should go on writing this as complete chess engine and then come back for optimization.    PS: Its just that I am not schooled formally in computer, I developed liking for computers and studied through books like Introduction to Algorithms during spare time. So there might me some issues with the way I think. I hope I am not asking too much.   Thanks.
  7. Chess Programing: Request for Code Review.

    @Alvaro: Thanks for replying. I have written two chess engines when I first began to code about year ago.  Both were 0x88 based and I wasnt pleased with the performance I got from them (4 plys in about 4-5 mins). The first one was horrible, it took 3 hours just to generate moves for 6 plys. later on I found that the bottle neck was the dynamic memory allocation. The second one was quiet good but then my disk crashed and I lost the source.  This is the third one, but my first one using bit boards.   My idea beyond making a fast perft was some thing like, "If I can get around 2MNPS in perft, they would trim down to 1.5 or 1 MNPS with the evaluation and decision making. So the faster my perft is, it will help my program be faster."   So from your post I think I am heading the wrong way and attack boards would make my evaluation slow (but I cant see how)   please reply. Thanks.
  8. Chess Programing: Request for Code Review.

    Hi Paradigm Shifter, Thanks for reply. I planned to keep one say like WHITE_ATTACK_MAPS and so on. and then update(OR them) the MAPS on move generation as they are the same. now on second thought, I dont know how to update(XOR) them on make move method and update them back on unmake move. I consider this scenario fen=4k3/8/8/5B2/6Q1/8/8/4K3 now g6 square is attacked by Bishop as well as Queen, so even if Queen or bishop moves(one at a time),g6 still remains under threat. So my plan to make or unmake the move fails. So I thought I might keep 12 bit boards and since I know the piece moving, I can just update that single bit board and so on... would like to know whether this would give me speed up or not. You can refer to the source code given in above links so that you can give more suggestions. Thanks.
  9. Chess Programing: Request for Code Review.

    Hi thanks for replying. I have read great deal of high quality posts from that forum however as you pointed out, I have also read many more posts that turn off mood. Recently, I ran a profiler on code, where it highlights some hot-spots which take time. One of the major concern is while validating the moves. As per my code, I turn it into a super king and check if can capture opponents piece, this would mean that opponenet would be able to capture my king, hence a check. But since It involves all the regeneration again, it takes up lot of time. So I am working on this. I read on In-Between Look up on chessprograming wiki. But cannot imagine how the array or the way to think on it. Can you guide me on this. Is there any better way? One more important reason about me posting here is that you reply in simple language at a level which I can understand. However I am waiting for my membership to get approved there.
  10. Chess Programing: Request for Code Review.

    Hi again, I have completed my move generation logic including the castling and promotions and have verified with the Perft Suite and found now defect in it. Since you haven't replied back I assume that you are busy and didn't find time to review my code, however if there is any other reason like the code quality was not up to the mark or code was difficult to understand, please let me know so that I can make it the way it is easier for you to review and hence wont take much of your time.   This is a log that has been generated to give an idea how much time has been consumed in order to generate moves and so on.   Thanks.
  11. tic tac toe AI

    Since you say that pieces override each other, you can keep a track of board state and play there only where its empty. something like this.     for(int i=0;i<9;i++) { if(board[i]==EMPTY) { int sq_move=board[i]; ...... } }
  12. Chess Programing: Request for Code Review.   I hope my code is readable.   Basically I think that MoveExtractor and moveGeneration Methods are what should be analyzed.   MoveExtractor is method which will extract the moves from logical grouping using appropriate bitShifts and bitMasks.  MoveGeneration is as usual.   Above are three main classes and heart of my code.    
  13. Chess Programing: Request for Code Review.

    Thanks alvaro for the reply,   I didnot calculate that but yes it seems impossible, however it is what my system shows. Can you please comment on the speed my program is giving My machine configuration is  Intel i3 core, 4.00GB RAM 2.40 GHz.   Also it would be helpful if you agree review my code, it uses nothing C# specific. (My program contains everything static even arrays and other stuff). Getting my code reviewed from an experienced and expert like you would also help me be a better programmer.   Kindly help.   Thank you.
  14. Hi all,   I have written a chess program using bit boards in C# and almost done with move generation(Castling still incomplete).   I have also written a PERFT function which gives me  the following statistics for the starting position on the chess board: 20 Nodes ---> 10 ms  --->  2 kN/s 400 Nodes --->11 ms  --->  36 kN/s 8902 Nodes ---> 18 ms  ---> 494.56 kN/s 197281 Nodes  --->477 ms. ---> 413.59 kN/s 4865609 Nodes ---> 4372 ms   --->  1112.9 kN/s 119060324 Nodes ---> 307920  ---> 386.56 kN/s     This is my very first bit-boards chess engine so don't know much about the speed, however when compared to my previous 0x88 chess stats this is definitely a winner.   When I compared these stats with Sharper (amazing chess program), I realized that it is much more faster than this, It computed Perft(6) in 132 ms without hash tables.   So I would request some one with experience in chess programming or in c# to review my code and let me know where I am going wrong or what can be done to optimize it.   I shall post my code if any one is ready to review the same. Please note, that there are no visible bugs.   Also if any one is aware, kindly post some kind of profiling tool which will help me to understand the coding efficiency better.   I am using Visual Studio 2010 as my IDE and C# as the language.   Thanks.    
  15. @alvaro: Thanks for the reply, and a good example which used zugswang to force up a win. Is there a method by which I can find which player controls the zugswang. I tried to read Victor Allis thesis and the rules which are described in them can be summed up in bitboard fashion pretty decently. However I fail to understand how to determine which player holds the zugswang. I also read the explanation given by John Tromp, he has used some heavy stuff. Will try to implement the logic. Another question off the topic, how can I be a better programmer? I am coding from past 2 years and now I think I am not growing. How can I be better. Are there any assignments? Some way of logic building or some classes/books on algorithms I should read? Or is this a phase in every programmers life? Thanks.