Restarting after the founder moved to DC.
Project focused, mentoring focused.
Restarting after the founder moved to DC.
Project focused, mentoring focused.
We're interested in the nitty gritty.
Restarting after the founder moved to DC.
Project focused, mentoring focused.
We're interested in the nitty gritty.
Used a cool library? Fine.
Tell us what you built with it.
A game of Tic-Tac-Toe.
With AI! (wow)
A game of Tic-Tac-Toe.
With AI! (wow)
We remember Tic Tac Toe, right?
It's a special case of m,n,k games.
But specifics are pedagogically helpful.
Disclaimer: I have not tried my algorithm on arbitrary m,n,k games.
Tock on github.
Loose feature overview:
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Some tests I guess. (Yeah, not really a feature.)
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Some tests I guess. (Yeah, not really a feature.)
The following objects:
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Some tests I guess. (Yeah, not really a feature.)
The following objects:
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Some tests I guess. (Yeah, not really a feature.)
The following objects:
Board
Human, Computer, SuperComputer
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Some tests I guess. (Yeah, not really a feature.)
The following objects:
Board
Human, Computer, SuperComputer
TicTacToe
Tock on github.
Loose feature overview:
Any mixture of 2 Human/Computer/SuperComputer players.
Any NxN board size. (Diagonal wins only supported on odd boards.)
Some tests I guess. (Yeah, not really a feature.)
The following objects:
Board
Human, Computer, SuperComputer
TicTacToe
Menu
Disclaimer: I threw these slides together this afternoon. Expect whiteboarding.
Final Disclaimer: I wrote all this code in about 5 hours Sunday and last night.
Disclaimer: I threw these slides together this afternoon. Expect whiteboarding.
Final Disclaimer: I wrote all this code in about 5 hours Sunday and last night.
The core idea is pretty simple actually ...
Disclaimer: I threw these slides together this afternoon. Expect whiteboarding.
Final Disclaimer: I wrote all this code in about 5 hours Sunday and last night.
The core idea is pretty simple actually ...
Write a scoring function for your game state.
Recursively enumerate all possible future game states.
Disclaimer: I threw these slides together this afternoon. Expect whiteboarding.
Final Disclaimer: I wrote all this code in about 5 hours Sunday and last night.
The core idea is pretty simple actually ...
Write a scoring function for your game state.
Recursively enumerate all possible future game states.
???
Disclaimer: I threw these slides together this afternoon. Expect whiteboarding.
Final Disclaimer: I wrote all this code in about 5 hours Sunday and last night.
The core idea is pretty simple actually ...
Write a scoring function for your game state.
Recursively enumerate all possible future game states.
???
PROFIT!
Every "Game State" can lead to a number of possible future states based on how a player chooses to move.
Those states have their own future states based on the opponent's move and so on.
Every "Game State" can lead to a number of possible future states based on how a player chooses to move.
Those states have their own future states based on the opponent's move and so on.
We build the "Game Tree" then we just have to walk up and down it and figure out the move with the "best score".
Every "Game State" can lead to a number of possible future states based on how a player chooses to move.
Those states have their own future states based on the opponent's move and so on.
We build the "Game Tree" then we just have to walk up and down it and figure out the move with the "best score".
Recursion is a natural fit for tree traversal.
Every "Game State" can lead to a number of possible future states based on how a player chooses to move.
Those states have their own future states based on the opponent's move and so on.
We build the "Game Tree" then we just have to walk up and down it and figure out the move with the "best score".
Recursion is a natural fit for tree traversal.
Not a super common technique in Ruby. You can blow the stack if you're not careful.
Every "Game State" can lead to a number of possible future states based on how a player chooses to move.
Those states have their own future states based on the opponent's move and so on.
We build the "Game Tree" then we just have to walk up and down it and figure out the move with the "best score".
Recursion is a natural fit for tree traversal.
Not a super common technique in Ruby. You can blow the stack if you're not careful.
(Recent Rubies do support Tail Call Optimization, not sure how involved this is.)
Y'all saw A Beautiful Mind, right?
Minimax works because Tic Tac Toe is a Zero-Sum game with perfect information.
Y'all saw A Beautiful Mind, right?
Minimax works because Tic Tac Toe is a Zero-Sum game with perfect information.
God we are so smart.
Really just a coding simplification.
Has to do with how we track the scores for alternating players.
Test prevention of forks. If the opponent forks, we've lost already.
(Sidebar: How many ways can you set up a fork?)
Test prevention of forks. If the opponent forks, we've lost already.
(Sidebar: How many ways can you set up a fork?)
Test that we block opponent wins.
Test prevention of forks. If the opponent forks, we've lost already.
(Sidebar: How many ways can you set up a fork?)
Test that we block opponent wins.
Test that we take available wins.
Well, run Rubinius (currently not installable on Yosemite T_T
).
Or rewrite it in: C, Lisp, OCaml, etc.
Well, run Rubinius (currently not installable on Yosemite T_T
).
Or rewrite it in: C, Lisp, OCaml, etc.
"Here's a nickel kid, get yerself a real programming language."
Well, run Rubinius (currently not installable on Yosemite T_T
).
Or rewrite it in: C, Lisp, OCaml, etc.
"Here's a nickel kid, get yerself a real programming language."
^^ #jerk
Look into Alpha-Beta Pruning.
Look into Principal Variation Search.
Look into Alpha-Beta Pruning.
Look into Principal Variation Search.
Both are fundamentally about limiting how much of the Game Tree you have to search.
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |