# WCCC_Dominoes

# ***DominoesInGrids***

For this week's *Creative Code challenge* by @sableRaph: “Dominoes“, ***DominoesInGrids***  is coded in **SonicPi,  #Python & LiveCodingYoutube** and plays on the concept of the domino effect(with the tiles going off one by one) and mathematical induction(where the effect of the speed and visual effects increases after every iteration).

## Poetry

```less
As One Fades
The others wait
Wandering as their fate

As their time awaits
For the cycle to regain its Place
And the increase in pace
And  the inflictions  in space
```

## Video

%[https://youtu.be/TxkrEf8RRuw] 

## Code

### LiveCodingYoutube

```javascript
create(3,3,"W0aZe4gSf5w")
play(8) // 1- 8 for dominoes effects

// Added later to have avariant domino effect
//jump(#,2,4) ,//loop (#,10,12)
```

### SonicPi

```ruby
#remix of  https://twitter.com/wpgFactoid/status/666692596605976576

live_loop :overlord do
  use_random_seed Time.now.to_i / 3
  with_fx :pitch_shift,pitch: dice(5),pitch_dis: dice(10) do
    with_fx :vowel,voice: dice(3), mix: 0.25 do
      with_fx :whammy, mix: [0.25,0.50,0.75].choose do
        use_bpm [30,60,120,240,480,720].choose
        [1, 3, 6, 4, 5, 2,7,4, 2, 1,3,5].each do |d|
          (range -4, 4).each do |i|
            play_chord (chord_degree d, [:c,:a,:e,:g,:Eb3].choose, [:major,:minor].choose, [3,2,1,4].choose, invert: i)
            sleep [0.25,0.5,1].choose
          end
        end
      end
    end
  end
end

live_loop :overlord2 do
  use_random_seed Time.now.to_i / 5
  with_fx :echo, decay: (dice(10)+1)/4,mix: [0.2,0.3,0.4].tick do
  with_fx :ixi_techno, mix: [0.49,0.75].tick, phase: [0.7,0.9,1,1.5,1.7].choose do
    with_fx :vowel,voice: dice(3), mix: 0.25 do
      with_fx :whammy, mix: [0.25,0.50,0.75].choose do
        use_bpm [30,60,120,240,480,720].choose
        [2, 3, 6, 4, 5, 2,7,4, 2, 1,3,5].reverse.each do |d|
          (range -4, 4).each do |i|
            play_chord (chord_degree d, [:c,:a,:e,:g,:Eb3].choose, [:major,:minor].choose, [3,2,1,4].choose, invert: i)
            sleep [0.25,0.5,1].choose
          end
        end
      end
    end
  end
end

end

```

### Python: Also Seen in [https://blog.illestpreacha.com/genuary2026recursiongrids](https://blog.illestpreacha.com/genuary2026recursiongrids)

#### Grids

```python
import numpy as np
import matplotlib.pyplot as plt


def grid(d):

    colorpalettes = ['spring', 'summer', 'autumn', 'winter', 'cool',
                      'Wistia', 'hot', 'afmhot', 'gist_heat']

    C = np.random.randint(low=0, high=d, size=(d, d))

    plt.imshow(C, cmap= colorpalettes[d])
    plt.axis('off') # Hide all axes
    plt.show()

    if d == 0 or d == 1:
        return 1
    else:
        return grid(d - 1)

grid(7)
```

#### Grids 2

```python
import numpy as np
import matplotlib.pyplot as plt


def grid(d):
    C = np.random.randint(low=0, high=d, size=(d, d))

    plt.imshow(C, cmap='bwr_r')
    plt.axis('off') # Hide all axes
    plt.show()

    if d == 0 or d == 1:
        return 1
    else:
        return grid(d - 1)

grid(7)
```

#### Grids 3

```python
import numpy as np
import matplotlib.pyplot as plt
import random as rd


def grid(d):

    colorpalettes = ['spring', 'summer', 'autumn', 'winter', 'cool',
                      'Wistia', 'hot', 'afmhot', 'gist_heat']

    rd.shuffle(colorpalettes)

    C = np.random.randint(low=0, high=d, size=(d, d+1))

    plt.imshow(C, cmap= colorpalettes[d])
    plt.axis('off') # Hide all axes
    plt.show()

    if d == 0 or d == 1:
        return 1
    else:
        return grid(d - 1)

grid(7)
```

#### Grids 4

```python
import numpy as np
import matplotlib.pyplot as plt
import random as rd


def grid(d):

    colorpalettes = ['spring', 'summer', 'autumn', 'winter', 'cool']
    colorpalettes2 = ['Wistia', 'hot', 'afmhot', 'gist_heat']

    rd.shuffle(colorpalettes)
    rd.shuffle(colorpalettes2)

    palettes = []
    palettes.append(colorpalettes[1:5]+ colorpalettes2[1:5])


    #print(palettes)

    rd.shuffle(palettes)

    C = np.random.randint(low=0, high=d, size=(d, d+1))

    plt.imshow(C, cmap= palettes[0][d-1])
    plt.axis('off') # Hide all axes
    plt.show()

    if d == 0 or d == 1:
        return 1
    else:
        return grid(d - 1)

grid(7)
grid(7)
```
