Dynamic Programming, Puzzle, Matches Puzzle, Water Jug Puzzle: based on the literature: Winston, Operations Research: Applications and Algorithms, 4th Edition:
Ch. 18. Deterministic Dynamic Programming
2. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
3. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
# Sisa Korek Api
4. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
# Sisa Korek Api
30
5. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
# Sisa Korek Api
me take first 30
6. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
+ 4
me take first 30
7. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
+ 4
me take first 30
8. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
+ 4
me take first 30
9. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
+ 4
+ 4
me take first 30
10. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
me take first 30
11. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
me take first 30
12. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
me take first 30
13. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
me take first 30
14. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
15. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
16. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
17. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
18. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
19. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
20. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
21. Matches Puzzle
30 matches
2 player (me vs opponent)
take 1 , 2 or 3 matches
me take first
the last person with 1 match is the
loser
Me Opponent
1
5
# Sisa Korek Api
9
13
+ 4
+ 4
+ 4
17
+ 4
21
+ 4
25
+ 4
29
+ 4
me take first 30
22. Exercise 1
Suppose there are 40 matches on a table.
I begin by picking up 1, 2, 3, or 4 matches.
Then my opponent must pick up 1, 2, 3, or 4 matches.
We continue until the last match is picked up.
The player who picks up the last match is the loser.
Can I be sure of victory? If so, how?
Winston, Operations Research: Applications and Algorithms, 4th Edition:
Ch. 18. Deterministic Dynamic Programming
18.1 Problem A, no.1
23. Water Jug Problem
9 gallon 4 gallon
Bagaimana saya bisa mendapatkan tepat 6
gallon dari dua gallon dengan ukuran 9 dan 4
ini?
24. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
25. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
26. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
27. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
28. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
29. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
30. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
31. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
32. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
33. Water Jug Problem
9 gallon 4 gallon
6 0
6 4
9 1
0 1
1 0
1 4
5 0
5 4
9 0
0 0
9
4
34. Exercise 2
Given a 7-oz cup and a 3-oz cup, explain how we can return
from a well with 5 oz of water.
Winston, Operations Research: Applications and Algorithms, 4th Edition:
Ch. 18. Deterministic Dynamic Programming
18.1 Problem B, no.4
Exercise 3
Given a 5 gallon water jug and a 3 gallon water jug, explain how
we can return from a well with 4 gallon of water.
Problem from the movie DIE HARD 3: Die Hard with a Vengeance (1995)