[JetBrains Academy project — medium]
Description: Playing with friends is pure fun, but getting ahead of them is even more enjoyable. Invite a friend to play the Last Pencil, a game where you decide who wins. In this project, your opponent is a computer that is an expert in the game. But it's up to you to choose who wins.
Step 1: You and your friend decided to play a simple pen-and-paper game. There's one catch — you have only pencils but no paper; the last piece of paper is gone for your beautiful drawings. As a joke, your friend pulls all the pencils out of the case onto the table and says: "Your turn!"
Step 2: Your friend's suggestion surprised you a little bit. After a couple of "No, you" retaliations, you decided that it would be more convenient to input the initial conditions to determine who goes first, and how many pencils there are on the table.
Step 3: An interesting idea has come to your mind. Let's change the rules of game. Players take turns taking X pencils until none of them remain.
Step 4: You took all the pencils in one turn. Your friend decided that it was unfair and somehow took a negative number of pencils! Who is the winner? Let's add the winning condition!
Step 5: You've played several games and found out that there's only one winning strategy. Your friend suggested implementing a bot to add a certain degree of randomness to the game.