This file contains hidden or 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
#!/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 |
This file contains hidden or 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
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) |
This file contains hidden or 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
/* 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. | |
*/ |