Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Plt-D v.0.8
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Plts { public string name; public int xCord; public float numberBlts; public string color; } public class Program { bool WBlue = false; int count = 0; public static void Main(string[] args) { Program classProg = new Program(); List<Plts> listPlts = new List<Plts>(); listPlts.Add(new Plts { name = "HRed", xCord = 4, numberBlts = 10f, color = "red" }); listPlts.Add(new Plts { name = "HBlue", xCord = 12, numberBlts = 10f, color = "blue" }); listPlts.Add(new Plts { name = "net1", xCord = 11, numberBlts = 20f, color = "gray" }); listPlts.Add(new Plts { name = "net2", xCord = 5, numberBlts = 5f, color = "gray" }); listPlts.Add(new Plts { name = "net3", xCord = 8, numberBlts = 30f, color = "gray" }); foreach (Plts llistPlst in listPlts) Console.Write(" | Основа1: " + llistPlst.name + " и " + llistPlst.numberBlts + " и " + llistPlst.color); var tempColor = listPlts.First().color; do { classProg.BPlrs(listPlts); classProg.NetPlrs(listPlts); } while (classProg.WBlue != true); Console.WriteLine(""); foreach (Plts llistPlst in listPlts) Console.Write(" | Основа2: " + llistPlst.name + " и " + llistPlst.numberBlts + " и " + llistPlst.color); Console.ReadKey(); } public void BPlrs(List<Plts> lb) { Console.WriteLine("\n\n Blue \n"); string str = "blue"; var lBluePlts = SelfColor(lb, str); var lBlueAtk = SelfAtak(lb, str); int countBlueBltsFgt = 0; ; // TODO: Blue Plts foreach (Plts lBP in lBluePlts) { Console.Write("\n 2 | " + lBP.name + " и " + lBP.numberBlts); lBP.numberBlts += 1; countBlueBltsFgt += (int)lBP.numberBlts; } Console.WriteLine(" | countBlueBltsFgt = " + countBlueBltsFgt); Console.WriteLine("Atc"); foreach (Plts BAtk in lBlueAtk) { var temp = BAtk.numberBlts; foreach (Plts BPlts in lBluePlts) { if (BPlts.numberBlts > BAtk.numberBlts * 1.1) { float tempBlueAtc = BPlts.numberBlts * 1.3f; BPlts.numberBlts -= tempBlueAtc; BAtk.numberBlts = BAtk.numberBlts + tempBlueAtc; BAtk.color = str; } } if (temp != BAtk.numberBlts) Console.Write(" | " + BAtk.name + " и " + BAtk.numberBlts); } count++; if (count >10) WBlue = true; Console.WriteLine("\n count++ = " + count++); if (lBlueAtk.Count() == 0) { } Console.WriteLine(" "); } public void NetPlrs(List<Plts> lnet) { string str = "gray"; var netPlts = from list in lnet where list.color == "gray" select list; Console.WriteLine("Gray"); foreach (Plts lNetList in netPlts) { System.Threading.Thread.Sleep(10); Console.Write(" |Net " + lNetList.name); } Console.WriteLine(" "); } public IEnumerable<Plts> SelfColor(List<Plts> l, string lStr) { var l1 = from list in l where list.color == lStr select list; return l1; } public IEnumerable<Plts> SelfAtak(List<Plts> l, string lStr) { var l1 = from list in l where list.color != lStr select list; return l1; } } }
run
|
edit
|
history
|
help
0
First Non repeat char
Generic operator test
Event test
Fibonacci Recursive C#
Valid Substring
FromBibleC#(OOP)
Katakana Quiz
Non Generic object based class
.net Q4
a4