From ee3b0f36b024bc08fa9dc184079d0fe21c0896f1 Mon Sep 17 00:00:00 2001 From: serr Date: Wed, 25 Jun 2025 20:59:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BC=D0=B0=D0=BA=D1=80=D0=BE=D1=81=D1=8B=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20=D1=82=D0=B8=D0=BF?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D1=8F=D0=BC=D0=BE=5F=D0=BF=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D1=82,=20=D0=BF=D0=BE=D0=B2=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D1=82=5F=D0=BF=D1=80=D1=8F=D0=BC=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/turtle.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/turtle.rs b/src/turtle.rs index 3f28c40..772826d 100644 --- a/src/turtle.rs +++ b/src/turtle.rs @@ -8,7 +8,7 @@ type ImgBufU8 = ImageBuffer, Vec>; type Colour = Rgb; type Coord = (i32, i32); -macro_rules! rotation_move_combo { +macro_rules! rotation_move { ($name:ident $rot:ident) => { pub fn $name(&mut self, degrees: f64, steps: u32) { self.$rot(degrees); @@ -17,7 +17,7 @@ macro_rules! rotation_move_combo { }; } -macro_rules! move_rotation_combo { +macro_rules! move_rotation { ($name:ident $rot:ident) => { pub fn $name(&mut self, steps: u32, degrees: f64) { self.forward(steps); @@ -92,10 +92,10 @@ impl Turtle { self.angle = self.angle.rem_euclid(2.0 * std::f64::consts::PI); } - rotation_move_combo!(right_forward right); - rotation_move_combo!(left_forward left); - move_rotation_combo!(forward_right right); - move_rotation_combo!(forward_left left); + rotation_move!(right_forward right); + rotation_move!(left_forward left); + move_rotation!(forward_right right); + move_rotation!(forward_left left); pub fn forward(&mut self, steps_count: u32) { let start_pos = self.pos;