John Moon

programming to build an empire

Read this first

Short-term and Long-term Goals

As an entrepreneur, I feel that I need to keep myself accountable to my ultimate goal of building a successful startup that gets acquired. This post is to motivate myself and set a clear game plan. I’ll layout what I have done so far, and what I will do in the short term and long term.

Before attending the bootcamp, I wanted to develop a skill that would increase my chances of building a successful startup. This lead me to joining the bootcamp and gain experience and knowledge of web development. The reason I felt programming was so valuable was because someone needs to build the site that users interact with! Also you need a prototype to show investors.

Last week marks the first day of my new found programming career. After the three months programming bootcamp in Boston and one and a half months of searching, I landed an internship at LivingSocial. The place is very...

Continue reading →


More by John

Tic-Tac-Toe with AI - pt 2

In the past week, I received positive and negative feedback on my Tic-Tac-Toe program. The positive was that the AI was unbeatable, the negatives was duplications, global variables (and functions), and coupling of UI and game logic, in addition to not having any tests (yikes). They recommended using Jasmine to test the program and modularity.

The first item I wanted to tackle was duplication. The less code I have, the easier it would be to decouple and scope functions.

Building my first real JS program, I learned that you’re only suppose to have one document.ready block. In my file, I had 9 blocks of code that looked almost identical.

  $(document).ready(function(){ $("#row1 span0").click(function(){ if ($("#row1 span0")[0].innerHTML == "+") { $("#row1 span0")[0].innerHTML = players[counter % 2]; push_to_state(); } else { counter = counter - 1; }; }); });  

My code after I...

Continue reading →


Tic-Tac-Toe with AI - pt 1

Goal:

  • Create a tic-tac-toe game that has an unbeatable AI.

Learning Objective:

  • Building familiarity with Javascript and manipulating the Dom with jQuery.

Challenges:

  • How to make each individual tile clickable, and only manipulate a single tile. As a javascript newbie, it was a challenge to get each individual clickable. I knew that I would have to assign an unique tag for each element. I chose to go with span0, span1, span2 that belongs to row1, row2, row3. In hindsight I would have kept the numbers the same between span and row (012 or 123). In any case, with an unique span tag I was able to manipulate the Dom.

*state is the current state of the board. It is an array of arrays.

  if(state[i] == "+xx") { counter++; var r = i+1 $('#row' +r+ ' span0')[0].innerHTML = 'x'; return checkRow(); };  

Having 3 unique span tags within the row caused some interesting problems. In order...

Continue reading →


Overview vs Tunnel view in problem solving

This week I have been brushing up on my problem solving and Ruby skills doing katas on CodeEval. I noticed that there are different ways to approach a single problem.

*The Overview approach is thinking how the problem should be solved. Either white boarding or jotting down what the general steps should be. The Tunnel approach is reading the problem. Begin to implement code and iterate. SO which approach is better and more effective?

IMO you may write more methods and code following the tunnel approach. The overview approach is far more efficient. By thinking ahead how the program should generally act, it gives us a guideline on how we should model our program. It doesn’t mean we only write it once and we’re done, it’s far more common to try multiple approach in that context of how the program works. This way you’re not just throwing darts in the dark hoping one...

Continue reading →