コード例 #1
0
        /// <summary>
        /// Клнструктор
        /// </summary>
        /// <param name="arr"></param>
        public Field(int?[] arr)
        {
            int size = 4;

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    map[i, j] = new Cell((int)arr[j + i * size], i, j);
                }
            }
            map.BindNeighbours();
            movelist = new List <int>();
        }
コード例 #2
0
        public static void MoveRight(this Cell[,] map, Cell replaced)
        {
            Field.counter++;
            Cell temp = replaced.Right;

            Field.movelist.Add(temp.Value);
            map[temp.Row, temp.Col]         = replaced;
            map[replaced.Row, replaced.Col] = temp;
            temp.Col         -= 1;
            replaced.Col     += 1;
            replaced.Previous = "right";
            temp.Previous     = "left";
            map.BindNeighbours();
            map.Print();
            Thread.Sleep(Field.delay);
        }