OpenAI Interview Question

- design chess.com, fix/optimize this code