A game of add at most 10 This is the problem:
There are two players A and B. Player A starts and chooses a number in the range 1 to 10. Players take turn and in each step add a number in the range 1 to 10. The player who reaches 100 first wins.
In the program, player A is the user and player B is the computer. Besides that the computer must force a win whenever possible. For instance, if the player A reaches 88 at some point, the computer must choose 89, as this is the only way to force a win.
The problem i face is how do I do the forcing on the part of the computer. Need some guidance on that. 

Let's assume we will add in range $1$ to $a$ ($1 \leq a$) and we want to reach $0 \leq b$. Then, you should stay on the numbers which gives ($b$ mod $a+1$) in mod $a+1$. For example, if $a = 10$ and $b = 100$, you should say $1,12,23,34,45,56,67,78,89$. So, if you start, say $1$ and whatever computer says, say $12$ (and you can do that because computer can't say $12$ but whatever it says you can say it) and go like that, win!
For example, when you said $1$, it can say only $2, 3, 4, 5, 6, 7, 8, 9, 10, 11$ and you can say $12$ in any situation, and this goes like that.
Also you might want to think about that for fun: Let's assume we can add the numbers in a set $S$, and we want to reach $x$. Is there an algorithm which gives exact solution (as like I gave in first paragraph for a special $S$) for any $S$?
