Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Plt-D v.0.9.3
//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 int iD; public string name; public int xCord; public float numberBlts; public int reproductionBlts; public string color; } public class Program { bool WBlue = false; int count = 0; public int count12 = 0; public float percK = 1.1f; public static void Main(string[] args) { string pl1 = "blue"; string pl2 = "red"; string pl3 = "green"; string pl100 = "gray"; float blueKD = 0.1f; float allColorKAtkFromOnePlt = 0.1f; float bluePrcForAtkFronOneplt = 0.1f; float blueKAtkFromOnePlt = 1.2f; int periodIteracii = 200; Program classProg = new Program(); List<Plts> listPlts = new List<Plts>(); listPlts.Add(new Plts { iD = 1, name = "HRed", xCord = 4, numberBlts = 10f, reproductionBlts = 2, color = pl2 }); listPlts.Add(new Plts { iD = 2, name = "HBlue", xCord = 12, numberBlts = 150f, reproductionBlts = 2, color = pl1 }); listPlts.Add(new Plts { iD = 3, name = "net1", xCord = 11, numberBlts = 20f, reproductionBlts = 1, color = pl100 }); listPlts.Add(new Plts { iD = 4, name = "net2", xCord = 5, numberBlts = 5f, reproductionBlts = 1, color = pl100 }); listPlts.Add(new Plts { iD = 5, name = "net3", xCord = 8, numberBlts = 32f, reproductionBlts = 1, color = pl100 }); Console.WriteLine("Основа start: "); foreach (Plts llistPlst in listPlts) { Console.Write(" | " + llistPlst.name + " и " + llistPlst.numberBlts + " и " + llistPlst.color); } var tempColor = listPlts.First().color; while (classProg.WBlue != true) { classProg.BPlrs(pl1 ,listPlts, blueKD, bluePrcForAtkFronOneplt, blueKAtkFromOnePlt, periodIteracii); //classProg.NetPlrs(listPlts); classProg.Count1(); } ; Console.WriteLine("\nОснова2:"); foreach (Plts llistPlst in listPlts) Console.Write(" | " + llistPlst.name + " и " + llistPlst.numberBlts + " и " + llistPlst.color); Console.WriteLine(" \ncount = " + classProg.count + " count12 = " + classProg.count12); } public void Count1() { count12++; } public void BPlrs(string stringColorPlr, List<Plts> lb, float KD, float locBlueColorKAtkFromOnePlt, float locBlueKAtkFromOnePlt, int locPeriodIteracii) { string str = "blue"; var lBluePlts = SelfColor(stringColorPlr, lb); var lBlueAtk = SelfAtak(stringColorPlr, lb); // TODO: Blue Plts CalcBlts(str, lBluePlts); foreach (Plts lBP in lBluePlts) { // Console.Write(" -|- " + lBP.name + " и " + lBP.numberBlts); } foreach (Plts BAtk in lBlueAtk) { //***************************** } ChsTrgt(lBluePlts,lBlueAtk, locBlueColorKAtkFromOnePlt, locBlueKAtkFromOnePlt); WBlue = ChkDBY(lBlueAtk); // Console.WriteLine("\n count++ = " + count++ ); } public void CalcBlts( string locColorString, IEnumerable<Plts> lb) { foreach (Plts l in lb) { l.numberBlts += l.reproductionBlts; } } public void ChsTrgt(IEnumerable<Plts> lb, IEnumerable<Plts> eLb, float locBlueColorKAtkFromOnePlt, float locBlueKAtkFromOnePlt) { float totalSummBlts = 0; float totalSummEBlts = 0; float percForDf = 0; float targetToAt = 100000000; //eLb.Max(x => x.numberBlts); //max from EnumberBlts if (eLb.LongCount() == 0) { } foreach (Plts eL in eLb) { totalSummEBlts += eL.numberBlts; if (eL.numberBlts < targetToAt) { targetToAt = eL.numberBlts; } } // Console.Write(" || targetToAt = " + targetToAt); foreach (Plts l in lb) { totalSummBlts += l.numberBlts; } foreach (Plts l in lb) { foreach (Plts eL in eLb) { if (eL.numberBlts < l.numberBlts * locBlueColorKAtkFromOnePlt) { // Console.Write(" || l.numberBlts * locBlueColorKAtkFromOnePlt = " + (l.numberBlts * locBlueColorKAtkFromOnePlt) + " eL.numberBlts = " + eL.numberBlts); if ((Math.Ceiling (eL.numberBlts * locBlueKAtkFromOnePlt)) <= l.numberBlts && l.numberBlts - (Math.Ceiling (eL.numberBlts * locBlueKAtkFromOnePlt)) > 0) { Console.Write(" \neL.numberBlts * locBlueKAtkFromOnePlt = " + Math.Ceiling (eL.numberBlts * locBlueKAtkFromOnePlt) + " l.numberBlts - (Math.Floor(eL.numberBlts * locBlueKAtkFromOnePlt)) = " + (l.numberBlts - (Math.Ceiling(eL.numberBlts * locBlueKAtkFromOnePlt))) + " eL.Name = " + eL.name); float tempVar = (float) Math.Ceiling (eL.numberBlts * locBlueKAtkFromOnePlt); l.numberBlts -= tempVar; eL.numberBlts *= -1f; eL.numberBlts += tempVar; eL.color = l.color; Console.Write(" -|- " + l.name + " и " + l.numberBlts); } } else { } if (eL.color == null) { Console.Write(" ***** DBY *****"); } // if (l.numberBlts > Math.Floor(eL.numberBlts * percK)) // Console.Write("\n" + l.numberBlts + " > " + eL.numberBlts + " ("+ Math.Round((eL.numberBlts * percK)) + ")" + " " + eL.name ); // Console.Write("\n {0} {1}", Math.Floor(eL.numberBlts * percK), (eL.numberBlts * percK)); } } } public void FtStep(Plts iDSelfPlts, Plts IdEplTs) { } public bool ChkDBY( IEnumerable<Plts> lb) { if (lb.Count() == 0) return true; return false; } 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(string lStr, List<Plts> l) { var l1 = from list in l where list.color == lStr select list; return l1; } public IEnumerable<Plts> SelfAtak(string lStr, List<Plts> l) { var l1 = from list in l where list.color != lStr select list; return l1; } } }
run
|
edit
|
history
|
help
0
Side 1
credentials
Random number generator with IF
gggsggsgg
towers of hanoi
Create Sealed Class Object
ternary function
Unity Character Controller Version 1
test
asxsd