Gessing_Game/main.rs

17 lines
492 B
Rust
Raw Normal View History

2024-04-02 20:39:49 +02:00
use rand::Rng;
2024-04-02 20:51:57 +02:00
loop {
println!("Vor dir sind drei Türen");
println!("Eine von ihnen tötet dich ");
println!("Durch welche gehst du?");
println!("Gib eine Zahl zwischen 1 und 3 ein");
2024-04-02 20:59:01 +02:00
let mut secretnumber = rand::thread_rng().gen_range(1..=3);
2024-04-02 20:39:49 +02:00
let mut guess = String::new();
2024-04-02 20:51:57 +02:00
if guess > 3 {
println!("Die Tür gibt es nicht");
}; else if guess = secretnumber{
2024-04-02 20:59:01 +02:00
println!("Du bist tot");
return false
2024-04-02 20:51:57 +02:00
}
2024-04-02 20:39:49 +02:00
}