Learning to Code: Week 7 – Project Euler

6/23/16

Using our collaborative approach to learning, you’ll be introduced to Javascript, the programming language of the internet! This is a great opportunity to experience a collaborative, hands-on approach to learning.

By the end of the evening you’ll understand the basics of Javascript, have written a bunch of Javascript yourself and be equipped with resources to continue learning beyond our workshop.

  • The workshop ended up being horrible and I learned nothing new. Here is example of something we worked through arbitrarily in a group: https://github.com/greatersum/intro-to-programming-using-javascript-koans/blob/master/koans/AboutNumbers.js
  • We’d just change “FILL_ME_IN” to make the code work, but I didn’t see the point at all. This was supposed to be an introduction class, but nothing was explained. Just two hours of math/coding problems. If you were unfamiliar with coding at all your head would’ve exploded. No basics were covered and we never actually wrote a single line of JS. Just a lot of 1 + 1 = ?
  • You can see the actually exercises they used here: https://github.com/greatersum/intro-to-programming-using-javascript-koans/blob/master/koans/AboutNumbers.js
  • I looked up Javascript Koans and they seem to be a common thing, but I personally didn’t see how it served as an introduction to JS unless you were already really proficient in another language. But if you were good in another language you wouldn’t need to do these Koan exercises anyway!

6/24/16

Shawn linked me this article on Twitter.

I found this part really interesting:

Call your shot. Before you run code, predict out loud exactly what will happen.

Continue reading →

Learning to Code: Week 6 – Codecademy

6/15/16 – Continued

Read chapter 6 of Grokking Algorithms

  • Breadth-first Search
  • What are graphs
  • Directed graphs vs Undirected graphs
  • Queues
  • Queues (FIFO) vs Stack (LIFO)
  • Implementing the algorithm in Python
  • Topological sort
  • Trees

6/16/16

  • Website discovered: http://c.learncodethehardway.org/book/index.html (free resource)
    • He says: “LCTHW will not be for beginners, but for people who have at least read LPTHW or know one other programming language.”
    • Hopefully I can get something out of it regardless.
    • LCTHW Exercise 1: Dust Off That Compiler
  • Didn’t get much done today. Pretty bummed about it. 😕

6/17/16

  • Since I have the Javascript meetup coming up, I started on the Codecademy Javascript course just to mess around.
  • I don’t like to jump around too much though so I don’t think I’ll go too deep into it, only up until the workshop. CS50 is my main focus.
  • Is console.log same as the cs50 printf function?

CS50 walkthrough videos:

  • Sigma function
  • Swapping
  • Copying
  • Compare
  • Structs
  • Pointers
  • Coursera is changing platforms and getting rid of 400+ courses so I downloaded a few good ones before they are gone:
    • Algorithms Part I by Kevin Wayne and Robert Sedgewick (Princeton University)
    • Algorithms Part II by Kevin Wayne and Robert Sedgewick (Princeton University)
    • Compilers by Alex Aiken (Stanford University)
    • Introduction to Mathematical Thinking by Dr. Keith Devlin (Stanford University)

6/18/16

  • Finished entire Codecademy Javascript Unit #1 – INTRODUCTION TO JAVASCRIPT
    • Breezing through it since it’s all a refresher from CS50 just with different style/words.

image06

Critical hits work a bit differently in this RPG. If you roll the maximum value on a die, you get to roll the die again and add both dice rolls to get your final score. Critical hits can stack indefinitely — a second max value means you get a third roll, and so on. With enough luck, any number of points is possible.

Continue reading →

Learning to Code: Week 5 – Game of Fifteen

6/9/16

  • Finished questions.txt for Game of Fifteen
  • Implemented init, draw, search, legalmove functions in my Fifteen.c program

6/10/16

  • Continuing work on Fifteen.c
  • Implemented swaptile function.
    • I forgot to change the location of the blank tile so it wasn’t working at first.
    • That was an easy fix and now the game seems to be complete except I need to make the won function work.
    • Also I had the search function be int search(int tile) when it actually doesn’t need to return anything so I changed that to void.
    • Not sure what I was thinking yesterday. It just needs to search, not return.
  • Worked on won function for a long time. I understood the implementation easy enough, just kept running into small errors and mistakes and it took a lot longer than I though to get it right!
  • I didn’t implement it this way, but I did see a cool little algorithm to determine that the tiles are in fact in the correct place on StackExchange afterwards: http://cs50.stackexchange.com/questions/1317/pset3-won-function-works-only-with-3×3-board-where-am-i-wrong/1320#1320
  • So the number at position board[i][j] should be equal to ((d*i) + (j+1)). That’s pretty cool.
    • I don’t think it makes much difference, but all I did was add a check to see if the counter was correct AND if the final tile was zero.
    • Both conditions had to be true to consider the game won.
  • See my solution in action below!

Game of Fifteen

Continue reading →

Learning to Code: Week 4 – Algorithms

Algorithms Summary

6/1/16 – Continued

6/2/16

  • Shawn helped me look into making a function for the water.c program. I worked on it for a bit.
  • Error 1 – 0 arguments instead of 2.

image08

  • Error 2 – variable bottles but nothing there. Call the function INTO that variable?

image28

  • Boom, got it to work. That was pretty cool.
    • Now I can account for variable shower heads.
    • I think the input question could be better to explain what the metric is for waterflow etc.
  • I didn’t think of rounding errors.

Code Here: https://gist.github.com/CraigRodrigues/aeff70c00abf8fd4628f19e57c837a55

I put a function in Caesar.c!

Code Here: https://gist.github.com/CraigRodrigues/6e3724fbe3bd5fed9d05d2cafcedbc5c

  • Not sure about the names of the variables though. I think it works okay.
  • Also not sure if functions should be in printf or on a separate line going into another variable?
    • Example: printf(“%c”, encryptCode(code[i], k));

Continue reading →