Minesweeper and interviewing

  • Published: 2015-12-18
  • Modified: 2015-12-26 21:22
  • By: Mishoo
  • Tags: interviewing, minesweeper
  • Comments: 1 (add)
Dec
18
2015

Minesweeper and interviewing

Today I've read this article on interviewing and I decided to take the challenge:

You have one hour to implement as much of Minesweeper as possible. I've provided a JSBin for you though you're free to use whatever development tools/libraries/frameworks you're most comfortable with. You're allowed to use whatever internet resources you need, excluding plagiarism. I'll be available to answer any questions you may have. You're not expected to finish! In fact, no one ever has. Do your best and we'll chat about how things went afterward.

I've fired my editor (not really, it was already open), took note of the time and started coding. After 35 minutes I got interrupted, so I ran git init and saved the first commit. When I got back on it I worked for another 20 minutes, and then thought “time's up”, so I saved the second commit. I then took a break from it, but as the problem would not want to go away from my head, I realized that fixing the algorithm to elnarge empty areas is trivial. While doing that I found another bug in counting the number of neighboring mines. 3 commits later, and the game is actually playable (note, that includes a couple more commits polishing things up, but feel free to checkout the repo locally and see it at commit 5). Total time spent on the first 5 commits, discounting breaks, about 1:10 (and I didn't use any framework nor the JSBin template).

Some things combined to help me get this time:

But then, I thought, would I be able to do the same in actual interview conditions? Most probably not. I screwed up even simpler tasks in interviews. I've worked on this little game as if all my life was about implementing Minesweeper clones, but under interview pressure, instead of being on the problem my brain is like “This guy is watching me. Yeah.. And I'm sitting here like an idiot and my hands aren't typing the marvelous code that he expects to see. Err, what was I supposed to do?”

So, even if I proved myself I could do it, I don't think I'd like to get a similar task in an actual interview. Now, back to playing Minesweeper.

Footnotes
1. by which I mean, don't disconsider someone who's praising Emacs until you've seen an experienced hacker typing code in it. But yeah, based on popularity counts, there's few of us left in the galaxy…
One comment. ONE! Gimme some more!

Add your comment

# Nick
2015-12-20 16:03
Very nice and clear code. I'm reading it first time and understand immediately what's going on. I like it! :)