Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Japanese_Roulette
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] bullets = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- string[] players = Console.ReadLine().Split(' ');
- bool dead = false;
- int index = 0;
- for (int i = 0; i < bullets.Length; i++)
- {
- if (bullets[i] == 1)
- {
- index = i;
- break;
- }
- }
- for (int i = 0; i < players.Length; i++)
- {
- string[] tokens = players[i].Split(',');
- string direction = tokens[1];
- int spin = int.Parse(tokens[0]);
- switch (direction)
- {
- case "Right":
- index = (index + spin) % bullets.Length;
- break;
- case "Left":
- if (index - spin < 0)
- {
- index = bullets.Length - (Math.Abs(index - spin) % bullets.Length);
- }
- else
- {
- index -= spin;
- }
- break;
- }
- if (index == 2)
- {
- Console.WriteLine($"Game over! Player {i} is dead.");
- dead = true;
- break;
- }
- index = index + 1 == bullets.Length ? 0 : index + 1;
- }
- if (!dead)
- {
- Console.WriteLine("Everybody got lucky!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement