Home

Your Feedback
Welcome to COLOR GAME II

(Rubik's Line ?)
small logo

Before learning all the secrets, first try the original "artistic" version

Introduction

I developed this game as an entry in a contest for pages under 5KB at the5k.org.
This page, which would never qualify for that, demonstrates some of the mathematics underlying the game and presents more results.

You start with a line of boxes, each with one of seven values.
The values can be represented by numbers (here) or colors (original version).

As with Rubik's cube, there are operators to change the configuration, although in this case, the changes come from "the ether" rather than being a rearrangement of the configuration. On each move, one of the small numbered boxes is clicked. Then it and a range of boxes to its right increment their values by two (mod 7). A change to a single box is termed a transform. If the range exceeds the right boundary, it wraps around to the left. The size of the range cycles by one from a minimum to a maximum from one move to the next.

The idea is to start with one arrangement and end with another. The standard game starts with a cyclical sequence of values and ends with all values the same. An alternate goal is two colors alternating. The two are comparable in difficulty, but the formation of the alternation may be more difficult to visualize. A computational process explained below is the same in both cases.

Let the games begin!
Sixy | Pair Up | Easy as 1-2-3 | Double Treble | Triqqqqy
Don't like the standard games?
Build your own: 
rows cols min-chg max-chg
         

Results

Here are my best results for two of the standard games. The numbers represent the minimum number of clicks to move from the original "rainbow" to solid (all the same).

Triqqqqy Boxes 10 11 12 13 14
Minimum
moves
to all
same color
0 NAVY --- --- --- 25 24
1 WHITE 20 --- --- --- 24
2 GREEN --- --- 28 --- 24
3 RED 21 27 --- --- 24
4 BLUE --- --- --- --- 24
5 ORANGE --- 28 --- --- 24
6 YELLOW --- --- 29 24 24
Double Treble Boxes 10 11 12 13 14
Minimum
moves
to all
same color
0 NAVY 26 24 26 32 28
1 WHITE 28 22 23 25 28
2 GREEN 19 23 28 26 28
3 RED 21 21 22 30 28
4 BLUE 23 30 30 34 28
5 ORANGE 22 28 24 27 28
6 YELLOW 24 26 32 28 28

The first table is for the game "Triqqqqy", which alternates between three and four boxes changing. In the case of 14 boxes (every color twice), solid can be achieved for any color. In the other cases, only two colors are possible.

Within this range of numbers boxes, solid blue can be achieved only in the 14 box case! (It could also be reached for 9,6, or 2 boxes.)

The reason for incomplete feasibility is explained below.


The second table is for "Double Treble", which alternates between two and three boxes changing.

In this game, all colors can be made "solid" because two clicks transform 5 boxes at a time rather than 7. (Explained below.)


Double Treble Boxes 10 11 12 13 14
Moves to
stripe
WHITE with
other colors
10 w/NAVY 20 17 19 21 17
11 w/WHITE see solids table
12 w/GREEN 8 16 13 15 17
13 w/RED 30 24 31 30 31
14 w/BLUE 24 18 23 23 28
15 w/ORANGE 21 26 22 27 31
16 w/YELLOW 26 34 26 31 31
The third table is for striped solutions of white with all the others.

Note how quickly white/green striped solutions can be found, whereas white/yellow takes much longer.

Construction of a solution:

One way to solve this puzzle is to click away with as much methodology as can be mustered until a solution appears. Here is a more algorithmic approach.

Let us begin with a simple example.
In the "Pair Up" game, clicks alternate between 1 and 2 transforms.

If we want to change a 7 box line to all zeroes, we have these 21 required transforms.
   0:
   1: 3 5 0
   2: 4 6 1 3 5 0
   3: 5 0
   4: 6 1 3 5 0
   5: 0
   6: 1 3 5 0
Perhaps we can achieve our goal with 14 clicks: 7 sets of single-pair transform combinations.
(7 * (1+2) = 21).
But because long rows (2,4,6) alternate with short ones (0,1,3,5), there is only a limited amount of pairing available, as shown at right.





We now have 6 pairs, but 9 singles.
After 6 {1,2} sets of clicks, we still have three transforms left, which cannot be made into a 1-2 combination.
 0:

 1: 3 5 0
    | | |
 2: 4 6 1 3 5 0     
 
 3: 5 0
    | |
 4: 6 1 3 5 0
 
 5: 0
    |
 6: 1 3 5 0
So we must add some transforms, seven on a row to maintain our goal of all zeroes.
0:

1: 3 5 0
   | | |
2: 4 6 1 3 5 0

3: 5 0 x x x x x x x
   | |
4: 6 1 3 5 0

5: 0
   |
6: 1 3 5 0
Then we can construct more pairs and have a balance between pairs and singles.
0:

1: 3 5 0
   | | |
2: 4 6 1 3 5 0

3: 5 0 x x x x x x x
   | | | | |
4: 6 1 3 5 0

5: 0
   |
6: 1 3 5 0
We end up with 10 singles and 9 pairs, but that is ok, since a single comes first (and last).

We can solve this puzzle by clicking on, in order:
2 1 2 1 2 1 3 3 3 3 3 3 3 3 6 3 6 5 6

This result is 9 {1,2} combinations and one more 1 at the end, for a total of 19 clicks, 28 transforms. The total number of transforms in this game must always be 3n or 3n+1.


Now we can proceed to a more complex example from the Double Treble game:
Seven boxes, 2's and 3's as ops. Goal: all zero's.

Start with:
    0
    1
    2
    3
    4
    5
    6
Then, reading across, the required transformations are as follows,
the same ones we saw above.
    0:  
    1:  3 5 0 
    2:  4 6 1 3 5 0 
    3:  5 0 
    4:  6 1 3 5 0 
    5:  0 
    6:  1 3 5 0 
Now, those long rows pose even more of a problem, because in this game, there are no singles - every move is a pair or a triple (menage a trois ?).
Again we must add transforms in batches of 7 to a row, since 7 transforms bring us back to the same state. Then we slide rows left and right until everybody has at least one neighbor: above, below, or both.
        3 5 0
        4 6 1 3 5 0
        5 0 x x x x x x x
        6 1 3 5 0
        0 x x x x x x x
        1 3 5 0
  3 5 0
  4 6 1       3 5 0
  5 0 x x x x x x x
  6 1 3 5 0
  0 x x x x x x x
  1 3         5 0
Then we join neighbors up into pairs and threes, put them in order (alternating 2's and 3's), and we're done.
0:

1: 3 5 0
   | | |
2: 4 6 1       3 5 0
   | | |       | | |
3: 5 0 x x x x x x x
         | | |
4:   6 1 3 5 0
     | | | | |
5: 0 x x x x x x x
   | |         | |
6: 1 3         5 0

        row(size)       2's|3's        2's|3's
                       unordered       ordered
       1(3) 5(2)         5 | 1          2 | 1
       1(3) 4(3)           | 1 4        2 | 1
       1(3) 4(2)         4 | 1          2 | 1
       3(3)                | 3          4 | 3
       3(3)                | 3          4 | 3
       3(3)                | 3          5 | 3
       3(3)                | 3          5 | 3
       2(2) 5(2)       2 5 |            5 | 4
       2(2) 5(2)       2 5 |
       2(2)            2   |

Result: 2 1 2 1 2 1 4 3 5 3 5 3 5 4     Try it: here

(We can put the 2's in any order and the 3's in any order as long as they alternate. If they are both in numeric order, the solution will take form from left to right, subject to any wraparound at the end.)

Caveat

Of course - and this is a big "of course" !! - it may not be quick or easy to determine the minimum number of additions or where to slide or join them.

This applet helps with this process (does it ever!).

By the numbers

In the previous example, the base number of transforms is obtained by counting the original entries, 21 in all.

For our 2's 3's, we need a total number which is either a multiple of 5 (same number of 2's and 3's) or a multiple of 5, plus 2 (one last 2). It also has to be the base number plus a multiple of 7, since we can only add a multiple of 7 to a column.

Starting from 21 (which happens also to be a multiple of 7, but in another case a different number might not be), we add 7's until we get 0 or 2 (mod 5). 21 (1 mod 5), 28 (3 mod 5), 35 (0 mod 5).

The next number, 42 (2 mod 5), would be another candidate.
After that, it takes a while to reach the next ones: 70 and 77, skipping 49, 56, and 63, which are congruent to 4, 1, and 3 (mod 5).

Another example

For a case where the base transform number is not a multiple of 7, consider 10 boxes and a target of all 4's. We would start with this configuration:
0: 2 4
1: 3 5 0 2 4
2: 4
3: 5 0 2 4
4:
5: 0 2 4
6: 1 3 5 0 2 4
0: 2 4
1: 3 5 0 2 4
2: 4
Base transforms: 29 (4 mod 5). Adding 7's, we get:
36 (1 mod 5), 43 (3 mod 5), 50 (0 mod 5), 57 (2 mod 5) ...

So 50 and 57, corresponding to adds of 3 and 4 batches of 7, are candidates. In this case, 57 is our stop, but in other cases we may need to go higher to get enough connectivity to generate all our pairs and triples.

57 breaks down as follows: 11 pairs of transforming 2 cells and 3 cells (total 55 transforms)
and one more transform of 2 to finish the job.

We can also view it as 29 base transforms plus 28 (4 x 7) more for "padding".

Here is the solution
(small x's are in pairs,
 large X's are in threes)

0: X     X
   |     |
1: X X X X X
   | | | | |
2: X X X X X       X x x
     | |   |       | | |
3: X X X x X x x x X x x
   |     |   | | | |
4: X X   x   x x x X
   | |
5: X X   X
     |   |
6: x X X X x x
   |   | | | |
0: x X X X x x x x x
     | |       | | |
1:   X X       x x x
     |
2:   X



     2s   |    3s
      unordered
          | 0  0
          |   
          |  11 1  
          |   
        22|       2 
          |   
     3 333| 3    
          |   
          |  4
          |   
          |     5
          |   
    6   66| 6
          |   
       777|  7



       2s | 3s
       ordered
        2 | 0
        2 | 0
        3 | 1
        3 | 1
        3 | 1
        3 | 2
        6 | 3
        6 | 4
        6 | 5
        7 | 6
        7 | 7
        7 | 


Result:
2 0 2 0 3 1 3 1 3 1 3 2 ->...
  ...-> 6 3 6 4 7 5 7 6 7 7 7

More numbers

For any base transform number, adding 7's cycles through all congruences mod 5, so we will eventually reach an acceptable number:
        mod 5 to start:  0   1   2   3  4
        adding 7s:  .    2   3   4   0  1
                    .    4   0   1   2  3
                    .    1   2   3   4  5
                    .    3   4   0   1  2
The following table gives, for each base number, the numbers of transforms which are (0 or 2) mod 5, and which can be reached by adding 7's. To the right are the corresponding numbers of clicks to reach those numbers.


Finally

In the 'Triqqqqy' game, with 3's and 4's as ops, everything is in sevens. If your goal isn't a position whose base number is 0 or 3 (mod 7), you cannot effect it. If it is 0 mod 7, then any add of sevens keeps it that way and an equal number of 3- and 4-transforms will keep it so. Numbers that are congruent to 3 mod 7 are reached by doing one additional 3-transform after 3- and 4-transforms have been done in pairs.

For 10 through 13 boxes, the number of base transforms for solid blue are 29, 33, 33, and 36, which are congruent to 1, 5, 5, and 1 (mod 7) respectively. You can add sevens to these for as long as you wish, but you won't reach a multiple of seven in your or anyone else's lifetime.