我的思路是先生成一个二维数组再往里面随机生成满足数独的规则的数字,再通过设定难度级别来随机去掉几个数字,最后让玩家填入满足条件答案。
但是现在在第一步用蓝图制作二维数组就遇到了难题,有的用结构体套用、有的用生成9行9个元素,两者都有尝试,但未达到想要的效果很多bug
My idea is to create a two-dimensional array and randomly generate numbers that meet the rules of Sudoku. Then, by setting the difficulty level, I randomly remove a few numbers, and finally ask the player to fill in the answer that meets the conditions.
But now, in the first step of using blueprints to create two-dimensional arrays, there are difficulties encountered. Some use structural entities to apply, while others use to generate 9 rows and 9 elements. Both have tried, but have not achieved the desired effect. There are many bugs
You are on the right track!
I found this which can be a good start for breaking down the code: How to Create a Sudoku Game in C++ - PDF.co
I would as you said create the 2D array to represent the array. You can use custom data structures or data tables, whatever is the most comfortable for you.
You then need the algorithm, in the link I sent there should be a breakdown for it.
You can then apply various techniques to remove less or more numbers, creating a easy and hard mode.
你走在正确的轨道上!
我发现这可以成为分解代码的良好开始:How to Create a Sudoku Game in C++ - PDF.co
正如您所说,我会创建二维数组来表示数组。 您可以使用自定义数据结构或数据表,只要您觉得最舒服即可。
然后你需要算法,在我发送的链接中应该有它的细分。
然后,您可以应用各种技术来删除更少或更多的数字,从而创建简单和困难模式。
1 Like