Skip to content

Instantly share code, notes, and snippets.

View chongkim's full-sized avatar

Chong Kim chongkim

View GitHub Profile
@chongkim
chongkim / iterm
Created February 27, 2015 15:51
script to send commands to iTerm and go back to MacVim
#!/usr/bin/osascript
on run argv
tell application "iTerm"
if (count of terminals) = 0 then
set _terminal to (make new terminal)
else
set _terminal to current terminal
end if
@chongkim
chongkim / route.rb
Last active April 7, 2016 19:48
find number of paths to a point on a grid
def paths(x,y)
return 1 if x == 0 || y == 0
paths(x-1,y) + paths(x,y-1)
end
# outputs: 184756
puts paths(10,10)
/* Go is a 2 player board game with simple rules. Two players alternate turns
* placing stones on a grid. If a stone is surrounded on 4 sides by stones of
* the opponent, it is captured. If a group of stones are surrounded, they are
* captured.
* See http://en.wikipedia.org/wiki/Rules_of_Go#Capture for a visual explanation.
*
* Below is an implementation of a Go board. Please write some code in the
* move() function to check for captures and output something when a capture
* occurs. The sample moves represent a capture of two black stones.
*/