kisame1313

Untitled

Jul 18th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. public class Kata
  2. {
  3.   public static string DuckDuckGoose ( Player [] players, int goose )
  4.         {
  5.             if ( goose <= players.Length )
  6.             {
  7.                 goose = goose > 0 ? goose - 1 : goose;
  8.                 return players[goose].Name;
  9.             }
  10.             else
  11.             {
  12.                 return goose % players.Length == 0 ? players[players.Length].Name : players [goose % players.Length].Name;
  13.                  
  14.             }
  15.     }
  16. public class Player
  17.   {
  18.   public string Name {get;set;}
  19.  
  20.   public Player (string name)
  21.     {
  22.       this.Name = name;
  23.     }
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment