raenset Posted December 11, 2014 Share Posted December 11, 2014 I would like to find a good tutorial for a Javascript chess engine. I mean, one where you play against the AI, not the chess board in which two human players can log in and play together (although the latter is of some interest to me, too).I know that a chess engine can quickly become a very complicated matter, but what do you think that the best tutorials are on the web to start learning how to write one? This, limited to HTML5 / Javascript. Quote Link to comment Share on other sites More sharing options...
AVENGER NO WAR Posted December 12, 2014 Share Posted December 12, 2014 I would like to find a good tutorial for a Javascript chess engine. I mean, one where you play against the AI, not the chess board in which two human players can log in and play together (although the latter is of some interest to me, too).I know that a chess engine can quickly become a very complicated matter, but what do you think that the best tutorials are on the web to start learning how to write one? This, limited to HTML5 / Javascript. i have no idea about tutorials. but you can try stockfish for your purpose! Stockfish is one of the strongest chess engines! someone ported in to javascript here: https://github.com/exoticorn/stockfish-js Quote Link to comment Share on other sites More sharing options...
raenset Posted December 12, 2014 Author Share Posted December 12, 2014 Thank you for the link, but what I need for the time being is some sort of primer on how to teach the computer the rules of chess, and how to make it play... just getting an idea of the "big picture", so that I can go into details later. Of course I can try it myself, from zero, using my brain, without any tutorial, but a "getting started" sort of tutorial would be very useful... Quote Link to comment Share on other sites More sharing options...
JUL Posted December 13, 2014 Share Posted December 13, 2014 http://electronics.howstuffworks.com/chess1.htm Good luck. plicatibu 1 Quote Link to comment Share on other sites More sharing options...
Felix Posted February 7, 2015 Share Posted February 7, 2015 You might want to look into the "min-max" algorithm and it's more complicated optimization "alpha-beta" algorithm. Chess is a so called "zero-sum game". Other examples would be the nim-game, tic-tac-toe, and 4-in-a-row.What these games have in common is, that two players move after each other and that a situation that is good for one player, is bad for the other player. In those kind of games you can use the min-max algorithm. So google for something like "4-in-a-row min-max tutorial".I found this, but I didn't watch the videos: https://www.youtube.com/results?search_query=chess+min+max -------------------------------- Short explanation:What is a bad situaltion for a player: When he doesn't have a king.What is also a bad situation: When every move he could make would lead to a good situation for the opponent.What is a good situation for a player: When there is any move that produces a bad situation for the opponent.Think about it: These three rules would suffice to make a perfect chess ai - but it isn't efficient enough, so the computer would run out of memory and time (even a supercomputer). It is enought to solve chess problems, or tic-tac-toe, though. The second best alternative is to stop after a certain depth and decide how good your situation is without considering the following moves. A simple option to do this is to calculate your pawn-power (e.g. a rook would be 4 or 5 pawns, an enemy queen would be -9 pawns). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.