Shallow Thought – an Angular 2 chess player

It’s been a long time, but I’m back with another of my dinky code demos.  This time it’s that old classic, the chess engine.  For extra fun, we’re going to build it in TypeScript to run in the browser and we’ll give it an Angular 2 UI so you can play against it.

All the source code is on GitHub and can be found here.

I’m going to post a few articles here looking at what’s going on in the code.  Hopefully there will be something here to interest a variety of readers, so the articles will be split across the different topics.  You might want to know about the basics of computer chess, or the basics of Angular/TypeScript, or even the basics of web workers (i.e. background threads).  In any case, the key word here is basic.  This is not an advanced study of anything and as usual I’m not an expert on any of these topics.  I just like writing code.  Especially on the chess engine side, this discussion will be aimed at beginners.  I do assume that you know how to play chess and you know the algebraic notation.

The articles

  1. How to make your computer play chess
  2. Chess engine code – laying the groundwork
  3. Chess engine code – running in the background
  4. Chess engine code – minimax
  5. Chess engine code – the evaluation function
  6. Angular 2 components – piece
  7. Angular 2 directive – square

The code

The interesting parts of the code are in the /src/app/engine and /src/app/ui folders:

/src/app/engine
/src/app/ui

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s