public bool IsValidMovePosition(IPlayer player, Directions direction)
 {
     IPlayer newPlayer = new Player(player.XPosition, player.YPosition);
     newPlayer.Move(direction);
     return ((Labyrinth[newPlayer.XPosition, newPlayer.YPosition] == 0) && (IsPlayerIsInPlayfieldRange(newPlayer)));
 }
        public void ResetPlayfield()
        {
            for (int playfieldRow = 0; playfieldRow < PLAYFIELD_SIZE; playfieldRow++)
            {
                for (int playefieldCol = 0; playefieldCol < PLAYFIELD_SIZE; playefieldCol++)
                {
                    Labyrinth[playfieldRow, playefieldCol] = -1;
                }
            }

            IPlayer player = new Player();
            Labyrinth[player.XPosition, player.YPosition] = 0;

            Directions direction = Directions.B;
            Random randomGenerator = new Random();

            while (true)
            {
                if (IsPlayerWinning(player))
                {
                    break;
                }
                else
                {
                    do
                    {
                        int randomDirection = randomGenerator.Next() % 4;
                        direction = (Directions)(randomDirection);
                        player.Move(direction);
                    }
                    while (!IsBlankMovePosition(player));
                    Labyrinth[player.XPosition, player.YPosition] = 0;
                }
            }

            for (int playfieldRow = 0; playfieldRow < PLAYFIELD_SIZE; playfieldRow++)
            {
                for (int playefieldCol = 0; playefieldCol < PLAYFIELD_SIZE; playefieldCol++)
                {
                    if (Labyrinth[playfieldRow, playefieldCol] == -1)
                    {
                        int randomNumber = randomGenerator.Next();
                        if (randomNumber % 3 == 0)
                        {
                            Labyrinth[playfieldRow, playefieldCol] = 0;
                        }
                        else
                        {
                            Labyrinth[playfieldRow, playefieldCol] = 1;
                        }
                    }
                }
            }
        }