编写一个“猜数字”游戏，该游戏逐渐递增难度。
最高数字：50
最少数字：1
每次猜测机会：5次
第一次猜测数字范围：1-10
第二次猜测数字范围：1-20
第三次猜测数字范围：1-30
第四次猜测数字范围：1-40
第五次猜测数字范围：1-50
以下是 Python 代码实现：

```python
import random

def play_game():
    max_num = 50
    min_num = 1
    chances = 5

    for i in range(5):
        max_num = min(max_num, (i+1)*10)
        answer = random.randint(min_num, max_num)
        print(f"You have {chances} chances to guess the number between {min_num} and {max_num}.")
        while chances > 0:
            guess = input("Enter your guess: ")
            if not guess.isnumeric() or int(guess) < min_num or int(guess) > max_num:
                print(f"Invalid input. You must enter a number between {min_num} and {max_num}.")
                continue
            if int(guess) == answer:
                print("Congratulations! You guessed the correct answer.")
                return
            elif int(guess) < answer:
                print("Your guess is too low.")
            else:
                print("Your guess is too high.")
            chances -= 1
            print(f"You have {chances} chances left.")
        print(f"Sorry, you ran out of chances. The correct answer was {answer}.")

play_game()

```

注意：每次循环时要更新 `max_num` 的值，确保数字范围在逐步递增。同时，需要检查玩家输入的数字是否在当前数字范围之内。