This is a refactored and null-safety version of chess.dart from https://github.com/davecom/chess.dart