Wednesday, 19 December 2012

Cards Game Puzzle

Puzzle:- This puzzle is a game related one. Consider a game contains two participants(let is say player,comp) there are 21 cards in total and each participant can pick either 1 or 2 or 3 or 4 cards at a time. In every game first chance of picking cards is given to player and whoever takes the last card(here 21st card) will be the looser. solve the puzzle such that always comp should win the game.

Solution
if player picks x cards then computer should pick 5-x cards each round.
after four rounds 5*4 = 20 cards will be picked up then the player turn will come, as rule says he should pick atleast one card, so picks up the last card and looses the game.
this is the algorithm for which always computer will win the game.

No comments:

Post a Comment