Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $player1 = readline();
- $StartPoints = 301;
- $result = 0;
- $count = 0;
- $uncount = 0;
- while (1) {
- $sector = readline();
- $points = intval(readline());
- if ($sector != 'Retire') {
- if ($sector == 'Single' && $points <= $StartPoints) {
- $StartPoints -= $points;
- $count++;
- }
- if ($sector == 'Double' && $points <= $StartPoints) {
- $points *= 2;
- $StartPoints -= $points;
- $count++;
- }
- if ($sector == 'Triple' && $points <= $StartPoints) {
- $points *= 3;
- $StartPoints -= $points;
- $count++;
- }
- if ($StartPoints == 0) {
- echo"$player1 won the leg with $count shots.";
- return;
- }
- if ($points > $StartPoints) {
- $StartPoints=$StartPoints;
- $uncount++;
- }
- } else {
- echo"$player1 retired after $uncount unsuccessful shots.";
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement