y6_circling_bot/
y6_circling_bot.rs

1use asciicker_rs::y6::prelude::*;
2
3const RADIUS: f32 = 4f32;
4
5#[tokio::main]
6async fn main() {
7    let bot = Bot::new("player", "ws://asciicker.com/ws/y6/", true);
8    let (threads, data) = match bot.run().await {
9        Err(e) => panic!("Failed to run the bot: {:?}", e),
10        Ok(stuff) => stuff,
11    };
12    let mut i = 0f32;
13    loop {
14        match *threads.0.is_finished.lock().await {
15            true => {
16                println!("{:?}", threads.0.thread.await);
17                return;
18            }
19            _ => {}
20        };
21        let mut bot = data.0.lock().await;
22        let x = i.cos() * RADIUS;
23        let y = i.sin() * RADIUS;
24        bot.pose.position = [x, y, 300f32];
25        i += 0.00001;
26        if i >= std::f32::consts::PI * 2f32 {
27            i = 0f32;
28        }
29    }
30}