This one was fun, randomising the pieces proved to be the biggest challenge. I spent a good amount of time writing the function that randomises the pieces at the start of the game only to realise that if you make the piece positions truly random then the game can be unwinnable. So I went back and re-wrote the function to move the pieces as a player would instead of making the positions truly random.