Randomize a Pokémon trainer

Run Settings
LanguageC#
Language Version
Run Command
using System; using System.IO; using System.Linq; using System.Collections.Generic; class MainClass { static void Main() { var types = File.ReadAllLines("Types").ToList(); var chosen = new List<int>(); Random rand = new Random(); Console.WriteLine("Choose two of the following types:"); for(int i = 0; i < 4; i++) { int x; do { x = rand.Next(types.Count); } while(chosen.Any(y => y == x)); chosen.Add(x); } chosen.OrderBy(x => x).ToList().ForEach(x => Console.WriteLine(types.ElementAt(x))); Console.WriteLine(); //7 stats 3*d10 var stats = new List<int>(); int numStats = 7; while(stats.Count < numStats) { stats.Add(rand.Next(10)+1+3); if(stats.Count(stat => stat <= 4) >= 2) { stats.Clear(); } } Console.WriteLine("Stats to distribute:"); stats.ForEach(stat => Console.WriteLine(stat)); Console.WriteLine($"(A total of {stats.Sum()} points)"); Console.WriteLine(); //money = 300*d10 Console.WriteLine($"Your starting balance is {(rand.Next(10)+1)*300} pokécoins"); } }
Normal Fire Water Electric Grass Ice Fighting Poison Ground Flying Psychic Bug Rock Ghost Dragon Dark Steel Fairy
Editor Settings
Theme
Key bindings
Full width
Lines