got the invalid moves code to work