Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Planet-D v.0.6
//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 { /* foreach (Plts l in listPlts) { if (tempColor == l.color ) { classProg.WBlue = true; } else { classProg.count++; break; } }*/ 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); } public void BPlrs(List<Plts> lb) { Console.WriteLine("Blue "); string str = "blue"; var lBluePlts = from list in lb where list.color == str select list; var lBlueAtk = from list in lb where list.color != str select list; int countBlueBltsFgt = 0;; // TODO: Blue Plts foreach (Plts lBP in lBluePlts) { Console.Write(" | " + 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++; Console.WriteLine("\n count++ = " + count++); if (lBlueAtk.Count() == 0) { WBlue = true; } 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(" "); } } }
run
|
edit
|
history
|
help
0
Classes
test1.m
Triangulo de pascal
OneDrive Direct Download Generator
convert a string of numbers to a list then use a forEach to loop through the list
MightConst - Runtime Constwrapper Value (C#)
Update 2D Array
s
svsvsvsvsv
בדיקה כמה פעמים מערך אחד כלול במערך אחר