Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
How can I verify if a tuple into an array matches with other tuple in another array?

I'm building a minesweeper and the team give me the UI and I can't modify it, I've write this code, the first step that I took was create the "empty board", this one has no mines because when I tried to put the mines into it when I reload the page the mines shows up at first.

Now, I code a function that gives me random mines following the board size but now I need to compare when the user clicks on a tile is or not a mine, I tried this conditional into the function onClick (the function works well)

When I print the board in console it returns this:

Board Board

note: -1 is a state that UI provides me

And this is the function that returns the mines position:

This is the output from minePosition: This is the output from minePosition

this array of arrays gives me the mines position

Here is the condition that I tried to build but it doesn't work

let grid = boardWithoutMines(boardSize, minesInGame);
const minePosition = getMinePositions(boardSize, minesInGame);


export function onClick(position: [number, number]) {
if (minePosition.some(grid[0][1])) {
grid[position[0]][position[1]] = CellEnum.Mine
} else {
grid[position[0]][position[1]] = CellEnum.Cero
}
setGrid(grid);
}

Ignore the setGrid(grid) at the end, this functions just render the click

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda