Beta
Table tennis: Who's serving?
Description:
Your colleagues enjoy playing table tennis, but they often forget who should serve in each round. They ask you to create a program that will determine the serving player based on the current round number.
Rules
- The game starts with the first round, or
currentRound=1
. - Player 1 always starts the game by serving.
- A serving player alternates every two rounds
currentRound
cannot be a negative number or zero- The original game rules are simplified: there is no "deuce" exception (service does not alternate at every point after '10-10')
Examples
- The
Player 1
serves in the 1st round - The
Player 1
serves in the 2nd round - The
Player 2
serves in the 3rd round - The
Player 2
serves in the 4th round - The
Player 1
serves in the 5th round - The
Player 1
serves in the 6tx round - The
Player 2
serves in the 7th round - The
Player 2
serves in the 8th round - And so on
Mathematics
Similar Kata:
Stats:
Created | Feb 1, 2025 |
Published | Feb 1, 2025 |
Warriors Trained | 11 |
Total Skips | 0 |
Total Code Submissions | 31 |
Total Times Completed | 11 |
Go Completions | 11 |
Total Stars | 1 |
% of votes with a positive feedback rating | 70% of 5 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 5 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |