How to turn Cyborg — Weeks 9–11

My adventures through Dev Academy’s web development programme

Maddy King
Enspiral Dev Academy
6 min readJan 19, 2018

--

Enspiral Dev Academy is a New Zealand web development school that takes students of any level and trains them to become junior web developers through a remote preparation phase and an intensive full-immersion 9 week bootcamp in Auckland or Wellington. Dev Academy’s Marketing Manager Maddy King has taken it upon herself to brave the programme, and share her #nofilter thoughts on the journey. Check out Week 1 here.

I was feeling good going in to Sprint 6, though I knew it would be a challenge. In this sprint we had to build our own Minesweeper game. We were presented with things to achieve, such as ‘Make a grid of dots’ or ‘Make the dots un-hide their contents when clicked’, and had to work out how to code the action ourselves, then write and test the code to get it working. I read through another chapter of Eloquent JavaScript at the same time as I completed these challenges, so that I could see the right syntax to use when my notes failed, and remember how everything worked.

The challenge of this sprint was that it wasn’t fully explained. I was in the wrong time zone to ask other Dev Academy students for advice on Slack (our group messaging app), so I googled my questions when I got stuck and many of them had been answered on StackOverflow. In this way I got through it.

We started by making a grid of cells, which would become the dots in Minesweeper. To do this we had to:

  • Define an object, the game board
  • Give that board an array of cells, in a grid
  • Give each of those cells a set of properties (for example, what row and column the dots sit on, and which ones are mines.)

In Minesweeper, when you uncover each cell it tells you how many mines are touching it. So we then had to build a For Loop to count how many mines were touching each cell, and print that number into the cell when it was uncovered. This was tricky.

Firstly we had to tell it that, for each cell, it needed to count the surrounding mines and add the number of mines to a ‘counter’ variable.

Me figuring it out since way back

Then we had to build another For Loop to say, for each cell, add a new property to that cell called ‘the number of surrounding mines’, and set the value of that property to the number in the counter variable. So if there are 2 mines touching a cell, the ‘surrounding mines’ property of that cell will be equal to 2. We had to navigate between the two For Loops to ensure the counter value was being added to the correct mine.

What made this hard was that we couldn’t check whether each part was functioning independently before moving on to the next, because all the parts were dependant on each other. So when it didn’t work, I wasn’t sure which part was broken — the first Loop, the second Loop or something else? I ran the code in my browser and used the debugging function to see where the problems were, but still had a lot of trouble figuring it out.

Luckily many other Dev Academy students had faced similar problems, and I could see their past questions in our Slack group. So I could read through their view and the help that other students, graduates and teachers had given them. I could also take a peek at their code to see what they’d done. It was really cool to see how many different ways people had come up with to solve the same problem. I got it in my own way in the end.

Finally we had to declare when the user had ‘won’ the game by uncovering all the cells that weren’t mines, and correctly marking all the cells that were mines without blowing themselves up. (How traumatic is the concept of the Minesweeper game! And I used to play it all the time, completely blasé, when I was a very small child on my parents’ Windows ’95 computer!).

This meant we had to check each cell for several conditions: Is the cell uncovered AND not a mine, and are all the mines marked? This was a real headscratcher. I tried several For Loops, I tried nesting a For Loop in another For Loop, and I tried a Switch instead of a loop (a Switch tests several conditions simultaneously). I still couldn’t get it working though. It came back to this central thing about Loops that I’d been struggling to get my head around — loops run through an entire set of information and check to see whether it matches certain conditions. But it does this one by one — for every piece of information it runs through the conditions, before moving on to the next.

In Minesweeper this meant I could say ‘is this cell a mine? No. Is it uncovered? Yes.’ But I couldn’t say ‘determine whether all the mines in the game are uncovered.’ Because it was only looking at one cell at a time.

Once I fully understood this, I got around the problem by thinking laterally. I said check every mine. If it’s both not a mine AND uncovered, add 1 to a variable called Win-Counter. If it’s both a mine and marked, add 1 to the same variable. Once the win-counter variable equals 9, (the number of cells on the board), tell the player they’ve won. I’m interested to see how other students solved it.

This was a challenging sprint but I felt really proud when I solved the challenges and really good when I got my head around the Loop concept. Again using external resources to help me understand worked well, and leaning on our group Slack to see how other people had explained and answered problems was also really useful. I just can’t believe that I’m performing all of these functions in JavaScript when it feels like I’ve really only just started. Learning introductory HTML and CSS on Codecademy back in the day took me a year! Because I had other stuff on and didn’t make it a priority. But this makes it a priority. The near-impossible task of being an artsy, theoretical communicator and learning to become a web developer seems way more achievable every day — and that’s incredible.

I sat down this week and thought about my intentions for 2018 and beyond, and realised that learning these skills helps me on my way towards achieving almost all of them, which is thrilling. So I’m really committed and motivated to learn this stuff, even if it means taking longer, working harder and studying more. And I really feel like I want to be good at it, not just scrape by, so I hope I’ll finish early and have a few spare weeks before bootcamp to comb through some extra information, do more challenges online and get to a really solid place with my knowledge and understanding. Right now it feels like I’m getting the hang of bits and pieces, which is the right way to start, but I’d like to gain an overall perspective of what I’m learning so that I can ask useful questions.

Bring on the next challenge.

Phase: 0

Weeks: 9–11

Sprint: 6

Hours logged: 13.08

If you’d like to change gears in the new year, join Dev Academy’s web development programme and gain the skills to design a creative, flexible, well-paid lifestyle you love. Start the preparation phase by remote learning, before entering the in-class bootcamp in Auckland or Wellington. Graduate 9 weeks later with the skills to become a junior web developer and craft the future. Apply today!

--

--