Skip to content

Placing Robot or Destination in a coordinate defined as wall. #2

@ZhiJianTan

Description

@ZhiJianTan
  1. Should add validation so user cannot place robot or destination in a coordinate previously defined as a wall

if (cellType === 'robot') { // Check if there's a wall if (cell.isWall) { alert("Cannot place robot on a wall! Please select another position."); return; } // Clear previous robot position if (robotPos) { newGrid[robotPos.row][robotPos.col].isRobot = false; } cell.isRobot = true; setRobotPos({ row, col }); } else if (cellType === 'destination') { // Check if there's a wall if (cell.isWall) { alert("Cannot place destination on a wall! Please select another position."); return; } // Clear previous destination

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions