CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2012
    Posts
    2

    Question Help with chess engine

    Hey! I'm building a chess engine and now I'm stuck. I haven't been using c++ alot, so I don't know what I'm doing wrong. The engine works, but runs too slow. Could you guys take a quick look at my code and point out the most obvious errors in my code?

    Please, I really need your help!
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2010
    Posts
    39

    Re: Help with chess engine

    Hell veclock
    Welcome to the chess engine programming world. A group of smart chess programmers are ready to help you in developing your engine after I informed them of your question here. I hope you don't mind me posting your question on your behalf there. You can ask questions and find valuable suggestions about bit-boards and other stuff here.
    http://www.talkchess.com/forum/viewt...448728&t=42374

    regards,
    Daniel

  3. #3
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Help with chess engine

    I built it in MSVC 2005 and didn't find it to be painfully slow, even though it was a debug build (you should attend to the warnings by the way).

    You do have some integer pow functions and some translation number <-> bit position so this page http://graphics.stanford.edu/~seander/bithacks.html might be useful. Also check your loops, it might be possible to do those operations more efficient.

    You also have a thread that consumes every CPU cycle it gets. That thread isn't really needed since it doesn't do anything (but burn cycles) when it's the opponents turn. When it's the AI's turn the opponent shouldn't get any attention so you might just as well run what's in the thread at that point.

    Finally, please don't post this kind of issues in this thread. This thread is solely for Visual Studio bugs. Use C++ (Non Visual C++ Issues) instead.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  4. #4
    Join Date
    Mar 2001
    Posts
    2,529

    Re: Help with chess engine

    Yep you don't sleep any of your threads, so they all try to take 100% of your processor. Check out Synchronization of threads and sleep.
    ahoodin
    To keep the plot moving, that's why.

  5. #5
    Join Date
    Feb 2012
    Posts
    2

    Re: Help with chess engine

    Quote Originally Posted by dshawul View Post
    Hell veclock
    Welcome to the chess engine programming world. A group of smart chess programmers are ready to help you in developing your engine after I informed them of your question here. I hope you don't mind me posting your question on your behalf there. You can ask questions and find valuable suggestions about bit-boards and other stuff here.
    http://www.talkchess.com/forum/viewt...448728&t=42374

    regards,
    Daniel
    Very kind of you!

    Many parts of the code is temporary, like those huge switches. I just wanted something that worked until I found out the best way.

  6. #6
    Join Date
    Sep 2010
    Posts
    39

    Re: Help with chess engine

    Quote Originally Posted by veclock View Post
    Very kind of you!

    Many parts of the code is temporary, like those huge switches. I just wanted something that worked until I found out the best way.
    I think you did really well. And I agree that first thing is to get it working.
    I sensed the amount of effort you put into your project which is why I "volunteered" to introduce you there. ]If you are really interested about chess programming that place is good to ask questions. Another useful website is the chess programming wiki. For example you can read about many fast bitscan routines here http://chessprogramming.wikispaces.com/BitScan .
    Your alpha beta search is also a bit unconventional as explained by Sven from the link I gave in my previous post. Please register there so we can communicate better and exchange ideas. You might need to put on a brave face for some of the posts but i hope you find it worth your while
    cheers.

  7. #7
    Join Date
    Nov 2011
    Posts
    21

    Re: Help with chess engine

    I am also interested in this, only for java

  8. #8
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Help with chess engine

    [ Moved thread ]

    @MastAvalons: if you want something "java only" then visit Java Programming forum.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured