使用什么样的流量免费类游戏随机水平创造?类游戏、流量、水平

2023-09-11 01:50:27 作者:し☆ve谜儿

我需要一些建议。我正在开发类似的免费流量,其中游戏键盘是由一个网格和色点的游戏,用户必须连接相同颜色的圆点在一起,没有重叠的其他线路,并使用了所有的自由空间中板。

I need some advice. I'm developing a game similar to Flow Free wherein the gameboard is composed of a grid and colored dots, and the user has to connect the same colored dots together without overlapping other lines, and using up ALL the free spaces in the board.

我的问题是关于平创作。我希望做随机生成的水平(与至少应该能够自行解决,以便它可以给玩家提示)和我在一个树桩为使用什么算法。有什么建议?

My question is about level-creation. I wish to make the levels generated randomly (and should at least be able to solve itself so that it can give players hints) and I am in a stump as to what algorithm to use. Any suggestions?

注:图像显示流动自由的目标,这是我开发的目标相同

Note: image shows the objective of Flow Free, and it is the same objective of what I am developing.

感谢您的帮助。 :)

推荐答案

假设有一对更简单,更易于管理的算法,解决你的问题:一种算法​​能够可靠地创建简单,pre-解决了电路板,另一个重新排列流进行简单的电路板更加复杂。

Consider solving your problem with a pair of simpler, more manageable algorithms: one algorithm that reliably creates simple, pre-solved boards and another that rearranges flows to make simple boards more complex.

第一部分,建立一个简单的pre-解决了板,是微不足道的(如果你希望它是)如果你使用 N 上流 N X N 格:

The first part, building a simple pre-solved board, is trivial (if you want it to be) if you're using n flows on an nxn grid:

对于每个流程... 将头点在第一次公开栏的顶部。 将尾点在该栏的底部。 For each flow... Place the head dot at the top of the first open column. Place the tail dot at the bottom of that column.

另外,您也可以提供自己的手工制作的起动板传递给第二部分。这个阶段的唯一目标是获得一个有效的董事会建设,哪怕只是微不足道或predetermined,所以它的价值保持简单。

Alternatively, you could provide your own hand-made starter boards to pass to the second part. The only goal of this stage is to get a valid board built, even if it's just trivial or predetermined, so it's worth keeping it simple.

第二部分,重新​​安排流动,包括循环遍历每个流程,看到哪一个能与邻国流一同成长,缩小:

The second part, rearranging the flows, involves looping over each flow, seeing which one can work with its neighboring flow to grow and shrink:

对于迭代的一些数... 选择一个随机的流动 F 。 如果 F 是最小长度(例如3格长),跳至下一个迭代,因为我们无法收缩 F 现在。 如果对头点˚F旁边的一个点,从另一个流程先按g (如果多于一个先按g 可供选择,随机选择一个)... 将 F 的头点沿流一平方(即,它走一平方朝尾)。 F 现在一平方较短,有一个空方。 (让人不解的是,现在没有解决。) 将在先按g 相邻的点到由腾空˚F的空方。现在有一个空的广场,在那里先按g 的点距离移动。 在与流从先按g 的空白处填写。现在先按g 是一个正方形长于它在本次迭代的开始。 (奇怪的是回到正在解决为好。) For some number of iterations... Choose a random flow f. If f is at the minimum length (say 3 squares long), skip to the next iteration because we can't shrink f right now. If the head dot of f is next to a dot from another flow g (if more than one g to choose from, pick one at random)... Move f's head dot one square along its flow (i.e., walk it one square towards the tail). f is now one square shorter and there's an empty square. (The puzzle is now unsolved.) Move the neighboring dot from g into the empty square vacated by f. Now there's an empty square where g's dot moved from. Fill in that empty spot with flow from g. Now g is one square longer than it was at the beginning of this iteration. (The puzzle is back to being solved as well.)

,因为它代表的办法是有限的(点永远是邻居),但它很容易扩展时:

The approach as it stands is limited (dots will always be neighbors) but it's easy to expand upon:

通过流动的身体添加一个步骤循环 F ,寻找棘手的方式来交换空间与其他流... 加入了prevents点移动到原来的位置了一步...... 添加你拿出任何其他的想法。 Add a step to loop through the body of flow f, looking for trickier ways to swap space with other flows... Add a step that prevents a dot from moving to an old location... Add any other ideas that you come up with.

这里的整体解决方案可能比理想的,你瞄准少了,但现在你有两个简单的算法,可以进一步充实服务于一个大的,无所不包的算法的作用。最后,我认为这种做法是可管理的,不神秘,而且容易tweek,并且,如果不出意外,一个良好的开端。

The overall solution here is probably less than the ideal one that you're aiming for, but now you have two simple algorithms that you can flesh out further to serve the role of one large, all-encompassing algorithm. In the end, I think this approach is manageable, not cryptic, and easy to tweek, and, if nothing else, a good place to start.

更新:的我codeD一个证明型的概念,基于上述步骤。与下面的第一5x5的网格开始,所述方法生产的后续5个不同的板。有些很有趣,有些则不是,但他们总是有效的一个已知的解决方案。

Update: I coded a proof-of-concept based on the steps above. Starting with the first 5x5 grid below, the process produced the subsequent 5 different boards. Some are interesting, some are not, but they're always valid with one known solution.

起点

Starting Point

5个随机结果的(遗憾的错位截图)的

5 Random Results (sorry for the misaligned screenshots)

和一个随机的8×8的良好措施。出发点是相同的简单的列上方接近。

And a random 8x8 for good measure. The starting point was the same simple columns approach as above.