If Pikachu counts up to 100

I salvaged what was in the trash. If you listen carefully to the place where two pi are in a row, the trick is to be able to handle shiny = 11 (?) If Pikachu sometimes squeals, this is no longer the case.

 (0..100).each{|i| p i;p i.to_s(2).rjust( (i.to_s(2).size % 2) + i.to_s(2).size ,"0");puts i.to_s(2).rjust( (i.to_s(2).size % 2) + i.to_s(2).size ,"0").scan(/.{1,#{2}}/).map{|a| a.gsub(/.*/,{"00" =>"Pika" ,"01" => "Pikachu" ,"10" => "Shiny","11" => "Shinyカ"})}.join("") }
irb(main):001:0> (0..100).each{|i| p i;p i.to_s(2).rjust( (i.to_s(2).size % 2) + i.to_s(2).size ,"0");puts i.to_s(2).rjust( (i.to_s(2).size % 2) + i.to_s(2).size ,"0").scan(/.{1,#{2}}/).map{|a| a.gsub(/.*/,{"00" =>"Pika" ,"01" => "Pikachu" ,"10" => "Shiny","11" => "Shinyカ"})}.join("") }
0
"00"
Pika
1
"01"
Pikachu
2
"10"
Shiny
3
"11"
Shiny
4
"0100"
Pikachu Pika
5
"0101"
Pikachu Pikachu
6
"0110"
Pikachu Pikachu
7
"0111"
Pikachu shiny
8
"1000"
Shiny Pika
9
"1001"
Shiny Pikachu
10
"1010"
Shiny shiny
11
"1011"
Shiny shiny
12
"1100"
Shiny shiny
13
"1101"
Shiny Pikachu
14
"1110"
Shiny shiny
15
"1111"
Shiny shiny
16
"010000"
Pikachu Pikachu Pikachu
17
"010001"
Pikachu Pikachu Pikachu
18
"010010"
Pikachu Pikachu Pikachu
19
"010011"
Pikachu Pika Pika Pika
20
"010100"
Pikachu Pikachu Pikachu
21
"010101"
Pikachu Pikachu Pikachu
22
"010110"
Pikachu Pikachu Pikachu
23
"010111"
Pikachu Pikachu Pikachu
24
"011000"
Pikachu Pikachu Pikachu
25
"011001"
Pikachu Pikachu Pikachu
26
"011010"
Pikachu Pikachu Pikachu
27
"011011"
Pikachu shiny shiny
28
"011100"
Pikachu Pikachu Pikachu
29
"011101"
Pikachu Pikachu Pikachu
30
"011110"
Pikachu shiny shiny
31
"011111"
Pikachu shiny shiny
32
"100000"
Shiny Pika Pika Pika
33
"100001"
Pikachu Pikachu
34
"100010"
Shiny Pika Pika Pika
35
"100011"
Shiny shiny shiny
36
"100100"
Shiny Pikachu Pika
37
"100101"
Shiny Pikachu Pikachu
38
"100110"
Shiny Pikachu Pikachu
39
"100111"
Shiny Pikachu Shiny
40
"101000"
Shiny shiny
41
"101001"
Shiny Pikachu
42
"101010"
Shiny shiny shiny
43
"101011"
Shiny shiny shiny
44
"101100"
Shiny shiny shiny
45
"101101"
Shiny shiny shiny pikachu
46
"101110"
Shiny shiny shiny
47
"101111"
Shiny shiny shiny
48
"110000"
Shiny Pika Pika Pika
49
"110001"
Shiny Pika Pikachu
50
"110010"
Shiny shiny shiny
51
"110011"
Shiny shiny shiny
52
"110100"
Shiny Pikachu Pika
53
"110101"
Shiny Pikachu Pikachu
54
"110110"
Shiny Pikachu Pikachu
55
"110111"
Shiny Pikachu Shiny
56
"111000"
Shiny shiny shiny
57
"111001"
Shiny shiny shiny pikachu
58
"111010"
Shiny shiny shiny
59
"111011"
Shiny shiny shiny
60
"111100"
Shiny shiny shiny
61
"111101"
Shiny shiny shiny pikachu
62
"111110"
Shiny shiny shiny
63
"111111"
Shiny shiny shiny
64
"01000000"
Pikachu Pika Pika Pika Pika
65
"01000001"
Pikachu Pikachu Pikachu Pikachu
66
"01000010"
Pikachu Pikachu Pikachu Pikachu
67
"01000011"
Pikachu Pikachu Pikachu Pikachu
68
"01000100"
Pikachu Pika Pikachu Pika
69
"01000101"
Pikachu Pikachu Pikachu Pikachu
70
"01000110"
Pikachu Pikachu Pikachu Pikachu
71
"01000111"
Pikachu Pikachu Pikachu Pikachu
72
"01001000"
Pikachu Pika Pika Pika Pika
73
"01001001"
Pikachu Pikachu Pikachu Pikachu
74
"01001010"
Pikachu Pikachu Pikachu Pikachu
75
"01001011"
Pikachu Pikachu Pikachu Pikachu
76
"01001100"
Pikachu Pika Pika Pika Pika
77
"01001101"
Pikachu Pikachu Pikachu Pikachu
78
"01001110"
Pikachu Pikachu Pikachu Pikachu
79
"01001111"
Shiny Pikachu Shiny Shiny
80
"01010000"
Pikachu Pikachu Pikachu Pikachu
81
"01010001"
Pikachu Pikachu Pikachu Pikachu
82
"01010010"
Pikachu Pikachu Pikachu Pikachu
83
"01010011"
Pikachu Pikachu Pikachu Pikachu
84
"01010100"
Pikachu Pikachu Pikachu Pikachu
85
"01010101"
Pikachu Pikachu Pikachu Pikachu
86
"01010110"
Pikachu Pikachu Pikachu Pikachu
87
"01010111"
Pikachu Pikachu Pikachu Pikachu
88
"01011000"
Pikachu Pikachu Pikachu Pikachu
89
"01011001"
Pikachu Pikachu Pikachu Pikachu
90
"01011010"
Pikachu Pikachu Pikachu Pikachu
91
"01011011"
Pikachu Pikachu Pikachu Pikachu
92
"01011100"
Pikachu Pikachu Pikachu Pikachu
93
"01011101"
Pikachu Pikachu Pikachu Pikachu
94
"01011110"
Pikachu Pikachu Pikachu Pikachu
95
"01011111"
Pikachu Pikachu Pikachu Pikachu Pikachu
96
"01100000"
Pikachu Pikachu Pikachu Pikachu
97
"01100001"
Pikachu Pikachu Pikachu Pikachu
98
"01100010"
Pikachu Pikachu Pikachu Pikachu
99
"01100011"
Pikachu Pikachu Pikachu Pikachu
100
"01100100"
Pikachu Pikachu Pikachu Pikachu
=> 0..100

13 shiny Pikachu

Recommended Posts

If Pikachu counts up to 100
10 Corresponds to if statement
[Rails] How to speed up docker-compose