Skip to content

Instantly share code, notes, and snippets.

@nayakrujul
Created August 6, 2023 10:37
Show Gist options
  • Save nayakrujul/a028290f30b8f57a1efbaa74044c903c to your computer and use it in GitHub Desktop.
Save nayakrujul/a028290f30b8f57a1efbaa74044c903c to your computer and use it in GitHub Desktop.
How to play the Duck Game

How to play the duck game

This is a 2-player game.

First, we start with a line of blue rubber ducks (represented here as circles):

πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅

Now, in each turn, the current player can turn either one blue duck or two adjacent blue ducks red.

So, a valid move would be indexes 2 and 3 (0-indexed):

πŸ”΅πŸ”΅πŸ”΄πŸ”΄πŸ”΅πŸ”΅πŸ”΅

Then, the other player could choose index 0:

πŸ”΄πŸ”΅πŸ”΄πŸ”΄πŸ”΅πŸ”΅πŸ”΅

And so on. The last player to move loses.

Example game

Starting with 7 blue ducks:

Initial board

πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅

Player 1 chooses 3,4

πŸ”΅πŸ”΅πŸ”΅πŸ”΄πŸ”΄πŸ”΅πŸ”΅

Player 2 chooses 0

πŸ”΄πŸ”΅πŸ”΅πŸ”΄πŸ”΄πŸ”΅πŸ”΅

Player 1 chooses 6

πŸ”΄πŸ”΅πŸ”΅πŸ”΄πŸ”΄πŸ”΅πŸ”΄

Player 2 chooses 1,2

πŸ”΄πŸ”΄πŸ”΄πŸ”΄πŸ”΄πŸ”΅πŸ”΄

Player 1 chooses 5

πŸ”΄πŸ”΄πŸ”΄πŸ”΄πŸ”΄πŸ”΄πŸ”΄

Player 1 was the last one to move, so Player 2 wins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment