Staples interview question

Code the game that was just explained.