From 3b2e00b2b405374c0ea250f1758bb694732b7ad6 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 04:24:24 -0500 Subject: [PATCH] refactor: update turnToFace method to synchronize turtle facing state with global variable --- server/states/BaseState.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/states/BaseState.js b/server/states/BaseState.js index a603208..f06e4f4 100644 --- a/server/states/BaseState.js +++ b/server/states/BaseState.js @@ -130,13 +130,13 @@ export class BaseState { const diff = (targetFacing - currentFacing + 4) % 4; if (diff === 1) { - await this.exec('return turtle.turnRight()'); + await this.exec(`turtle.turnRight(); _G._turtleFacing = ${targetFacing}`); this.turtle.facing = targetFacing; } else if (diff === 2) { - await this.exec('turtle.turnRight(); return turtle.turnRight()'); + await this.exec(`turtle.turnRight(); turtle.turnRight(); _G._turtleFacing = ${targetFacing}`); this.turtle.facing = targetFacing; } else if (diff === 3) { - await this.exec('return turtle.turnLeft()'); + await this.exec(`turtle.turnLeft(); _G._turtleFacing = ${targetFacing}`); this.turtle.facing = targetFacing; }