Daniel Cousineau
November 08, 2014
140

# Reframing The Problem - TrueNorthPHP 2014

## Daniel Cousineau

November 08, 2014

## Transcript

1. reframing
the problem

2. how to think
like a
computer
scientist

3. how to think

4. please rate me on joind.in
https://joind.in/12724

5. how to think
like a
computer
scientist

6. to solve our problem, we must
first invent the universe

7. mental set

8. functional fixedness

9. reduction

10. go rubber
duck
yourself

11. 4 1 2
6 3
7 5 8

12. 4 1 2
6 3
7 5 8
1 2
4 6 3
7 5 8
up

13. 4 1 2
6 3
7 5 8
1 2
4 6 3
7 5 8
up
1 2
4 6 3
7 5 8
right

14. 4 1 2
6 3
7 5 8
1 2
4 6 3
7 5 8
up
1 2
4 6 3
7 5 8
right
4 1 2
6 3
7 5 8
right

15. A* ->
queue = expand(initial)
while queue is not empty:
dequeue move from queue
if move is solution:
return move
concat expand(move) to queue
sort queue by heuristic

16. expand(state) ->
moves = []
if left valid move:
if right valid move:
if up valid move:
if down valid move:
return moves

17. 4 1 2
6 3
7 5 8

18. 4 1 2
6 3
7 5 8
4 2
6 1 3
7 5 8
4 1 2
6 3
7 5 8
4 1 2
6 5 3
7 8
4 1 2
6 3
7 5 8

19. heuristic(state) ->
manhattan(state) + outofplace(state)

20. heuristic

21. so what did
we learn?

22. don’t fixate

23. pull back,
abstract

24. write down
everything you
know

25. if all else fails,