[Ruby] If Pikachu counts to 100

3 minute read

I salvage what was in the trash. If you listen carefully to the place where two piercings continue, the trick (?) If Pikachu croaks, this is no longer true.

 (0..100).each{|i| pi;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" => "Pikapi","11" => "Shiny"})}.join("")}
irb(main):001:0> (0..100).each{|i| pi;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" => "Pikaru" ,"01" => "Pikachu" ,"10" = > "Shiny", "11" => "shiny"})}.join("")}
0
"00"
Picker
1
"01"
Pikachu
2
"Ten"
Shiny
3
"11"
Shiny
Four
"0100"
Pikachu Pika
Five
"0101"
Pikachu Pikachu
6
"0110"
Pikachu
7
"0111"
Pikachu shiny
8
"1000"
Shiny
9
"1001"
Shiny Pikachu
Ten
"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 Pika Pika
17
"010001"
Pikachu Pikachu
18
"010010"
Pikachu Pika Pika Pika
19
"010011"
Pikachu Pika Pika Pika
20
"010100"
Pikachu Pikachu Pika
twenty one
"010101"
Pikachu Pikachu Pikachu
twenty two
"010110"
Pikachu Pikachu Pikachu
twenty three
"010111"
Pikachu Pikachu Pika Pika
twenty four
"011000"
Pikachu Pika Pika
twenty five
"011001"
Pikachu Pika Pikachu
26
"011010"
Pikachu Pika Pika
27
"011011"
Pikachu Pika Pika Pika
28
"011100"
Pikachu Pika Pika Pika
29
"011101"
Pikachu Pika Pikachu
30
"011110"
Pikachu shiny shiny
31
"011111"
Pikachu shiny shiny
32
"100000"
Shining shining shining
33
"100001"
Pika Pika Pikachu
34
"100010"
Shining shining
35
"100011"
Shining shining
36
"100100"
Glittering Glitter
37
"100101"
Pikachu Pikachu
38
"100110"
Shiny shiny shiny
39
"100111"
Shiny shiny shiny
40
"101000"
Shining shining
41
"101001"
Shiny shiny shiny
42
"101010"
Shiny shiny shiny
43
"101011"
Shiny shiny shiny
44
"101100"
Shiny shiny shiny
45
"101101"
Shiny shiny shiny
46
"101110"
Shiny shiny shiny
47
"101111"
Shiny shiny shiny
48
"110000"
Shining shining shining
49
"110001"
Shining shining
50
"110010"
Shining shining
51
"110011"
Shiny shiny shiny
52
"110100"
Glittering Glitter
53
"110101"
Pikachu Pikachu
54
"110110"
Shiny shiny shiny
55
"110111"
Shiny shiny shiny shiny
56
"111000"
Shiny shiny shiny
57
"111001"
Shiny shiny shiny
58
"111010"
Shiny shiny shiny
59
"111011"
Shiny shiny shiny
60
"111100"
Shiny shiny shiny
61
"111101"
Shiny shiny shiny
62
"111110"
Shiny shiny shiny
63
"111111"
Shiny shiny shiny shiny
64
"01000000"
Pikachu Pika Pika Pika
65
"01000001"
Pikachu Pikachu Pikachu Pikachu
66
"01000010"
Pikachu Pika Pika Pika Pika
67
"01000011"
Pikachu Pika Pika Pika Pika
68
"01000100"
Pikachu Pika Pikachu Pika
69
"01000101"
Pikachu Pikachu Pikachu Pikachu
70
"01000110"
Pikachu Pikachu Pikachu Pikapi
71
"01000111"
Pikachu Pikachu Pikachu
72
"01001000"
Pikachu Pika Pika Pika Pika
73
"01001001"
Pikachu Pika Pika Pika Pika
74
"01001010"
Pikachu Pika Pika Pika Pika Pika
75
"01001011"
Pikachu Pika Pika Pika Pika Pika
76
"01001100"
Pikachu Pika Pika Pika Pika
77
"01001101"
Pikachu Pika Pika Pika Pikachu
78
"01001110"
Pikachu Pika Pika Pika Pika Pika
79
"01001111"
Pikachu Pika Pika Pika Pika Pika
80
"01010000"
Pikachu Pikachu Pika Pika
81
"01010001"
Pikachu Pikachu Pikachu Pikachu
82
"01010010"
Pikachu Pikachu Pika Pika Pika
83
"01010011"
Pikachu Pikachu Pika Pika Pika
84
"01010100"
Pikachu Pikachu Pikachu Pika
85
"01010101"
Pikachu Pikachu Pikachu Pikachu
86
"01010110"
Pikachu Pikachu Pikachu Pikapi
87
"01010111"
Pikachu Pikachu Pikachu Pika 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 Pika Pikachu
94
"01011110"
Pikachu Pikachu Pika Pika Pika Pika
95
"01011111"
Pikachu Pikachu Pika Pika Pika Pika
96
"01100000"
Pikachu Pika Pika Pika
97
"01100001"
Pikachu Pikachu Pikachu Pikachu
98
"01100010"
Pikachu Pika Pika Pika Pika Pika
99
"01100011"
Pikachu Pika Pika Pika Pika
100
"01100100"
Pikachu Pika Pika Pika
=> 0..100

Shiny Pikachu is 13

Tags:

Updated: