This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import system | |
system("ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Chapter 3 Homework assignment | |
# | |
# These problems are modified versions of the programming exercises | |
# in Starting out with Python (2nd edition) by Tony Gaddis. | |
# | |
# You should complete the provided functions so that they pass all the | |
# provided tests. To complete a function, remove the "pass" (which | |
# is a statement to do nothing) and implement the function. | |
# | |
# To test your code, simply run this module. If your module runs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
".source.python": | |
"Function Design Recipe": | |
"prefix":"recipe" | |
"body":""" | |
def ${1:function_name}(${2:parameters}): | |
\"\"\" ${3:type signature} | |
${4:description} | |
${5:examples} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import util.Random | |
class Field(val height : Int, val width : Int, theDecider : (Int, Int) => Boolean) { | |
val grid = for ( i <- 0 until height ) | |
yield (for ( j <- 0 until width ) yield theDecider(i,j)) | |
def isInBounds(row : Int, col : Int) : Boolean = | |
(0 <= row && row < height) && (0 <= col && col < width) | |
def isOccupied(row : Int, col : Int) : Boolean = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import util.Random | |
// not necessary, but my original idea | |
// class Field(val width: Int, val height: Int, factory: (Int, Int) => Boolean) { | |
// val grid = tabulate(width, height)(factory) | |
// more reasonable thing (like what you did) | |
class Field(val height : Int, val width : Int) { | |
// kinda funky to read, but its a 2d vector of random booleans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:71de6f77b06d248aca60a5b61bbff3f9715f168edb8f07fc124ce7fd39612271" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
NewerOlder