vendredi 19 mars 2021

how to populate a 3 x 3 grid randomly in java script?

I have a 2D grid of 3x3 points.

every point in this grid has an own coordinate (x,y).

The user can choose a random number between 1 and 9 as input. Depending on which number the user has chosen, random points are filled accordingly in the grid. For example, if the user selects 9, all points in the grid are always occupied. if the user selects 8, one random point is always free and so on.

has someone a tipp for me how to do that in java script?

I've tried it with a 2D array but that did not work. I'm absolutely new in programming. Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire