Hey everyone. I am re-writing the Oh n0 game, developed by Martin Kool in C++. If you are unfamiliar with how the game works, check it out:
http://0hn0.com/
Basically, the game revolves around a matrix, where the value in the cell represents the cells visibility, going up, down, left and right, but not diagonal.
IE:
1 | 1 | 0
0 | 2 | 2
0 | 1 | 2
Is a valid board because each cell can see each other, however this is not valid:
1 | 1 | 0
0 | 2 | 1
0 | 1 | 2
because the "1" on [1][2] has a visibility of 1 but it can see 2 cells (cells that are > 0).
I am stuck on how to find an efficient way to randomly generate a board. I have the validation function made and it works, but I am stumped on how to generate a board so the player can play.
I initially tried a nested for loop and generate a random number on each cell, however you can clearly see how this is not effective. Actually, I let my computer run for 30 minutes and it just kept generating random boards that were not even close to being a valid board.
Can anyone give me any ideas?
I tried breaking it down, like generate a random number on a random cell rather than in an sequential order, however this did not work.