Feature #2: Maximum Points You Can Obtain from Cards

Implement the "Maximum Points You Can Obtain from Cards" feature for our "Game" project.

Description

In this scenario, you will be working on a custom card game named Fizzle. In Fizzle, the dealer shuffles the deck and spreads out all the cards facing upwards in a linear fashion. Then, players take turns rolling a dice. Suppose the number rolled is kk. Players will then take turns to remove kk cards from the deck, but the players can only pick cards from either the deck’s right or left side. Each player’s goal is to pick out the cards with maximum points. Each numbered card has points corresponding to its number, and the faced cards, jack, queen, king, and ace, have 11, 12, 13, and 14 points, respectively.

Our task is to create a feature for Fizzle’s computer player. We will be given the deck’s current state and the number the player rolled. We need to determine the maximum score that the player can obtain on that turn.

Let’s take a look at the following example:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.