Knowee
Questions
Features
Study Tools

Carrom is a board game where two participants (teams) play. It consists of 9 white coins, 9 black coins, and a red coin. The first team to finish all their coins wins (given that red has been pocketed by one of the teams). The points are awarded based on the number of left-over coins from the losing team on the board. If the winning team has pocketed the red, they get an additional 5 points.Write a program to compute the score of the winner at the end of a round.If the number of coins left on the board is either less than 1 or greater than 9, display "Invalid Input".Input format :The input consists of an integer that corresponds to the number of coins left on the board and a character that corresponds to whether the winning team has pocketed red or not.Output format :The output displays the total points won.Print "Invalid Input" if the number of coins is less than one or greater than nine.Refer to the sample input and output for formatting specifications.Sample test cases :Input 1 :5yOutput 1 :10Input 2 :10nOutput 2 :Invalid Input

Question

Carrom is a board game where two participants (teams) play. It consists of 9 white coins, 9 black coins, and a red coin. The first team to finish all their coins wins (given that red has been pocketed by one of the teams). The points are awarded based on the number of left-over coins from the losing team on the board. If the winning team has pocketed the red, they get an additional 5 points.Write a program to compute the score of the winner at the end of a round.If the number of coins left on the board is either less than 1 or greater than 9, display "Invalid Input".Input format :The input consists of an integer that corresponds to the number of coins left on the board and a character that corresponds to whether the winning team has pocketed red or not.Output format :The output displays the total points won.Print "Invalid Input" if the number of coins is less than one or greater than nine.Refer to the sample input and output for formatting specifications.Sample test cases :Input 1 :5yOutput 1 :10Input 2 :10nOutput 2 :Invalid Input

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a Python program that fulfills the requirements:

def compute_score(coins_left, pocketed_red):
    if coins_left < 

Similar Questions

Below is given a board game that Honey and Sunny are playing. They both start from the box showing 'start'. They throw a dice that can show a number from 1 to 6. On the basis of the number that has come on dice, the player who has thrown the dice moves that many steps in the direction as represented by arrows. The boxes on which a player reaches during the game, the numbers on those boxes are added together to get the score of that player. Player reaching box representing 'end' first wins the game. If none of them is able to reach the box representing 'end' in 6 turns, the game results in a draw. Honey has the first turn.If in his first three turns, Honey gets 2, 3 and 6 on the dice, respectively, then what would be his score after three turns?

There are n𝑛 coins on the table forming a circle, and each coin is either facing up or facing down. Alice and Bob take turns to play the following game, and Alice goes first.In each operation, the player chooses a facing-up coin, removes the coin, and flips the two coins that are adjacent to it. If there are only two coins left, then one will be removed and the other won't be flipped (as it would be flipped twice). If there is only one coin left, no coins will be flipped. If there are no facing-up coins, the player loses.Decide who will win the game if they both play optimally. It can be proved that the game will end in a finite number of operations, and one of them will win.InputEach test contains multiple test cases. The first line contains the number of test cases t𝑡 (1≤t≤1001≤𝑡≤100). The description of the test cases follows.The first line of each test case contains only one positive integer n𝑛 (1≤n≤1001≤𝑛≤100), representing the number of the coins.A string s𝑠 of length n𝑛 follows on the second line of each test case, containing only "U" and "D", representing that each coin is facing up or facing down.OutputFor each test case, print "YES" if Alice will win the game, and "NO" otherwise.You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.ExampleinputCopy35UUDUD5UDDUD2UUoutputCopyYESNONO

A game is played by moving a game piece left or right along a horizontal game board. The board consists of spaces of various colors, as shown. The circle represents the initial location of the game piece.Yellow Black Green Green Red Yellow Black Black Yellow Black                  ● The following algorithm indicates how the game is played. The game continues until the game is either won by landing on the red space or lost when the piece moves off either end of the board.Step 1:Place a game piece on a space that is not red and set a counter to 0.Step 2:If the game piece is on a yellow space, move the game piece 3 positions to the left and go to step 3. Otherwise, if the game piece is on a black space, move the game piece 1 position to the left and go to step 3. Otherwise, if the game piece is on a green space, move the game piece 2 positions to the right and go to step 3.Step 3:Increase the value of the counter by 1.Step 4:If game piece is on the red space or moved off the end of the game board, the game is complete. Otherwise, go back to step 2.If a game is begun by placing the game piece on the rightmost black space for step 1, what will be the value of the counter at the end of the game?Responses2233445

23.26 LAB*: Program: Poker dice gameProgram Specifications Write a program to calculate the score from a throw of five dice. Scores are assigned to different categories for singles, three of a kind, four of a kind, five of a kind, full house, and straight. Follow each step to gradually complete all functions.Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.Step 0. Review the provided main() function. Five integer values are input and inserted into a vector. The vector is sorted and passed to FindHighScore() to determine the highest scoring category. Make no changes to main(). Stubs are provided for all remaining functions.

A,B and C play a game and the chances of their winning it in an attempt are (2/3), (1/2) and (1/4) respectively. A has the first chance, followed by B and then by C. This cycle is repeated till one of them wins the game. Then the probability that B wins is*4/2116/218/211/21

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.