diff --git a/src/components/organisms/TurtleGraphics.tsx b/src/components/organisms/TurtleGraphics.tsx index 95afe4fe..36ddbc4a 100644 --- a/src/components/organisms/TurtleGraphics.tsx +++ b/src/components/organisms/TurtleGraphics.tsx @@ -16,7 +16,7 @@ import { TurtleGraphicsController } from '../molecules/TurtleGraphicsController' const CHARACTER_DIRS = ['N', 'E', 'S', 'W']; const DX = [0, 1, 0, -1]; -const DY = [-1, 0, 1, 0]; +const DY = [1, 0, -1, 0]; const charToRotateStyle = { N: 'rotate(180deg)', @@ -254,28 +254,32 @@ export const TurtleGraphics = forwardRef - {board.map((columns, rowIndex) => - columns.map((color, columnIndex) => ( - handleClickCell(columnIndex, rowIndex)} - onContextMenu={(e) => handleContextMenu(e, columnIndex, rowIndex)} - /> - )) - )} + {[...board] + .reverse() + .map((columns, rowIndex) => + columns.map((color, columnIndex) => ( + handleClickCell(columnIndex, GRID_ROWS - rowIndex - 1)} + onContextMenu={(e) => handleContextMenu(e, columnIndex, GRID_ROWS - rowIndex - 1)} + /> + )) + )} {characters.map((character) => ( handleClickCharacter(character)} onContextMenu={(e) => handleContextMenu(e, character.x, character.y)} diff --git a/src/problems/traceProgram.ts b/src/problems/traceProgram.ts index 725d2492..633c0192 100644 --- a/src/problems/traceProgram.ts +++ b/src/problems/traceProgram.ts @@ -118,7 +118,7 @@ class Scope { } const dirs = ['N', 'E', 'S', 'W']; const dx = [0, 1, 0, -1]; -const dy = [-1, 0, 1, 0]; +const dy = [1, 0, -1, 0]; const board = Array.from({ length: ${GRID_ROWS} }, () => Array.from({ length: ${GRID_COLUMNS} }, () => '${EMPTY_COLOR}')); class Character { constructor(x = ${Math.floor(GRID_COLUMNS / 2)}, y = ${Math.floor(GRID_ROWS / 2)}, color = '${DEFAULT_COLOR}') {