foreign fn print(); foreign fn println(); foreign fn readln() String; foreign fn random(min: Int, max: Int) Int; foreign fn parse_int(str: String) Int; fn main() { var computer: Int = random(1, 10); var tries: Int = 0; var correct: Bool = false; while !correct { print("Pick a number between 1 and 10: "); var human: Int = parse_int(readln()); if human == computer { println("You guessed the same number as me!\n"); correct = true; } else if human > computer { println("Your guess was too high.\n"); } else if human < computer { println("Your guess was too low.\n"); } tries = tries + 1; } println("It took you ", tries, " tries to guess correctly!"); }