import "std/io";
import "std/math"; // For random number generation
import "std/string";

fun main() {
    println("Welcome to the Guessing Game!");
    let secret_number = random(1, 101); // Random number between 1 and 100
    let guessed_correctly = false;

    while !guessed_correctly {
        print("Please enter your guess (1-100): ");
        let input = input();
        let guess = trim(input) as int64;
        if guess < secret_number {
            println("Too small!");
        } else if guess > secret_number {
            println("Too big!");
        } else {
            print("You guessed it! The secret number was ");
            print(secret_number);
            println(".");
            guessed_correctly = true;
        }        
    }
}