/// <summary> /// Gets the result. /// </summary> /// <param name="theethMessure">The theeth messure.</param> /// <returns></returns> public static Pont GetResult(RoothCalculationEntity theethMessure) { var pontResult = new Pont(); var sumResult = TheethsSum.GetResults(theethMessure); pontResult.Pont14To24 = CalculationBase.RoundUpResult(sumResult.SumSuperiorFour * 100 / 84); pontResult.Pont16To26 = CalculationBase.RoundUpResult(sumResult.SumSuperiorFour * 100 / 65); pontResult.ArchLong = CalculationTables.PontTable.FindPontValue(sumResult.SumSuperiorFour); return(pontResult); }
public void KorlemezVanETestRajtaVanE() { Pont p = new Pont(); p.a = 0; p.b = 0; Kor k = new Kor(); k.x = 0; k.y = 0; k.r = 1; Assert.IsTrue(Program.KorlemezVanE(p, k)); }
public void KorlemezVanETestKivulVanE() { Pont p = new Pont(); p.a = 0; p.b = 5; Kor k = new Kor(); k.x = 0; k.y = 0; k.r = 1; Assert.IsFalse(Program.KorlemezVanE(p, k)); }
//equals implementáció a hash miatt, meg amúgy is public override bool Equals(object obj) { if (obj == null) { return(false); } Pont masik = obj as Pont; if (masik == null) { return(false); } return(X == masik.X && Y == masik.Y); }
private void Form1_Load(object sender, EventArgs e) { Inicializal(); string[] eredmenyek; if (File.Exists("eredmeny.csv")) { eredmenyek = File.ReadAllLines("eredmeny.csv", Encoding.UTF8); for (int i = 0; i < eredmenyek.Length; i++) { string[] er = eredmenyek[i].Split(';'); Pont ment = new Pont(); ment.LepesSz = Convert.ToInt32(er[0]); ment.Ido = er[1]; Pontszamok.Add(ment); } } }
public Quad(string str) { string[] work = str.Split(" through "); Hi = new Pont(work[1]); work = work[0].Split(' '); if (work[0] == "toggle") { Act = ActionType.toggle; Lo = new Pont(work[1]); } else if (work[1] == "on") { Act = ActionType.turnOn; Lo = new Pont(work[2]); } else { Act = ActionType.turnOff; Lo = new Pont(work[2]); } }
private void GameEndCheck() { int p = 0; int talalat = 0; foreach (object item in jatekGbox.Controls) // pozíciók ellenőrzése a kirakáshoz { if (item is Label lab) { if (Poziciok[p].Text == lab.Text && Poziciok[p].Sor == lab.Top && Poziciok[p].Oszlop == lab.Left) { talalat++; } } p++; } MozgasfokBeallitas(); if (talalat == 16 && Game) { timer1.Enabled = false; Label lbUzenet = new Label(); lbUzenet.Parent = jatekGbox; lbUzenet.AutoSize = false; lbUzenet.Location = new Point(6, 141); lbUzenet.Size = new Size(355, 59); lbUzenet.Font = new Font("Monotype Corsiva", 26); lbUzenet.Text = "Játék vége! Gratulálok!"; lbUzenet.TextAlign = ContentAlignment.MiddleCenter; lbUzenet.ForeColor = Color.Red; lbUzenet.BackColor = Color.Gainsboro; lbUzenet.Visible = true; lbUzenet.BringToFront(); timer2.Enabled = true; jatekGbox.Enabled = false; Pont ment = new Pont(); ment.LepesSz = lepesek; ment.Ido = tbTime.Text; Pontszamok.Add(ment); } }
static void Main(string[] args) { //Mátrix létrehozása: int[,] tabla = new int[10, 10]; //0 szabad utat, 1 akadályt Random r = new Random(); for (int sor = 0; sor < 10; sor++) //külső ciklus { for (int oszlop = 0; oszlop < 10; oszlop++) //belső ciklus { if (r.Next(1, 101) <= 70) { tabla[sor, oszlop] = 0; }//endif else { tabla[sor, oszlop] = 1; }//endelse } } tabla[0, 0] = 0; //start tabla[9, 9] = 0; //end for (int i = 0; i < 10; i++) //külső ciklus { for (int j = 0; j < 10; j++) //belső ciklus { if ((i == 0 && j == 0) || (i == 9 && j == 9)) { Console.ForegroundColor = ConsoleColor.Green; Console.Write(tabla[i, j] + " ");//start,end Console.ResetColor(); } else if (tabla[i, j] == 1) { Console.ForegroundColor = ConsoleColor.Red; Console.Write(tabla[i, j] + " ");//akadály Console.ResetColor(); } else { Console.Write(tabla[i, j] + " "); } } Console.WriteLine(); } aktualis.x = 0; aktualis.y = 0; aktualis.osX = -1; aktualis.osY = -1; nyitott.Add(aktualis); //vége: 9,9 /* * ciklus amíg(NEM (elérte a célt:9,9) és nem (üres a nyitottak tömb)) * aktuális= a nyitottak első eleme (-van a célhoz) * * Végignézzük mind a 8 esetet és csak akkor rakjuk bele a nyitottak tömbe, ha * - nem akadály (nem 1) * - nincs benne a zártba (eldöntés tétele) * - nics benne a nyitottban (eldöntés tétele) * * a zárt tömbe belerakjuk az aktuális elemet * a nyitottak tömből töröljuk az aktuális elemet * //nyitott.ToList().RemoveAt(index); */ while (!(aktualis.x == 9 && aktualis.y == 9) && nyitott.Count != 0) { aktualis = nyitott[0]; vizsgal.osX = aktualis.x; vizsgal.osY = aktualis.y; if (aktualis.x + 1 >= 0 && aktualis.x + 1 <= 9 && aktualis.y >= 0 && aktualis.y <= 9 && tabla[aktualis.x + 1, aktualis.y] == 0) { vizsgal.x = aktualis.x + 1; vizsgal.y = aktualis.y; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x >= 0 && aktualis.x <= 9 && aktualis.y + 1 >= 0 && aktualis.y + 1 <= 9 && tabla[aktualis.x, aktualis.y + 1] == 0) { vizsgal.y = aktualis.y + 1; vizsgal.x = aktualis.x; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x - 1 >= 0 && aktualis.x - 1 <= 9 && aktualis.y >= 0 && aktualis.y <= 9 && tabla[aktualis.x - 1, aktualis.y] == 0) { vizsgal.x = aktualis.x - 1; vizsgal.y = aktualis.y; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x >= 0 && aktualis.x <= 9 && aktualis.y - 1 >= 0 && aktualis.y - 1 <= 9 && tabla[aktualis.x, aktualis.y - 1] == 0) { vizsgal.y = aktualis.y - 1; vizsgal.x = aktualis.x; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x + 1 >= 0 && aktualis.x + 1 <= 9 && aktualis.y + 1 >= 0 && aktualis.y + 1 <= 9 && tabla[aktualis.x + 1, aktualis.y + 1] == 0) { vizsgal.x = aktualis.x + 1; vizsgal.y = aktualis.y + 1; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x - 1 >= 0 && aktualis.x - 1 <= 9 && aktualis.y - 1 >= 0 && aktualis.y - 1 <= 9 && tabla[aktualis.x - 1, aktualis.y - 1] == 0) { vizsgal.x = aktualis.x - 1; vizsgal.y = aktualis.y - 1; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x - 1 >= 0 && aktualis.x - 1 <= 9 && aktualis.y + 1 >= 0 && aktualis.y + 1 <= 9 && tabla[aktualis.x - 1, aktualis.y + 1] == 0) { vizsgal.x = aktualis.x - 1; vizsgal.y = aktualis.y + 1; if (Check() == false) { nyitott.Add(vizsgal); } } if (aktualis.x + 1 >= 0 && aktualis.x + 1 <= 9 && aktualis.y - 1 >= 0 && aktualis.y - 1 <= 9 && tabla[aktualis.x + 1, aktualis.y - 1] == 0) { vizsgal.x = aktualis.x + 1; vizsgal.y = aktualis.y - 1; if (Check() == false) { nyitott.Add(vizsgal); } } zart.Add(aktualis); //Console.WriteLine("ok"); nyitott.RemoveAt(0); }//zart lista feltöltése List <Pont> ut = new List <Pont>(); Pont aktualisOs = aktualis; aktualisOs.x = zart[zart.Count - 1].x; aktualisOs.y = zart[zart.Count - 1].y; while (!(aktualisOs.x == -1 && aktualisOs.y == -1)) { for (int i = 0; i < zart.Count; i++) { if (zart[i].x == aktualisOs.x && zart[i].y == aktualisOs.y) { ut.Add(aktualisOs); aktualisOs.x = zart[i].osX; aktualisOs.y = zart[i].osY; break; } } } Console.WriteLine("megoldas?!\n"); Console.WriteLine(ut.Count); /*for (int i = 0; i < ut.Count; i++) * { * Console.WriteLine(ut[i].x+" "+ut[i].y); * }*/ bool szerepel = false; for (int i = 0; i < 10; i++) { //külső ciklus for (int j = 0; j < 10; j++) { //belső ciklus szerepel = false; for (int k = 0; k < ut.Count; k++) { if (ut[k].x == i && ut[k].y == j) { szerepel = true; } } if ((i == 0 && j == 0) || (i == 9 && j == 9)) { Console.ForegroundColor = ConsoleColor.Green; Console.Write(tabla[i, j] + " ");//start,end Console.ResetColor(); } else if (tabla[i, j] == 1) { Console.ForegroundColor = ConsoleColor.Red; Console.Write(tabla[i, j] + " ");//akadály Console.ResetColor(); } else if (szerepel) { Console.ForegroundColor = ConsoleColor.Blue; Console.Write(tabla[i, j] + " ");//start,end Console.ResetColor(); } else { Console.Write(tabla[i, j] + " "); } } Console.WriteLine(); } Console.ReadKey(); }//endMain
public PontViewModel(Pont tanaka) { model = tanaka; }
public PontViewModel() { model = new Pont(); }
public void xTengelyenVanETestHamis() { Pont p = new Pont(1, 0); Assert.IsTrue(p.xTengelyenVanE()); }
public void xTengelyenVanETestIgaz() { Pont p = new Pont(0, 1); Assert.IsFalse(p.xTengelyenVanE()); }
public void yTengelyenVanETestHamis() { Pont p = new Pont(1, 0); Assert.IsFalse(p.yTengelyenVanE()); }
public void yTengelyenVanETestIgaz() { Pont p = new Pont(0, 1); Assert.IsTrue(p.yTengelyenVanE()); }
public void origobanVanETestNincsOrigoban() { Pont p = new Pont(1, 1); Assert.IsFalse(p.origobanVanE()); }
public void origobanVanETestOrigobanVan() { Pont p = new Pont(0, 0); Assert.IsTrue(p.origobanVanE()); }