The Basics

The First Grid

This is the first grid that my program generated for this project. 

 

The grid has 42 columns and 18 rows, with the rows being 3 times as tall as the columns are wide.  

The 6 colors are equally represented in each row (7 of each color) and column (3 of each color).  The color of each individual cell was randomly selected based on these two rules only.  

The row and column representation rules are what I call distribution rules.  The other type of rule is an adjacency rule:

This grid has the same dimensions and color counts (though the colors are different) and follows the same rules as the first one.  An additional rule is that a cell cannot share a border with a cell of the same color.  

Other Distribution Rules

The above image also follows a 3rd distribution rule that is more difficult to see:  dividing the board into 18 sectors that are 7 columns wide and 6 rows high, the colors are equally represented in each of these sectors.  My interactive grid viewer has a feature that can highlight these sectors (or at least, half of them): 

 

I call this a block distribution rule.  This covers the main 3 distribution rules that I use for almost every grid generated. 

The rules needn’t always be the same size, even if the board dimensions are the same: 

  • The column rule can span multiple columns, as long as the number is divisible by the total number of columns (the same is true of the row distribution rule).  
  • The block rule can vary in both rows and columns, as long as the board can be divided into equal blocks of the size and the number of cells in each block is divisible by the color count.  

I almost always stay with a single row and column:  this combination ensures that each cell belongs to a unique set of distribution groups.

The Corner Adjacency Rule

In the last image, the cells cannot share a border with a cell of the same color, but they can touch another cell of the same color at the corners.  Here is an example of what can happen when this rule is reversed: 

I like to call this the “block island” rule because each block of color is completely surrounded by other colors.  

Other Board Sizes and Color Counts

The block island (or more formally, “corner adjacent”) rule inspired me to try other board sizes with fewer colors:

This one has 5 colors and follows the same rules (except that the block size for distribution is 5 rows by 7 columns).  The reduced color count makes it “harder” to follow the rule, since there are fewer colors to surround each block.  It turns out that it is possible with even fewer colors (a fact that actually surprised me the first time I saw it): 

Other Adjacency Rules

There are a total of 7 different types of adjacency rules.  The X’s show which cells are restricted:

The first grid demonstrating adjacency rules follow both the horizontal and vertical adjacency restrictions. 

Technically, the left is just the middle and right combined – which I call slash and backslash.  So there are really only 6 different adjacency restrictions, and only two that I haven’t shown examples of: 

These two rules – which I call the “rectangle” rule and the “island” (not “block island”), are intended to each capture one (but not both) of the features of the corner adjacency rule. 

It is easier to explain with examples: 

The rectangle rule (also called “H or V”) forces the blocks to be… rectangles, but they are not quite islands because they can touch the same color at the corners.  

In this case, the blocks can escape the rectangle, but they can’t escape the sea of other colors surrounding them.  

Mixing Multiple Adjacency Rules

In some cases, the adjacency rules vary depending on the color (I call these “individual adjacency rules”).  

 

In both cases, all of the lines follow the corner adjacency rules.  In the first grid, 3 of the colors are restricted to horizontal (or single cell) blocks, while the 2nd grid restricts 3 of the colors to vertical lines.  

And one last example: 

I think case, the yellow and turquoise lines follow the island rule, the green line the corner and horizontal rules and the dark blue line the corner and vertical rules. 

And that is considerably more than I meant to cover on this page.  You can see many examples of images with all of these rule sets and many others on the interactive grid viewer.

Back to Color Grids