Skip to content

Instantly share code, notes, and snippets.

@judofyr
Created December 25, 2009 22:51
Show Gist options
  • Save judofyr/263774 to your computer and use it in GitHub Desktop.
Save judofyr/263774 to your computer and use it in GitHub Desktop.
tic-tac-toe $ cd new_game
new_game $ ls -l
total 72
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 1 -> /Users/magnus/programming/random/tic-tac-toe/db/2100000000
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 2 -> /Users/magnus/programming/random/tic-tac-toe/db/2010000000
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 3 -> /Users/magnus/programming/random/tic-tac-toe/db/2001000000
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 4 -> /Users/magnus/programming/random/tic-tac-toe/db/2000100000
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 5 -> /Users/magnus/programming/random/tic-tac-toe/db/2000010000
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 6 -> /Users/magnus/programming/random/tic-tac-toe/db/2000001000
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 7 -> /Users/magnus/programming/random/tic-tac-toe/db/2000000100
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 8 -> /Users/magnus/programming/random/tic-tac-toe/db/2000000010
lrwxr-xr-x 1 magnus magnus 58 Dec 25 23:46 9 -> /Users/magnus/programming/random/tic-tac-toe/db/2000000001
-rw-r--r-- 1 magnus magnus 0 Dec 25 23:46 _ X plays _
-rw-r--r-- 1 magnus magnus 0 Dec 25 23:46 __ 1 2 3 __
-rw-r--r-- 1 magnus magnus 0 Dec 25 23:46 ___ 4 5 6 ___
-rw-r--r-- 1 magnus magnus 0 Dec 25 23:46 ____ 7 8 9 ____
new_game $ alias show="ls | grep _"
new_game $ show
_ X plays _
__ 1 2 3 __
___ 4 5 6 ___
____ 7 8 9 ____
new_game $ cd 1
1 $ show
_ O plays _
__ X 1 2 __
___ 3 4 5 ___
____ 6 7 8 ____
1 $ function play {
> cd $1
> show
> }
1 $ show
_ O plays _
__ X 1 2 __
___ 3 4 5 ___
____ 6 7 8 ____
1 $ play 6
_ X plays _
__ X 1 2 __
___ 3 4 5 ___
____ O 6 7 ____
6 $ play 7
_ O plays _
__ X 1 2 __
___ 3 4 5 ___
____ O 6 X ____
7 $ play 4
_ X plays _
__ X 1 2 __
___ 3 O 4 ___
____ O 5 X ____
4 $ play 2
_ O plays _
__ X 1 X __
___ 2 O 3 ___
____ O 4 X ____
2 $ play 1
_ X plays _
__ X O X __
___ 1 O 2 ___
____ O 3 X ____
1 $ play 2
_ X won _
__ X O X __
___ O X ___
____ O X ____
2 $ alias undo="cd .."
2 $ undo; undo; undo; undo; undo; undo
1 $ show
_ O plays _
__ X 1 2 __
___ 3 4 5 ___
____ 6 7 8 ____
1 $ play 8
_ X plays _
__ X 1 2 __
___ 3 4 5 ___
____ 6 7 O ____
8 $ play 6
_ O plays _
__ X 1 2 __
___ 3 4 5 ___
____ X 6 O ____
6 $ play 3
_ X plays _
__ X 1 2 __
___ O 3 4 ___
____ X 5 O ____
3 $ play 1
_ O plays _
__ X X 1 __
___ O 2 3 ___
____ X 4 O ____
1 $ play 2
_ X plays _
__ X X 1 __
___ O O 2 ___
____ X 3 O ____
2 $ undo
1 $ show
_ O plays _
__ X X 1 __
___ O 2 3 ___
____ X 4 O ____
1 $ play 1
_ X plays _
__ X X O __
___ O 1 2 ___
____ X 3 O ____
1 $ play 2
_ O plays _
__ X X O __
___ O 1 X ___
____ X 2 O ____
2 $ play 1
_ X plays _
__ X X O __
___ O O X ___
____ X 1 O ____
1 $ play 1
_ Tie _
__ X X O __
___ O O X ___
____ X X O ____
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment