add testing code and fix bugs with move generator