Experimenting with this, I think that it looks at the intial number in binary and returns the various digits of that.
Try first
5.times do |i|
puts i,5[i]
end
You will see the various values of i and the value returned from 5[i]
The separate issue is the use of look with the modulo operator %. This returns the remainder when look is divided by the second number ie look%4 returns 0,1,2,3,0,1,2,3 as look increases in value. So you get:
{run: 2, time: 0.0}
└─ 0 0 1
{run: 2, time: 0.1}
└─ 1 1 0
{run: 2, time: 0.2}
└─ 2 2 1
{run: 2, time: 0.3}
└─ 3 3 0
{run: 2, time: 0.4}
└─ 4 0 1
{run: 2, time: 0.5}
└─ 5 1 0
{run: 2, time: 0.6}
└─ 6 2 1
{run: 2, time: 0.7}
└─ 7 3 0
{run: 2, time: 0.8}
└─ 8 0 1
{run: 2, time: 0.9}
└─ 9 1 0
when you run
10.times do
tick
puts look, look%4, 5[look%4]
sleep 0.1
end