start method

void start()

Starts the game loop.

Implementation

void start() {
  print("🎮 Welcome to Guess the Number!");

  var playAgain = true;

  while (playAgain) {
    _playLevel(1, 10, "Level 1: Guess a number between 1 and 10");
    _playLevel(1, 50, "Level 2: Guess a number between 1 and 50");

    stdout.write("Play again? (y/n): ");
    final choice = stdin.readLineSync();
    playAgain = (choice?.toLowerCase() == 'y');
  }

  print("Thanks for playing! 👋");
}