[RUBY] Si Pikachu compte jusqu'à 100

J'ai récupéré ce qui était dans la poubelle. Si vous écoutez attentivement l'endroit où se trouvent deux pi d'affilée, l'astuce est de pouvoir gérer shiny = 11 (?) Si Pikachu couine parfois, ce n'est plus le cas.

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

13 brillant brillant

Recommended Posts

Si Pikachu compte jusqu'à 100
10 Correspond à l'instruction if
[Rails] Comment accélérer la composition de docker