Your question was a little vague, but I think what you want is something like:
-Make a variable for storing the number of slides so far - start it with 0.
-When users does a slide, add one to that variable.
-After the slide has been completed, check if they've won; assuming they have, thentell them and the game.
-Else, check if the number of slides so far = the limit; assuming they have, then tell them they've lost. Else, wait for the next move.