private void drawPoints() { img1.Clear(Color.Black); int red = 0, yellow = 0; Pedin r = new Pedin(-1, Color.Red); Pedin y = new Pedin(-1, Color.Yellow); foreach (Pedin x in pedins) { if (x.Color == Color.Red) { red++; } else { yellow++; } } img1.DrawImage(r.Image, new Point(10, 7)); img1.DrawString(red.ToString(), new Font("Arial", 25), new SolidBrush(Color.Cyan), new Point(75, 12)); if (red != 0 && yellow != 0) { img1.DrawImage((redTurn ? r : y).Image, new Point(225, 7)); } else { enableClick = true; img1.DrawString("Vince il " + (yellow == 0 ? "Rosso" : "Giallo"), new Font("Arial", 25), new SolidBrush(yellow == 0 ? Color.Red : Color.Yellow), new Point(150, 12)); } img1.DrawImage(y.Image, new Point(440, 7)); img1.DrawString(yellow.ToString(), new Font("Arial", 25), new SolidBrush(Color.Cyan), new Point(375, 12)); pictureBox2.Image = im1; }
private void drawPoints() { img1.Clear(Color.Black); int red = 0, yellow = 0; Pedin r = new Pedin(-1, Color.Red); Pedin y = new Pedin(-1, Color.Yellow); foreach (Pedin x in pedins) { if (x.Color == Color.Red) { red++; } else { yellow++; } } img1.DrawImage(r.Image, new Point(10, 7)); img1.DrawString(red.ToString(), new Font("Arial", 25), new SolidBrush(Color.Cyan), new Point(75, 12)); if (red != 0 && yellow != 0) { img1.DrawImage((redTurn ? r : y).Image, new Point(225, 7)); } else { enableClick = true; img1.DrawString("Vince il " + (yellow == 0 ? "Rosso" : "Giallo"), new Font("Arial", 25), new SolidBrush(yellow == 0 ? Color.Red : Color.Yellow), new Point(150, 12)); } img1.DrawImage(y.Image, new Point(440, 7)); img1.DrawString(yellow.ToString(), new Font("Arial", 25), new SolidBrush(Color.Cyan), new Point(375, 12)); pictureBox2.Image = im1; }
private void drawPedin(Pedin x) { img.DrawImage(x.Image, x.Coord); }
private void updateIndex2(Pedin x, int index) { }
private void drawScheme(Pedin p, bool white) { if (p.Index != -1) finalmoves.Clear(); List<int> y = p.Move; img.Clear(Color.Black); drawPoints(); List<int> lst = new List<int>{00,02,04,06,08,11,13,15,17,19, 20,22,24,26,28,31,33,35,37,39,40,42,44,46,48,51,53,55, 57,59,60,62,64,66,68,71,73,75,77,79,80,82,84,86,88,91, 93,95,97,99}; for (int a = 0; a < 11; a++) { img.DrawLine(Pens.Lime, a * 50, 0, a * 50, 500); img.DrawLine(Pens.Lime, 0, a * 50, 500, a * 50); } foreach (int x in lst) { colorCube(x, Color.Cyan); } //{_ul,_ur,_dl,_dr if (y.Count == 4 && oldcube != -1 && p.Index != -1) { if (p.isDama || p.Color == Color.Yellow) { if (pedinsContainIndex(y[0]).Item1 == -1 && usableNum.Contains(y[0])) { colorCube(y[0], Color.Lime); finalmoves.Add(new Tuple<int, int>(-1, y[0])); } else if (pedinsContainIndex(y[0]).Item1 != -1 && pedinsContainIndex(y[0]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveUpLeft(y[0])).Item1 == -1) { colorCube(PedinMoves.moveUpLeft(y[0]), Color.Lime); colorCube(y[0], Color.Violet); finalmoves.Add(new Tuple<int, int>(y[0], PedinMoves.moveUpLeft(y[0]))); } if (pedinsContainIndex(y[1]).Item1 == -1 && usableNum.Contains(y[1])) { colorCube(y[1], Color.Lime); finalmoves.Add(new Tuple<int, int>(-1, y[1])); } else if (pedinsContainIndex(y[1]).Item1 != -1 && pedinsContainIndex(y[1]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveUpRight(y[1])).Item1 == -1) { colorCube(PedinMoves.moveUpRight(y[1]), Color.Lime); colorCube(y[1], Color.Violet); finalmoves.Add(new Tuple<int, int>(y[1], PedinMoves.moveUpRight(y[1]))); ; } } if (p.isDama || p.Color == Color.Red) { if (pedinsContainIndex(y[2]).Item1 == -1 && usableNum.Contains(y[2])) { colorCube(y[2], Color.Lime); finalmoves.Add(new Tuple<int, int>(-1, y[2])); } else if (pedinsContainIndex(y[2]).Item1 != -1 && pedinsContainIndex(y[2]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveDownLeft(y[2])).Item1 == -1) { colorCube(PedinMoves.moveDownLeft(y[2]), Color.Lime); colorCube(y[2], Color.Violet); finalmoves.Add(new Tuple<int, int>(y[2], PedinMoves.moveDownLeft(y[2]))); } if (pedinsContainIndex(y[3]).Item1 == -1 && usableNum.Contains(y[3])) { colorCube(y[3], Color.Lime); finalmoves.Add(new Tuple<int, int>(-1, y[3])); } else if (pedinsContainIndex(y[3]).Item1 != -1 && pedinsContainIndex(y[3]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveDownRight(y[3])).Item1 == -1) { colorCube(PedinMoves.moveDownRight(y[3]), Color.Lime); colorCube(y[3], Color.Violet); finalmoves.Add(new Tuple<int, int>(y[3], PedinMoves.moveDownRight(y[3]))); } } } if (white) colorCube(p.Index, Color.White); foreach (Pedin x in pedins) { drawPedin(x); } }
private void updateIndex2(Pedin x, int index) { }
private void drawPedin(Pedin x) { img.DrawImage(x.Image, x.Coord); }
private void drawScheme(Pedin p, bool white) { if (p.Index != -1) { finalmoves.Clear(); } List <int> y = p.Move; img.Clear(Color.Black); drawPoints(); List <int> lst = new List <int> { 00, 02, 04, 06, 08, 11, 13, 15, 17, 19, 20, 22, 24, 26, 28, 31, 33, 35, 37, 39, 40, 42, 44, 46, 48, 51, 53, 55, 57, 59, 60, 62, 64, 66, 68, 71, 73, 75, 77, 79, 80, 82, 84, 86, 88, 91, 93, 95, 97, 99 }; for (int a = 0; a < 11; a++) { img.DrawLine(Pens.Lime, a * 50, 0, a * 50, 500); img.DrawLine(Pens.Lime, 0, a * 50, 500, a * 50); } foreach (int x in lst) { colorCube(x, Color.Cyan); } //{_ul,_ur,_dl,_dr if (y.Count == 4 && oldcube != -1 && p.Index != -1) { if (p.isDama || p.Color == Color.Yellow) { if (pedinsContainIndex(y[0]).Item1 == -1 && usableNum.Contains(y[0])) { colorCube(y[0], Color.Lime); finalmoves.Add(new Tuple <int, int>(-1, y[0])); } else if (pedinsContainIndex(y[0]).Item1 != -1 && pedinsContainIndex(y[0]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveUpLeft(y[0])).Item1 == -1) { colorCube(PedinMoves.moveUpLeft(y[0]), Color.Lime); colorCube(y[0], Color.Violet); finalmoves.Add(new Tuple <int, int>(y[0], PedinMoves.moveUpLeft(y[0]))); } if (pedinsContainIndex(y[1]).Item1 == -1 && usableNum.Contains(y[1])) { colorCube(y[1], Color.Lime); finalmoves.Add(new Tuple <int, int>(-1, y[1])); } else if (pedinsContainIndex(y[1]).Item1 != -1 && pedinsContainIndex(y[1]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveUpRight(y[1])).Item1 == -1) { colorCube(PedinMoves.moveUpRight(y[1]), Color.Lime); colorCube(y[1], Color.Violet); finalmoves.Add(new Tuple <int, int>(y[1], PedinMoves.moveUpRight(y[1])));; } } if (p.isDama || p.Color == Color.Red) { if (pedinsContainIndex(y[2]).Item1 == -1 && usableNum.Contains(y[2])) { colorCube(y[2], Color.Lime); finalmoves.Add(new Tuple <int, int>(-1, y[2])); } else if (pedinsContainIndex(y[2]).Item1 != -1 && pedinsContainIndex(y[2]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveDownLeft(y[2])).Item1 == -1) { colorCube(PedinMoves.moveDownLeft(y[2]), Color.Lime); colorCube(y[2], Color.Violet); finalmoves.Add(new Tuple <int, int>(y[2], PedinMoves.moveDownLeft(y[2]))); } if (pedinsContainIndex(y[3]).Item1 == -1 && usableNum.Contains(y[3])) { colorCube(y[3], Color.Lime); finalmoves.Add(new Tuple <int, int>(-1, y[3])); } else if (pedinsContainIndex(y[3]).Item1 != -1 && pedinsContainIndex(y[3]).Item2 != p.Color && pedinsContainIndex(PedinMoves.moveDownRight(y[3])).Item1 == -1) { colorCube(PedinMoves.moveDownRight(y[3]), Color.Lime); colorCube(y[3], Color.Violet); finalmoves.Add(new Tuple <int, int>(y[3], PedinMoves.moveDownRight(y[3]))); } } } if (white) { colorCube(p.Index, Color.White); } foreach (Pedin x in pedins) { drawPedin(x); } }