# A Swarm-Based Approach to Generate Challenging Mazes
## 3 Swarm Movements to Generate Challenging Mazes
### Proposed Methodology to Generate a Challenging Maze
Based on this optimization process, it is also clear that an increasing in the number of solutions made a considerable contribution to the challenging maze creation and yielded an increase

Figure 5: Mean and standard deviation values over 100 independent runs: (**a**) during 40 iterations; (**b**) with a fixed budget of function evaluations. \begin{table}
\begin{tabular}{c c c c c|c c c c} \hline \hline \multirow{2}{*}{**Population**} & \multicolumn{4}{c|}{**Complexity**} & \multicolumn{4}{c}{**Improve [\%]**} \\ \cline{2-9}  & **Min** & **Max** & **Average** & **STD** & **Min** & **Max** & **Average** & **STD** \\ \hline
5 & 6768 & 13,668 & 9605.38 & 1900.71 & 22.84 & 441.31 & 161.09 & 128.76 \\
15 & 13,325 & 16,875 & 14,634.11 & 1335.24 & 87.46 & 240.03 & 168.77 & 63.51 \\
25 & 15,470 & 19,039 & 17,207.54 & 809.63 & 55.97 & 329.14 & 241.09 & 93.67 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Selected statistics for a comparable number of function evaluations. this algorithm shows the greatest convergence at its beginning. Figure 9a,b show the selected statistics of the results associated to 40 iterations and the number of function evaluations, respectively. Above 40 iterations, this improvement occurred only a few times during all experiments. It should be mentioned that the best results obtained were worse in most runs. Figure 8: The best maze after 40 iterations (green represents the start point, blue denotes the exit). Figure 7: The maze in initial population with the highest measure of complexity (green represents the start point, blue denotes the exit). ### Summary of Experiments

As mentioned in previous sections, our aim was to show how challenging mazes could be obtained with the cockroach-based approach. We conducted many experiments for two objective functions (the complexity of the path, and the complexity of the path and branches) and presented the results obtained over many runs of the implemented algorithm, including statistical analysis of the results. The optimization process was illustrated for a user-specified number of iterations or function evaluations. For these considered objective functions, we carried out preliminary research on the impact of population size on the obtained values of the complexity of mazes. The algorithm achieved the worse results with taking into account the complexity values for a population of 5 individuals for both objective functions. Clearly better results were obtained for the population size equalling 25. It should be mentioned that the increase of the number of iterations and so the number of function evaluations provided a slight improvement in the results obtained. In summary, the total number of function evaluations can only be a preliminary indication to determine the appropriate number of iterations due to the population size. Therefore, we cannot assume that the same number of function evaluations in the case of different sizes of the population will allow us to achieve the same results. ## 5 Conclusions

In the paper, we have presented a swarm-based approach for constructing challenging mazes (2D) that are difficult to solve. We show how to obtain a difficult maze with selected dimensions and an increasing degree of complexity, by application of individual's movements in the swarm. The algorithm could support maze design across a variety of sizes. Note, a bigger size of a maze increases the chance of its higher complexity. The challenged mazes could be created to mirror the obstacles devices face in Internet of Things environment. For example, such solution could be used to examine the efficiency of a sensor-tagged vehicle as it travels through mazes. As shown in the paper, swarm algorithms can be used to modify mazes in order to increase their complexity level. However, it is necessary to apply a properly determined procedure of movement performance, so that the newly generated maze fulfils the assumed requirements (single solution and lack of wall and empty space concentrations).