Beispiel #1
0
 private void updateMoves(int index)
 {
     _mov = new List <int> {
         PedinMoves.moveUpLeft(index),
         PedinMoves.moveUpRight(index),
         PedinMoves.moveDownLeft(index),
         PedinMoves.moveDownRight(index)
     };
 }
Beispiel #2
0
        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);
            }
        }