adventjs-issues icon indicating copy to clipboard operation
adventjs-issues copied to clipboard

consulta challenge 25

Open wayaba opened this issue 3 years ago • 0 comments

Buenas, tengo esta resolucion que pasa los test pero aun asi me dice que no esta bien.. me podrias ayudar a ver donde esta el error?

export default function canMouseEat(direction, game) {
  let indexX = game.findIndex((x) => x.find((e) => e === "m"));
  let indexY = game[indexX].findIndex((x) => x === "m");

  if (indexX === null || indexY === null) return false;

  let directionMap = {
    up: { row: indexX - 1, col: indexY },
    down: { row: indexX + 1, col: indexY },
    left: { row: indexX, col: indexY - 1 },
    right: { row: indexX, col: indexY + 1 },
  };
 
  return (
    game[directionMap[direction].row][directionMap[direction].col] !==
      undefined &&
    game[directionMap[direction].row][directionMap[direction].col] === "*"
  );
}

Gracias!

wayaba avatar Sep 13 '22 19:09 wayaba