[U**]Hi friends,** I’ve done with human player moves of chess game in C#.
All pieces does moves according to chess standard rules.[/U]
I’m able to show valid next moves of the selected piece by glowing those valid positions.
Now I’m proceeding towards Chess AI.
Does anyone have ideas on the Chess AI? How should I approach it?
Any Help would be Greatly Appreciated…!
Are you an experienced programmer? If not don’t even try I did and will never again ![]()
I don’t know how to do this but there should exist some academic paper about this, it should use heavy AI and be tough to implement ![]()
Take a read on these sites for you have an idea about it and what you should try to research about.
Hi harschell,
I’ve also been working on a chess program, Chess Challenger for Windows 8, which currently doesn’t have any AI (HomeBasedGames.com). However, I’ve been experimenting on creating chess AI, and in a non-commercial version have gotten to the point where legal moves are shown and chess notation is shown and spoken for the moves made. I consider this a light amount of AI and it was done using C#. But I would also be interested in expanding that to have the ability to actually play chess. So I’m also very interested in answers your question. The following are a couple of my insights so far, but I have to qualify this by emphasizing that I haven’t built an AI system yet that is capable of playing chess.
First, from what I can tell so far, it is indeed a challenging problem to create consistently good (or even reasonable) moves with a brief period of time. As far as I’ve seen, all chess engines utilize a “tree” of sorts to consider many possible moves, the possible response moves, and responses to those, and so on. The size of that tree will have big impact on both the quality of the moves, but also the time required to compute a move. When it comes to chess engines, speed therefor becomes critical. The faster the computations, the stronger the moves can potentially be within a fixed period of time. Towards that end, it could make more sense to build the chess engine in C++ as opposed to C#, but how to connect that with a C# script running in Unity is beyond my current skill levels. Still, I would guess there is a way. Also, one could use C# to develop an engine, but it will likely never be as strong as one using the same overall logic, but developed in C++.
Second, chess engines and chess games are often two different bodies of code. In some cases, you can even change the engine a chess game uses depending on the game and the interface it uses for talking to the engine. A simple Google search for “chess engine” or “chess ai” without the quotes will find many results, including open source chess engines like Stockfish (stockfishchess.org) as well as many articles about how to create a chess engines. I think its a challenging enough task that it takes experience to get very far in creating one’s own, but it can be an interesting problem if you like writing code that uses algorithms with an intense amount of logic.
I hope this helps. I’ll be very interested to see other responses as well. Good luck! ![]()
Minmax algorithm with a time limit on. The more time you give it to calculate moves the “further” it will think…
Hi Aaron3D,
Thank for your reply I do agree with you that, I think its a challenging enough task that it takes experience to get very far in creating one’s own. I’ve gone through various articles, checked MinMax, NegaMax, Alpha-Beta Pruning, Principal-Variation-Search, etcBut still I’m not able to figure out a proper way how to use all of these. I’ve to do it in C#.
I’ve done this game in Unity3d, now working on Chess AI but Stuck here at Starting. I’ve find open source chess engine in C# at http://www.chessbin.com. Well lets see if I’m able to use it or not. If You or anyone here knows how to make its interface to our chess game Plz do share some Idea’s?
As you are saying you are doing the same thing for Win 8 what I suggest go for WinBoard they’ve given WinBoards details documentation on their site.It supports windows they’ve also explained how to connect it with Ui which you’ve created. Have a try
Lets See whats other people comes up with???
Hi BFGames,
working on same but even at depth 5 for chess its takes atleast 4 hrs of eastimated time. Didn’t do it practically though yet.
Lets see What happens next ![]()
Hi Harschell,
When you say a depth of 5 took four hours, I’m wondering if you are looking at every possible combination of moves to that depth. That would indeed be a huge number of moves to consider. In order for engine to be quick, I would think any chess algorithm would need to terminate branches that don’t look likely after a smaller depth. Determining what doesn’t look likely is tricky, and will sometimes be bad decisions, but will be essential to getting the time down to a couple of seconds or less. Utilizing some kind of electronic opening book could help with the first few moves too.
A grand master was once asked how many moves do they look ahead, to which he replied, hopefully one more than my opponent.![]()
As Aaron3D states, then you need to limit the branches in some matter because the possible moves in chess, are well… HUGE hehe!
Working on the same [pruning the branches]
![]()
@ BFGames,
@ 3agle
Neural n/w’s… h… I’d considered their implementation, but I already moved ahead of that because they are a bit complicated, I want it to be Simple so…
thank you for the link…