3 ms·
Back in 2nd year CS we were tasked with making a simple terminal minesweeper game. It would print the whole board state after each move and read coords from std
by ekimekim 12y ago
Back in 2nd year CS we were tasked with making a simple terminal minesweeper game. It would print the whole board state after each move and read coords from stdin to know what square was picked.
I wanted to make it a proper GUI-style board with arrow key movement, randomised mines (the assignment tasked us with reading mine locations from stdin at the start), auto-expanding zeros, varying board sizes...so I did.
However, I knew the assignment would be marked on automated test results. I wanted to show off, but still pass the auto-tests. So I made it ask for game "mode" at the start, implementing both the requested behavior and my desired behavior. But if stdin wasn't a tty, it just did the requested behaviour without asking, thus foiling the tests.