hacking_test/
hacking_test.rs

1use protected_integer::ProtectedInteger;
2
3fn main() {
4    let mut money:ProtectedInteger<i16> = ProtectedInteger::new(123);
5    println!("The initial amount of money is {}", money.get().to_value());
6    println!("Press Enter to increment it by 1");
7    println!("Try searching and modifying this value with Cheat Engine");
8    println!("Input 'quit' to exit");
9    loop {
10        let mut input = String::new();
11        std::io::stdin().read_line(&mut input).unwrap();
12        let input = input.trim();
13        if input == "quit" {
14            println!("Exiting...");
15            break;
16        }
17        if !money.check() {
18            println!("Hacking detected!");
19        }
20        money.set(money.get().to_value() + 1);        
21        println!("The money is now {}", money.get().to_value());
22    }
23}