Beispiel #1
0
        public void Shift(int position)
        {
            int x, y;

            PositionToCoordinates(position, out x, out y);
            if (Math.Abs(x0 - x) + Math.Abs(y0 - y) != 1)
            {
                return;
            }
            field[x0, y0] = field[x, y];
            field[x, y]   = 0;
            x0            = x;
            y0            = y;
            counter++;
            moves++;
            GameMemento state = new GameMemento(field, x0, y0, counter);

            gameCaretaker.Save(state);
        }