Today’s challenge was to recreate a command line version of minesweeper. After everything we did last week, it didn’t feel too tough and we ended up finishing the core functionality with time to spare. there was definitely room to refactor and make improvements on our code, but we didn’t have quite enough time to get to that. We were also able to implement YAML, which let us save an instance of the board that could be reloaded later, which was pretty cool.
One week done! The first week is over and it flew by. At the same time it feels like so long ago that we started. We were doing simple things like practicing loops and creating methods to sum arrays… Fast forward to today and we are doing breadth first searches through a set of nodes in order to find the set of squares that a knight on a chessboard will move to in order to get from any given start point to any given end point… Big difference! I can only imagine what we’ll be doing by the end of next week!
We also took a crack at programming an unbeatable tic tac toe AI today using trees of nodes to represent possible outcomes of the game after each move. we were able to get pretty far before we had to leave, but will have to leave the finishing touches for the weekend
Today was all about recursion and blocks, which usually seem to be hard concepts to wrap your head around. While the exercises were certainly not easy, we were able to complete them and felt great about our solutions. Once you learn to identify the base cases, it was usually not too long until we figured out how to get the next few cases to work down to the base cases, which is the whole trick with recursion.
Blocks are another story. The concept makes sense, but they don’t quite seem to behave the same way as everything else in Ruby. I’m sure as I start utilizing them more, I will better understand their behavior and uses.
I can’t believe its already about to be the end of week 1. In 4 days I’ve already gotten used to working in pairs. It definitely helps to have a second set of eyes and another brain working toward the same goal.
Today in the morning session we went into detail on “pass by reference” and learned some nice ways to avoid having issues with it, including passing a block into a new array or hash call, using the dup method, and creating our own explicit methods to behave exactly the way we want.
We also learned how to circumvent “pass by reference” issues with nested arrays by doing a deeper dupe on the inner arrays.
For our exercises we were asked to build simple simulations of existing games: Mastermind and Hangman. Both exercises brought up their own share of problems to navigate, but by the end of the day I was felt like I would be able to implement a good solution from start to finish on any similar problems
Phew! Day 2 flew by pretty quick! We didn’t cover anything that was really new, but the exercises certainly felt a bit more challenging than yesterday. The day was filled with minor victories as we stumbled through some of the problems, being notably tripped up by the dreaded “pass by reference” a couple of times.
Ultimately we were able to figure out working solutions to all of our exercises and felt pretty good about them. Later, upon seeing the solutions, I can see quite a few areas where we could have improved our code and streamlined it. Most glaringly, I need to get better at using helper methods to get the job done. I’m sure part of that will be going back in to refactor our code once it’s written, but it’s still something i’m going to play closer attention to going forward.