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