·
·
·
·
·
·
·
·
·
[0][1][2][3][4][5][6][7][8]
Brute force · recursion
▸1ways(s):2 if s = 0: return 1 // the empty sequence3 total ← 04 for j ← 1 to 6:5 if j <= s:6 total ← total + ways(s − j)7 return total // recomputes the same s repeatedly
state
- n8
- faces1..6
- ways(0)1