I've been leaving at 8:00pm sharp (which is the official end time) pretty much everyday due to exhaustion, but I've started to think about how this would look to our fellows/instructors. Me and Richard discussed and decided we should stay longer some days, and attend any events that happen after-hours.
I know this isn't Yelp but I'm going to talk about Tender Greens. I've avoided eating from any restaurants with the word "green" in it -- although green is my fav color -- since superstitious me would relate that to "vegan", "vegetarian", or "blasphemy". Per usual, superstitious me was wrong.
There are many options you can choose from for your plate, sandwich, or salad. I ended up getting steak with sides of mashed taters and salad. DANG that was good. The mashed potatoes were soft as clouds, almost felt like whipped cream. The steak was juicy, marinated to perfection, and not chewy at all. It's hard to put healthy and delicious together, but TenderGreens -- you did it. I approve.
The only downside is it's expensive, but I guess it's expected in Santa Monica
What we did today:
1. Toy Problem: EZ PZ
Is Subset Of
Make an array method that can return whether or not a context array is a subset of an input array. To simplify the problem, you can assume that both arrays will contain only strings.
Here are some tests it should pass:
it('should return true if all of the elements in the first array are in the second', function(){
var result = ['cat', 'dog', 'cow'].isSubsetOf(['dog', 'cow', 'fox', 'cat']);
result.should.equal(true);
});
it('should return false if not all of the elements in the first array are in the second', function(){
var result = ['cat', 'dog', 'cow'].isSubsetOf(['dog', 'cow', 'fox']);
result.should.equal(false);
2. Continue pair programming on N-queens:
We finished up our sprint in a jiffy, but in the process encountered a problem in the code that had us thinking. This is our code:
function recurse(boardCopy, index){ | |
counter = n - index; | |
if(counter === 0){ | |
solutionCount++; | |
return; | |
} | |
for(var i=0; i<n; i++){ | |
boardCopy.setPiece(index, i, 1); | |
if(boardCopy.hasColConflictAt(i) === false){ | |
recurse(boardCopy, ???????); | |
} | |
boardCopy.setPiece(index, i, 0); | |
} | |
We wanted to increment index and then pass it into where the ?????? was. We passed in i++, only to find that the specs don't pass. We were sure that the rest of the code was correct, so we put a debugger everywhere and monitored the index variable..... the index did not increment with each recursive call!
We found out that i++ evaluates the expression first THEN increments the i. So, the recurse function would run before index would increment. Here is a StackOverflow explanation:
We found out that i++ evaluates the expression first THEN increments the i. So, the recurse function would run before index would increment. Here is a StackOverflow explanation:
a=1;
b=1;
c=++a;//the value of a is incremented first and then assigned to c
d=b++;//the value of b is assigned to d first then incremented
On a side note, I gave up on trying to get my own version of code to work. My code was hard to keep track of because too many arguments were passed into my recursing function -- probably because I didn't use any of the helper functions provided :/
3. Townhall
1.21.16
3. Townhall
1.21.16
No comments:
Post a Comment