The algorithm is explained really well in the article I linked above, so I’ll not go over it again. The algorithm is pretty easy to implement, the main parts of this algorithm are:
- Representing the field the bishop moves on (easy enough with a 2D array of integers)
- Converting Hex to binary (surprisingly, there is no builtin function for that, but there is a good answer on StackOverflow to that)
- Isolating the bit-pairs (by iterating through two-character substrings of the words)
- Checking if moves are valid (by checking if the target coordinates are within the limits of the array)
- Showing the results (by writing them into a div with a monospaced font set)
You can take a look at the code in action at jsfiddle, or just look at the horrible code in the gist on github and make fun of me in the comments.