*Why not?*".

**The Game**

**infinite loop**is a puzzle game that uses the mechanics of a game I've previously released called "

*SHE*". Solve puzzles, race against the clock and compete in online leaderboards!

**You can download the game in the link below**

**A Game By Its Cover**game jam I thought of making a system that creates puzzles automatically for it and I decided to try it during this jam. The idea was defining the rules that creates valid board states and using it to generate countless combinations. Each of these combinations is a puzzle for the player to solve.

**Procedural Generation**

In this section I'll explain my algorithm for procedural generation of puzzles in the game.

First of all, you'll need to understand how the mechanics work. The images below are screenshots taken from the "

**How to Play**" section of the game (click on the image to zoom):

Given how green and red panels work, it is necessary to have at least 1 green panel in each column and 1 red panel in each row, otherwise it would be impossible to color some rows and columns with the given colors.

For example, once the board reaches the state in the image below, it is impossible to color any of the panels of the bottom row red.

If the player accidentally creates one of these states, he/she can reset the board and try again. The algorithm to create a board works similarly.

**Player's Board Creation Algorithm**

1) Each panel is assigned a random number. Based on this number the panel is colored red or green.

2) The algorithm starts checking all the rows and flagging them. If a row contains at least 1 red panel, the row is flagged as

**VALID**.

3) When all the rows are checked, then it's time for the columns. The process is the same, but this time it checks whether there is at least 1 green panel in each column. If there is the column is flagged as

**VALID**.

4) If, at any time, a row or column is flagged

**INVALID**, the algorithm stops the checking process and start over (Go to step 1).

This process is repeated until all rows and columns are flagged as

**VALID**, which means we have a board with a valid combination of panels.

**Solution's Board Creation Algorithm**

For the creation of solutions, the steps are much simpler. Since a solution can be a board with ANY combination of colors, we just need to use the previous algorithm's Step 1. Once the colors are sorted, that is already acceptable as a solution to the puzzle.

This game jam really helped me learn about new things and apply them directly into the game. Let me know what are your thoughts about the game, write a comment! :)

Until next time!