Place a random amount of numbers inside a grid that have a duplicate value

82 Views Asked by At

I have been working on a project where I have to create a grid. Inside the grid are 19 rows, with each n-amount of cells. Every cell has an alphabetical value that is hidden.

I want to show a number inside some cells, but there are some conditions that have to be met before I can show that number.

  • Every row has to have at least 1 number shown.
  • Every number has to appear on at least 2 different rows.
  • Every number is assigned an alphabetical value. (e.g. 1 = 'B', 2 = 'D', 3 = 'Z', etc...), those values are hidden, but they have to be the same for every number (e.g. an 'A' which has the value of 4, can not have the value of 8 on a different row).

It would have look a little bit like this: a grid with numbers randomly placed inside of it

I am really struggling to find a solution. I have found ways link different numbers to different letters, I can place them inside the grid, but I can't randomly remove them, as then there will be a change that a number will only appear once.

I hope this is somewhat clear what I am trying to achieve and if someone can help giving me a direction with how to proceed, that would be absolutely grand.

Btw: this is for a hobby project, not a school assignment.

0

There are 0 best solutions below