public static string Translate(this FlowerKind color) { if (GameManager.Instance.language == Language.ko_KR) { switch (color) { case FlowerKind.chrysanthemum: return("국화"); case FlowerKind.morning_glory: return("나팔꽃"); case FlowerKind.camellia: return("동백꽃"); case FlowerKind.lily: return("백합"); case FlowerKind.azalea: return("진달래"); case FlowerKind.rose: return("장미"); case FlowerKind.cosmos: return("코스모스"); case FlowerKind.tulip: return("튤립"); } } return("Invalid"); }
private static Flower[] LoadIrisData() { String path = @"C:\Users\Intel\Desktop\iris.txt"; String[] flowersData = File.ReadAllLines(path); List <Flower> flowers = new List <Flower>(); int ie = 0; foreach (String flowerLine in flowersData) { ie++; String[] flowerDataSep = flowerLine.Split(','); FlowerKind kind = FlowerKind.Setosa; if (flowerDataSep[4] == "Iris-setosa") { kind = FlowerKind.Setosa; } else if (flowerDataSep[4] == "Iris-versicolor") { kind = FlowerKind.VersiColor; } else if (flowerDataSep[4] == "Iris-virginica") { kind = FlowerKind.Virginica; } flowers.Add(new Flower { CupLength = Convert.ToDouble(flowerDataSep[0], new CultureInfo("en-US")), CupWidth = Convert.ToDouble(flowerDataSep[1], new CultureInfo("en-US")), PetalLength = Convert.ToDouble(flowerDataSep[2], new CultureInfo("en-US")), PetalWidth = Convert.ToDouble(flowerDataSep[3], new CultureInfo("en-US")), Kind = kind }); } return(flowers.ToArray()); }
public Flower(FlowerKind kind, FlowerColor color, string id) : base(id) { this.kind = kind; this.color = color; Name = string.Format("{0}({1})", kind.Translate(), color.Translate()); }
static void Main(string[] args) { _rand = new Random(); Int32[] elements = new Int32[20]; for (Int32 i = 0; i < elements.Length; i++) { elements[i] = _rand.Next(0, 100); } for (Int32 i = 0; i < elements.Length; i++) { Console.WriteLine(" Element " + (i + 1) + " = " + elements[i]); } Console.WriteLine(); //Int32[] shuffled; //Boolean success = Shuffle(elements, out shuffled); //if (success) // for(Int32 i = 0; i < shuffled.Length; i++) // Console.WriteLine(" Element " + (i + 1) + " = " + shuffled[i]); Int32[] normalized; Int32 min = elements.Min(); Int32 max = elements.Max(); Boolean succ = Normalize(elements, min, max, 20, 30, out normalized); //if(succ) // foreach(Int32 item in normalized) // Console.WriteLine(item); String path = @"iris.txt"; String[] flowersData = File.ReadAllLines(path); List <Flower> flowers = new List <Flower>(); int ie = 0; foreach (String flowerLine in flowersData) { ie++; String[] flowerDataSep = flowerLine.Split(','); FlowerKind kind = FlowerKind.Setosa; if (flowerDataSep[4] == "Iris-setosa") { kind = FlowerKind.Setosa; } else if (flowerDataSep[4] == "Iris-versicolor") { kind = FlowerKind.VersiColor; } else if (flowerDataSep[4] == "Iris-virginica") { kind = FlowerKind.Virginica; } flowers.Add(new Flower { CupLength = Convert.ToDouble(flowerDataSep[0], new CultureInfo("en-US")), CupWidth = Convert.ToDouble(flowerDataSep[1], new CultureInfo("en-US")), PetalLength = Convert.ToDouble(flowerDataSep[2], new CultureInfo("en-US")), PetalWidth = Convert.ToDouble(flowerDataSep[3], new CultureInfo("en-US")), Kind = kind }); } Flower[] flowersShuffled = null; Shuffle(flowers.ToArray(), out flowersShuffled); Console.ReadKey(); }