Learn more
These promotions will be applied to this item:
Some promotions may be combined; others are not eligible to be combined with other offers. For details, please see the Terms & Conditions associated with these promotions.
Your Memberships & Subscriptions
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
How to Write a JavaScript Chess Engine: How Chess Programs Work
- You are learning programming and are interested in learning something different.
- You are a programmer who is interested in developing your programming experience.
- You are a chess enthusiast and would like to improve your chess by learning how chess programs work.
- You are interested in developing a chess program and playing against it.
- You are interested in developing a chess program and having it play other engines.
You do need to be an expert programmer to understand this book. The code is written as simply as possible. The code is designed to be simple even for intermediate and even novice programmers.
If you are not a programmer but are interested in chess, this book may be of interest.
The book includes annotations of the source code for a complete chess engine that the author has developed as a teaching tool. The complete source code is available at GitHub. The program can be edited with any text editor and run on a web page. You can alter the code and see if you can make it stronger.
The program is a derivative of my program referred to in my earlier book How to Write a BitBoard Chess Engine.
The engine is strong enough to beat most social players.
Features of the engine include:
- It can play a human or itself.
- It can load positions.
- It is reasonably fast.
- It displays the best line of play for both sides.
- Detects checkmate.
- Detects draws by repetition, 50 move rule, stalemate or reduction of material.
Evaluation
The engine evaluates elements of a position, including:- Material.
- Piece position.
- King safety.
- Pawn structure.
- Passed pawns etc
Search
The engine uses a standard alpha-beta minimax search including:- Cut offs.
- Move ordering.
- History moves,
- Hash tables.
- Extensions.
- Reductions.
- Capture search.
And much more…
Other books on computer chess include:
- The Joy of Chess Programming
- Think Like a ComputerOther books on computer chess programming include:
- How to Write a Chess Program.
- How to Write a Bitboard Chess Engine.
- Advanced Chess Programming.
- How to Write a Complex Chess Engine.
- How to Write a Simple Chess Neural Network.
The author is a FIDE chess master and national senior chess champion in addition to being a chess programming enthusiast. He was also an IT trainer for 10 years, teaching programming languages such as C++ to adults.
- LanguageEnglish
- Publication dateApril 19, 2020
- File size509 KB
4 stars and above
Product details
- ASIN : B087BJ467C
- Accessibility : Learn more
- Publication date : April 19, 2020
- Edition : 5th
- Language : English
- File size : 509 KB
- Screen Reader : Supported
- Enhanced typesetting : Enabled
- X-Ray : Not Enabled
- Word Wise : Not Enabled
- Print length : 168 pages
- Page Flip : Enabled
- Best Sellers Rank: #3,167,468 in Kindle Store (See Top 100 in Kindle Store)
- #694 in JavaScript Programming (Kindle Store)
- #949 in JavaScript Programming (Books)
- #996 in Computer Games Programming
- Customer Reviews:
About the author

Bill Jordan was taught chess on his 7th birthday by his father using a chess set carved by his grandfather. Since the age of 17 Bill Jordan has represented Australia in international chess events in Malaysia, Yugoslavia, Mexico and China.
Bill became Victorian Junior chess champion seven years later. He later became Australian junior champion, Victorian champion, Australian correspondence champion, 2017 South Australian chess champion and 2019 Australian senior champion.
Bill has been president of the Melbourne chess club, one of the oldest chess clubs in the world. He is an enthusiastic chess software programmer who has taught and written manuals for chess as well as IT and lateral thinking.
Bill Jordan is experienced in individual and group coaching, and has an exceptional understanding of chess.
Related products with free delivery on eligible orders
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from the United States
- 2 out of 5 stars
The program is not in a readable form, although the purpose is education, not speed.
Reviewed in the United States on October 1, 2024Your claim that white space and long variable names slows the execution down is bogus. The javascript is immediately translated to internal form. Also, this engine’s main purpose is not speed, it is education. So, the code should be as readable as possible. The minification is not meant to be read and should NEVER be published in a book aimed for education.
The indentation is horrible.
I’m using the extinct language Coffeescript. It has a similar mandatory indentation as Python and is transpiled to Javascript. Very readable!
Finally, why bother with web assembly if your main concern is education, not speed? The reader will not be able to debug. The debugger is a wonderful tool to see the internal values, not only finding errors. You took this possibility away.
Please, fix these issues in the next edition, and I will buy the book once more.
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 1 out of 5 stars
Too much misinformation and bad programming practices
Reviewed in the United States on March 23, 2023The author uses an HTML table to represent the board, instead of a CSS approach. Tables should only be used *for tabular data*. Furthermore he writes that too much white space in Javascript slows things down. This is simply untrue., and he uses it as the rational for the horrendous programming practice, using non-descriptive variable names, such as individual letters, "a", "b", "c" etc.
If the Javascript needs to be sent over the wire it can be minified, for instance using webpack and running the build command. The un-minified code however absolutely needs to be easy for the user to read and understand. The rest of the book is not to be trusted.
One person found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again





