OpenAI interview question

- design chess.com, fix/optimize this code