chess-elm
                                
                                 chess-elm copied to clipboard
                                
                                    chess-elm copied to clipboard
                            
                            
                            
                        When a king is in check do not allow illegal moves
Need to create logic that checks if a king is in check.
If so it restricts the possible moves that other pieces can make so that it only allows moves that either:
- block the check
- capture the piece giving check
- move the king out of check
I need to think about this logic in a little more detail but it maybe be good to have check and doubleCheck saved in the state somewhere.
If a king is in double check the only way out is to move the king. If there is an option somewhere that says doubleCheck: True (for example), this may be more efficient than needlessly looking for another pieces possible moves when it will not have any.