public void CreateMatrix(int peiceSize, int locX, int locY)
        {
            Matrix = new PuzzlePeice[9];
            int[] values = RandomArray();

            Matrix[0] = new PuzzlePeice {
                X = locX, Y = locY, Value = values[0]
            };
            Matrix[1] = new PuzzlePeice {
                X = locX, Y = locY + peiceSize, Value = values[1]
            };
            Matrix[2] = new PuzzlePeice {
                X = locX, Y = locY + peiceSize * 2, Value = values[2]
            };
            Matrix[3] = new PuzzlePeice {
                X = locX + peiceSize, Y = locY, Value = values[3]
            };
            Matrix[4] = new PuzzlePeice {
                X = locX + peiceSize, Y = locY + peiceSize, Value = values[4]
            };
            Matrix[5] = new PuzzlePeice {
                X = locX + peiceSize, Y = locY + peiceSize * 2, Value = values[5]
            };
            Matrix[6] = new PuzzlePeice {
                X = locX + peiceSize * 2, Y = locY, Value = values[6]
            };
            Matrix[7] = new PuzzlePeice {
                X = locX + peiceSize * 2, Y = locY + peiceSize, Value = values[7]
            };
            Matrix[8] = new PuzzlePeice {
                X = locX + peiceSize * 2, Y = locY + peiceSize * 2, Value = values[8]
            };

            Matrix = Matrix.OrderBy(x => x.Value).ToArray();
        }
        public void SwapLocation(PuzzlePeice peice)
        {
            int x = peice.X;
            int y = peice.Y;

            peice.X = X;
            peice.Y = Y;

            X = x;
            Y = y;
        }