intention is dote

This commit is contained in:
vova-rs committed 2026-05-26 12:28:00 +03:00
1 parent 580894ed0a
commit c6b1b68572
6 files changed
+73 -19

No files matched your search

+7 -17
View File
@@ -1,5 +1,5 @@
const dir: [(i32, i32); 4] = [(1, 0), (0, 1), (-1, 0), (0, -1)];
#[derive(Clone)]
pub struct Agent{
@@ -15,22 +15,12 @@ impl Agent {
ang: a,
}
}
pub fn wolk_a(&mut self){
match self.ang {
0 => {
self.pos.0 += 1;
}
1 => {
self.pos.1 += 1;
}
2 => {
self.pos.0 -= 1;
}
3 => {
self.pos.1 -= 1;
}
_ => {}
}
pub fn wolk_a(&self) -> (i32, i32){
let a = dir[self.ang as usize].clone();
(a.0 + self.pos.0, a.1 + self.pos.1)
}
pub fn move_to(&mut self, pos: (i32, i32)){
self.pos = pos;
}
pub fn rotate(&mut self, a: i8){
self.ang = ((self.ang + a) % 4 + 4) % 4;