kittyverse 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Manifest.txt +3 -2
- data/README.md +428 -240
- data/Rakefile +30 -30
- data/lib/kittyverse.rb +47 -47
- data/lib/kittyverse/api/client.rb +147 -147
- data/lib/kittyverse/api/versions.rb +91 -91
- data/lib/kittyverse/cattributes.rb +131 -131
- data/lib/kittyverse/config/colors.rb +146 -146
- data/lib/kittyverse/config/fancies.rb +84 -6
- data/lib/kittyverse/config/purrstiges.rb +225 -215
- data/lib/kittyverse/config/traits_timeline.rb +288 -288
- data/lib/kittyverse/fancies.rb +205 -205
- data/lib/kittyverse/gene.rb +55 -55
- data/lib/kittyverse/genome.rb +236 -236
- data/lib/kittyverse/mewtations.rb +120 -120
- data/lib/kittyverse/version.rb +23 -23
- data/test/helper.rb +10 -10
- data/test/test_fancies.rb +16 -0
- data/test/test_genome.rb +62 -0
- data/test/test_traits.rb +174 -174
- metadata +13 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 785ca9bb2bcf4b431d97bbabffe81febb457680f
|
4
|
+
data.tar.gz: b7c9e5e37989a0924962c736536956a3cbe9a1b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 674acb2fcab22c3e4a7a5b279635e2a528eb744b27ed4966f72ddb2dd8146590c9daf44210d5a1023858fa0b8dbfe41c2fdd2861147b80172cc060e25f57c56f
|
7
|
+
data.tar.gz: ccde26e572b7b72b4677b049e27453479defb021a96e1237771c3cb2f1aeceb0743d760e2f3888d4124c5acc850376d276379c23f0ed5301acf79b4575f1501c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
### 0.0.1 / 2019-01-11
|
2
|
-
|
3
|
-
* Everything is new. First release
|
1
|
+
### 0.0.1 / 2019-01-11
|
2
|
+
|
3
|
+
* Everything is new. First release
|
data/Manifest.txt
CHANGED
@@ -9,12 +9,12 @@ lib/kittyverse/api/versions.rb
|
|
9
9
|
lib/kittyverse/cattributes.rb
|
10
10
|
lib/kittyverse/config/colors.rb
|
11
11
|
lib/kittyverse/config/fancies.rb
|
12
|
-
lib/kittyverse/gene.rb
|
13
|
-
lib/kittyverse/genome.rb
|
14
12
|
lib/kittyverse/config/purrstiges.rb
|
15
13
|
lib/kittyverse/config/traits.rb
|
16
14
|
lib/kittyverse/config/traits_timeline.rb
|
17
15
|
lib/kittyverse/fancies.rb
|
16
|
+
lib/kittyverse/gene.rb
|
17
|
+
lib/kittyverse/genome.rb
|
18
18
|
lib/kittyverse/links.rb
|
19
19
|
lib/kittyverse/mewtations.rb
|
20
20
|
lib/kittyverse/pages/genes.rb
|
@@ -24,4 +24,5 @@ lib/kittyverse/version.rb
|
|
24
24
|
test/helper.rb
|
25
25
|
test/test_cattributes.rb
|
26
26
|
test/test_fancies.rb
|
27
|
+
test/test_genome.rb
|
27
28
|
test/test_traits.rb
|
data/README.md
CHANGED
@@ -1,240 +1,428 @@
|
|
1
|
-
# Kittyverse
|
2
|
-
|
3
|
-
|
4
|
-
kittyverse library - helper classes for cattributes, trait types, traits, genes, genomes and more for cryptokitties and copycats
|
5
|
-
|
6
|
-
* home :: [github.com/cryptocopycats/kittyverse](https://github.com/cryptocopycats/kittyverse)
|
7
|
-
* bugs :: [github.com/cryptocopycats/kittyverse/issues](https://github.com/cryptocopycats/kittyverse/issues)
|
8
|
-
* gem :: [rubygems.org/gems/kittyverse](https://rubygems.org/gems/kittyverse)
|
9
|
-
* rdoc :: [rubydoc.info/gems/kittyverse](http://rubydoc.info/gems/kittyverse)
|
10
|
-
|
11
|
-
|
12
|
-
## Usage
|
13
|
-
|
14
|
-
### Traits
|
15
|
-
|
16
|
-
Use the `Traits` helper class to lookup trait types (e.g. fur, pattern, eye color, eye shape, base color, etc.) and traits (e.g. savannah, selkirk, chantilly, etc.):
|
17
|
-
|
18
|
-
``` ruby
|
19
|
-
t = Traits[ 'FU00' ]
|
20
|
-
p t.class #=> Trait
|
21
|
-
p t.name #=> "Savannah"
|
22
|
-
p t.type.name #=> "Fur"
|
23
|
-
p t.code #=> "FU00"
|
24
|
-
p t.kai #=> "1"
|
25
|
-
|
26
|
-
# -or-
|
27
|
-
|
28
|
-
t = Trait.find_by_code( 'FU00' )
|
29
|
-
t = Trait.find_by( code: 'FU00' )
|
30
|
-
t = Traits[ 'savannah' ]
|
31
|
-
t = Traits[ 'Savannah' ]
|
32
|
-
t = Trait.find_by_name( 'Savannah' )
|
33
|
-
t = Trait.find_by( name: 'Savannah' )
|
34
|
-
t = Traits[ :body ][ '1' ]
|
35
|
-
t = Traits[ :body ][ '00' ]
|
36
|
-
t = Traits[ :body ][ 0 ]
|
37
|
-
t = Traits[ 'FU' ][ '00' ]
|
38
|
-
t = Traits[ 'FU' ][0]
|
39
|
-
t = Traits[ :FU ][0]
|
40
|
-
t = Traits[ :FU00 ]
|
41
|
-
t = Traits[ 'Fur' ][0]
|
42
|
-
# ...
|
43
|
-
```
|
44
|
-
|
45
|
-
#### What about `totesbasic`?
|
46
|
-
|
47
|
-
Note, the `totesbasic` pattern cattribute has _three_ traits, that is, `totesbasic 1` with the code `PA14`
|
48
|
-
and `totesbasic 2` with `PA15` and `totesbasic 3` with `PA23`.
|
49
|
-
Use:
|
50
|
-
|
51
|
-
``` ruby
|
52
|
-
t = Traits[ 'PA14' ]
|
53
|
-
p t.class #=> Trait
|
54
|
-
p t.name #=> "Totesbasic 1"
|
55
|
-
p t.type.name #=> "Pattern"
|
56
|
-
p t.code #=> "PA14"
|
57
|
-
p t.kai #=> "f"
|
58
|
-
|
59
|
-
# -or-
|
60
|
-
|
61
|
-
t = Trait.find_by_code( 'PA14' )
|
62
|
-
t = Trait.find_by( code: 'PA14' )
|
63
|
-
t = Traits[ 'totesbasic 1' ]
|
64
|
-
t = Traits[ 'Totesbasic 1' ]
|
65
|
-
t = Trait.find_by_name( 'Totesbasic 1' )
|
66
|
-
t = Trait.find_by( name: 'Totesbasic 1' )
|
67
|
-
t = Traits[ :body ][ 'f' ]
|
68
|
-
t = Traits[ :body ][ '14' ]
|
69
|
-
t = Traits[ :body ][ 14 ]
|
70
|
-
# ...
|
71
|
-
```
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
For trait types (e.g. fur, pattern, eye color, eye shape, base color, etc.)
|
76
|
-
use:
|
77
|
-
|
78
|
-
``` ruby
|
79
|
-
tt = Traits[ :body ]
|
80
|
-
p tt.class #=> TraitType
|
81
|
-
p tt.name #=> "Fur"
|
82
|
-
p tt.code #=> "FU"
|
83
|
-
p tt.genes #=> "0-3"
|
84
|
-
|
85
|
-
# -or-
|
86
|
-
|
87
|
-
tt = TraitType.find_by_key( :body )
|
88
|
-
tt = TraitType.find_by( key: 'body' )
|
89
|
-
tt = Traits[ 'Fur' ]
|
90
|
-
tt = TraitType.find_by_name( 'Fur' )
|
91
|
-
tt = TraitType.find_by( name: 'Fur' )
|
92
|
-
tt = Traits[ 'FU' ]
|
93
|
-
tt = Traits[ :FU ]
|
94
|
-
tt = TraitType.find_by_code( 'FU' )
|
95
|
-
tt = TraitType.find_by( code: 'FU' )
|
96
|
-
# ...
|
97
|
-
```
|
98
|
-
|
99
|
-
|
100
|
-
### Cattributes
|
101
|
-
|
102
|
-
Use the `Cattribute` helper class to lookup cattributes incl. purrstige cattributes with timed trait recipes / forumlas:
|
103
|
-
|
104
|
-
``` ruby
|
105
|
-
c = Cattribute[ 'savannah' ]
|
106
|
-
p c.class #=> Cattribute
|
107
|
-
p c.name #=> "Savannah"
|
108
|
-
p c.type.name #=> "Fur"
|
109
|
-
p c.traits.size #=> 1
|
110
|
-
p c.traits #=> ["Savannah"]
|
111
|
-
p c.traits[0].code #=> "FU00"
|
112
|
-
# ...
|
113
|
-
|
114
|
-
c = Cattribute[ 'totesbasic' ]
|
115
|
-
p c.class #=> Cattribute
|
116
|
-
p c.name #=> "Totesbasic"
|
117
|
-
p c.type.name #=> "Pattern"
|
118
|
-
p c.traits.size #=> 3
|
119
|
-
p c.traits #=> ["Totesbasic 1", "Totesbasic 2", "Totesbasic 3"]
|
120
|
-
p c.traits[0].code #=> "PA14"
|
121
|
-
p c.traits[1].code #=> "PA15"
|
122
|
-
p c.traits[2].code #=> "PA23"
|
123
|
-
# ...
|
124
|
-
|
125
|
-
c = Cattribute[ 'bionic' ]
|
126
|
-
p c.class #=> Cattribute
|
127
|
-
p c.name #=> "Bionic"
|
128
|
-
p c.type.name #=> "Purrstige"
|
129
|
-
p c.traits.size #=> 0
|
130
|
-
p c.traits #=> []
|
131
|
-
p c.recipe #=> {time: {start: "2019-05-01", end: "2019-08-31"},
|
132
|
-
# traits: ["Ragdoll",
|
133
|
-
# "WE05",
|
134
|
-
# ["Totesbasic 1", "Totesbasic 2", "Totesbasic 3"],
|
135
|
-
# "PU30"]}
|
136
|
-
|
137
|
-
# ...
|
138
|
-
```
|
139
|
-
|
140
|
-
### Fancies
|
141
|
-
|
142
|
-
Use the `Fancy` helper class to lookup fancy or exclusive or special edition cats incl. timed trait recipes / forumlas, counts, limits, ids and more:
|
143
|
-
|
144
|
-
``` ruby
|
145
|
-
f = Fancy[ :genesis ]
|
146
|
-
p f.class #=> Fancy
|
147
|
-
p f.name #=> "Genesis"
|
148
|
-
p f.key #=> :genesis
|
149
|
-
p f.exlusive? #=> true
|
150
|
-
p f.ids.size #=> 1
|
151
|
-
p f.ids #=> [1]
|
152
|
-
#...
|
153
|
-
|
154
|
-
# -or-
|
155
|
-
|
156
|
-
f = Fancy.find_by_key( :genesis )
|
157
|
-
f = Fancy.find_by( key: 'genesis' )
|
158
|
-
f = Fancy[ 'Genesis' ]
|
159
|
-
f = Fancy.find_by_name( 'Genesis' )
|
160
|
-
f = Fancy.find_by( name: 'Genesis' )
|
161
|
-
# ...
|
162
|
-
|
163
|
-
f = Fancy[ :bugcat ]
|
164
|
-
p f.class #=> Fancy
|
165
|
-
p f.name #=> "Bug Cat"
|
166
|
-
p f.key #=> :bugcat
|
167
|
-
p f.exlusive? #=> true
|
168
|
-
p f.ids.size #=> 3
|
169
|
-
p f.ids #=> [101,102,103]
|
170
|
-
#...
|
171
|
-
|
172
|
-
# -or-
|
173
|
-
|
174
|
-
f = Fancy[ 'Bug Cat' ]
|
175
|
-
f = Fancy[ 'BugCat' ]
|
176
|
-
f = Fancy[ 'bugcat' ]
|
177
|
-
f = Fancy.find_by_name( 'Bug Cat' )
|
178
|
-
f = Fancy.find_by( name: 'Bug Cat' )
|
179
|
-
# ...
|
180
|
-
```
|
181
|
-
|
182
|
-
**Fancy Cat Types**
|
183
|
-
|
184
|
-
``` ruby
|
185
|
-
p Fancy.size #=> 83
|
186
|
-
p Fancy.exclusives.size #=> 22
|
187
|
-
p Fancy.special_editions.size #=> 5
|
188
|
-
p Fancy.fancies.size #=> 56
|
189
|
-
```
|
190
|
-
|
191
|
-
Loop over all fancies:
|
192
|
-
|
193
|
-
``` ruby
|
194
|
-
Fancy.each do |fancy|
|
195
|
-
p fancy.name
|
196
|
-
end
|
197
|
-
|
198
|
-
# ...
|
199
|
-
```
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
-
|
225
|
-
|
226
|
-
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
1
|
+
# Kittyverse
|
2
|
+
|
3
|
+
|
4
|
+
kittyverse library - helper classes for cattributes, trait types, traits, genes, genomes and more for cryptokitties and copycats
|
5
|
+
|
6
|
+
* home :: [github.com/cryptocopycats/kittyverse](https://github.com/cryptocopycats/kittyverse)
|
7
|
+
* bugs :: [github.com/cryptocopycats/kittyverse/issues](https://github.com/cryptocopycats/kittyverse/issues)
|
8
|
+
* gem :: [rubygems.org/gems/kittyverse](https://rubygems.org/gems/kittyverse)
|
9
|
+
* rdoc :: [rubydoc.info/gems/kittyverse](http://rubydoc.info/gems/kittyverse)
|
10
|
+
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
### Traits
|
15
|
+
|
16
|
+
Use the `Traits` helper class to lookup trait types (e.g. fur, pattern, eye color, eye shape, base color, etc.) and traits (e.g. savannah, selkirk, chantilly, etc.):
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
t = Traits[ 'FU00' ]
|
20
|
+
p t.class #=> Trait
|
21
|
+
p t.name #=> "Savannah"
|
22
|
+
p t.type.name #=> "Fur"
|
23
|
+
p t.code #=> "FU00"
|
24
|
+
p t.kai #=> "1"
|
25
|
+
|
26
|
+
# -or-
|
27
|
+
|
28
|
+
t = Trait.find_by_code( 'FU00' )
|
29
|
+
t = Trait.find_by( code: 'FU00' )
|
30
|
+
t = Traits[ 'savannah' ]
|
31
|
+
t = Traits[ 'Savannah' ]
|
32
|
+
t = Trait.find_by_name( 'Savannah' )
|
33
|
+
t = Trait.find_by( name: 'Savannah' )
|
34
|
+
t = Traits[ :body ][ '1' ]
|
35
|
+
t = Traits[ :body ][ '00' ]
|
36
|
+
t = Traits[ :body ][ 0 ]
|
37
|
+
t = Traits[ 'FU' ][ '00' ]
|
38
|
+
t = Traits[ 'FU' ][0]
|
39
|
+
t = Traits[ :FU ][0]
|
40
|
+
t = Traits[ :FU00 ]
|
41
|
+
t = Traits[ 'Fur' ][0]
|
42
|
+
# ...
|
43
|
+
```
|
44
|
+
|
45
|
+
#### What about `totesbasic`?
|
46
|
+
|
47
|
+
Note, the `totesbasic` pattern cattribute has _three_ traits, that is, `totesbasic 1` with the code `PA14`
|
48
|
+
and `totesbasic 2` with `PA15` and `totesbasic 3` with `PA23`.
|
49
|
+
Use:
|
50
|
+
|
51
|
+
``` ruby
|
52
|
+
t = Traits[ 'PA14' ]
|
53
|
+
p t.class #=> Trait
|
54
|
+
p t.name #=> "Totesbasic 1"
|
55
|
+
p t.type.name #=> "Pattern"
|
56
|
+
p t.code #=> "PA14"
|
57
|
+
p t.kai #=> "f"
|
58
|
+
|
59
|
+
# -or-
|
60
|
+
|
61
|
+
t = Trait.find_by_code( 'PA14' )
|
62
|
+
t = Trait.find_by( code: 'PA14' )
|
63
|
+
t = Traits[ 'totesbasic 1' ]
|
64
|
+
t = Traits[ 'Totesbasic 1' ]
|
65
|
+
t = Trait.find_by_name( 'Totesbasic 1' )
|
66
|
+
t = Trait.find_by( name: 'Totesbasic 1' )
|
67
|
+
t = Traits[ :body ][ 'f' ]
|
68
|
+
t = Traits[ :body ][ '14' ]
|
69
|
+
t = Traits[ :body ][ 14 ]
|
70
|
+
# ...
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
For trait types (e.g. fur, pattern, eye color, eye shape, base color, etc.)
|
76
|
+
use:
|
77
|
+
|
78
|
+
``` ruby
|
79
|
+
tt = Traits[ :body ]
|
80
|
+
p tt.class #=> TraitType
|
81
|
+
p tt.name #=> "Fur"
|
82
|
+
p tt.code #=> "FU"
|
83
|
+
p tt.genes #=> "0-3"
|
84
|
+
|
85
|
+
# -or-
|
86
|
+
|
87
|
+
tt = TraitType.find_by_key( :body )
|
88
|
+
tt = TraitType.find_by( key: 'body' )
|
89
|
+
tt = Traits[ 'Fur' ]
|
90
|
+
tt = TraitType.find_by_name( 'Fur' )
|
91
|
+
tt = TraitType.find_by( name: 'Fur' )
|
92
|
+
tt = Traits[ 'FU' ]
|
93
|
+
tt = Traits[ :FU ]
|
94
|
+
tt = TraitType.find_by_code( 'FU' )
|
95
|
+
tt = TraitType.find_by( code: 'FU' )
|
96
|
+
# ...
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
### Cattributes
|
101
|
+
|
102
|
+
Use the `Cattribute` helper class to lookup cattributes incl. purrstige cattributes with timed trait recipes / forumlas:
|
103
|
+
|
104
|
+
``` ruby
|
105
|
+
c = Cattribute[ 'savannah' ]
|
106
|
+
p c.class #=> Cattribute
|
107
|
+
p c.name #=> "Savannah"
|
108
|
+
p c.type.name #=> "Fur"
|
109
|
+
p c.traits.size #=> 1
|
110
|
+
p c.traits #=> ["Savannah"]
|
111
|
+
p c.traits[0].code #=> "FU00"
|
112
|
+
# ...
|
113
|
+
|
114
|
+
c = Cattribute[ 'totesbasic' ]
|
115
|
+
p c.class #=> Cattribute
|
116
|
+
p c.name #=> "Totesbasic"
|
117
|
+
p c.type.name #=> "Pattern"
|
118
|
+
p c.traits.size #=> 3
|
119
|
+
p c.traits #=> ["Totesbasic 1", "Totesbasic 2", "Totesbasic 3"]
|
120
|
+
p c.traits[0].code #=> "PA14"
|
121
|
+
p c.traits[1].code #=> "PA15"
|
122
|
+
p c.traits[2].code #=> "PA23"
|
123
|
+
# ...
|
124
|
+
|
125
|
+
c = Cattribute[ 'bionic' ]
|
126
|
+
p c.class #=> Cattribute
|
127
|
+
p c.name #=> "Bionic"
|
128
|
+
p c.type.name #=> "Purrstige"
|
129
|
+
p c.traits.size #=> 0
|
130
|
+
p c.traits #=> []
|
131
|
+
p c.recipe #=> {time: {start: "2019-05-01", end: "2019-08-31"},
|
132
|
+
# traits: ["Ragdoll",
|
133
|
+
# "WE05",
|
134
|
+
# ["Totesbasic 1", "Totesbasic 2", "Totesbasic 3"],
|
135
|
+
# "PU30"]}
|
136
|
+
|
137
|
+
# ...
|
138
|
+
```
|
139
|
+
|
140
|
+
### Fancies
|
141
|
+
|
142
|
+
Use the `Fancy` helper class to lookup fancy or exclusive or special edition cats incl. timed trait recipes / forumlas, counts, limits, ids and more:
|
143
|
+
|
144
|
+
``` ruby
|
145
|
+
f = Fancy[ :genesis ]
|
146
|
+
p f.class #=> Fancy
|
147
|
+
p f.name #=> "Genesis"
|
148
|
+
p f.key #=> :genesis
|
149
|
+
p f.exlusive? #=> true
|
150
|
+
p f.ids.size #=> 1
|
151
|
+
p f.ids #=> [1]
|
152
|
+
#...
|
153
|
+
|
154
|
+
# -or-
|
155
|
+
|
156
|
+
f = Fancy.find_by_key( :genesis )
|
157
|
+
f = Fancy.find_by( key: 'genesis' )
|
158
|
+
f = Fancy[ 'Genesis' ]
|
159
|
+
f = Fancy.find_by_name( 'Genesis' )
|
160
|
+
f = Fancy.find_by( name: 'Genesis' )
|
161
|
+
# ...
|
162
|
+
|
163
|
+
f = Fancy[ :bugcat ]
|
164
|
+
p f.class #=> Fancy
|
165
|
+
p f.name #=> "Bug Cat"
|
166
|
+
p f.key #=> :bugcat
|
167
|
+
p f.exlusive? #=> true
|
168
|
+
p f.ids.size #=> 3
|
169
|
+
p f.ids #=> [101,102,103]
|
170
|
+
#...
|
171
|
+
|
172
|
+
# -or-
|
173
|
+
|
174
|
+
f = Fancy[ 'Bug Cat' ]
|
175
|
+
f = Fancy[ 'BugCat' ]
|
176
|
+
f = Fancy[ 'bugcat' ]
|
177
|
+
f = Fancy.find_by_name( 'Bug Cat' )
|
178
|
+
f = Fancy.find_by( name: 'Bug Cat' )
|
179
|
+
# ...
|
180
|
+
```
|
181
|
+
|
182
|
+
**Fancy Cat Types**
|
183
|
+
|
184
|
+
``` ruby
|
185
|
+
p Fancy.size #=> 83
|
186
|
+
p Fancy.exclusives.size #=> 22
|
187
|
+
p Fancy.special_editions.size #=> 5
|
188
|
+
p Fancy.fancies.size #=> 56
|
189
|
+
```
|
190
|
+
|
191
|
+
Loop over all fancies:
|
192
|
+
|
193
|
+
``` ruby
|
194
|
+
Fancy.each do |fancy|
|
195
|
+
p fancy.name
|
196
|
+
end
|
197
|
+
|
198
|
+
# ...
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
### Genome
|
203
|
+
|
204
|
+
Use the `Genome` helper class to
|
205
|
+
decipher the genes and lookup traits, mewtation tiers / levels,
|
206
|
+
recessive / hidden genes and more.
|
207
|
+
|
208
|
+
Let's build a gene reader. Pass in the "magic" 256-bit integer number for kitty #1001
|
209
|
+
from the blockchain
|
210
|
+
and get all 48 genes deciphered in 12x4 slices / blocks:
|
211
|
+
|
212
|
+
``` ruby
|
213
|
+
# kitty 1001
|
214
|
+
genome = Genome.new( 512955438081049600613224346938352058409509756310147795204209859701881294 )
|
215
|
+
|
216
|
+
genome.kai
|
217
|
+
#=> "aaaa 7885 22f2 agff 1661 7755 e979 2441 6667 7664 a9aa cfff"
|
218
|
+
|
219
|
+
genome.codes
|
220
|
+
#=> "09-09-09-09 06-07-07-04 01-01-14-01 09-15-14-14 00-05-05-00 06-06-04-04
|
221
|
+
# 13-08-06-08 01-03-03-00 05-05-05-06 06-05-05-03 09-08-09-09 11-14-14-14"
|
222
|
+
|
223
|
+
genome.binary
|
224
|
+
#=> "01001-01001-01001-01001 00110-00111-00111-00100 00001-00001-01110-00001
|
225
|
+
# 01001-01111-01110-01110 00000-00101-00101-00000 00110-00110-00100-00100
|
226
|
+
# 01101-01000-00110-01000 00001-00011-00011-00000 00101-00101-00101-00110
|
227
|
+
# 00110-00101-00101-00011 01001-01000-01001-01001 01011-01110-01110-01110"
|
228
|
+
|
229
|
+
genome.each_with_index do |slice,i|
|
230
|
+
offset = i*4
|
231
|
+
puts "#{slice.type.name} (#{slice.type.code}) - Genes #{slice.type.genes}:"
|
232
|
+
puts "#{'%2d' % (0+offset)} | #{slice.d.name || '∅'} (#{slice.d.code})"
|
233
|
+
puts "#{'%2d' % (1+offset)} | #{slice.r1.name || '∅'} (#{slice.r1.code})"
|
234
|
+
puts "#{'%2d' % (2+offset)} | #{slice.r2.name || '∅'} (#{slice.r2.code})"
|
235
|
+
puts "#{'%2d' % (3+offset)} | #{slice.r3.name || '∅'} (#{slice.r3.code})"
|
236
|
+
puts
|
237
|
+
end
|
238
|
+
```
|
239
|
+
|
240
|
+
|
241
|
+
resulting in:
|
242
|
+
|
243
|
+
```
|
244
|
+
Fur (FU) - Genes 0-3:
|
245
|
+
0 | Ragamuffin (FU14)
|
246
|
+
1 | Ragamuffin (FU14)
|
247
|
+
2 | Ragamuffin (FU14)
|
248
|
+
3 | Himalayan (FU11)
|
249
|
+
|
250
|
+
Pattern (PA) - Genes 4-7:
|
251
|
+
4 | Luckystripe (PA09)
|
252
|
+
5 | Luckystripe (PA09)
|
253
|
+
6 | Calicool (PA08)
|
254
|
+
7 | Luckystripe (PA09)
|
255
|
+
|
256
|
+
Eye Color (EC) - Genes 8-11:
|
257
|
+
8 | Mintgreen (EC03)
|
258
|
+
9 | Sizzurp (EC05)
|
259
|
+
10 | Sizzurp (EC05)
|
260
|
+
11 | Chestnut (EC06)
|
261
|
+
|
262
|
+
Eye Shape (ES) - Genes 12-15:
|
263
|
+
12 | Crazy (ES06)
|
264
|
+
13 | Simple (ES05)
|
265
|
+
14 | Simple (ES05)
|
266
|
+
15 | Simple (ES05)
|
267
|
+
|
268
|
+
Base Color (BC) - Genes 16-19:
|
269
|
+
16 | Shadowgrey (BC00)
|
270
|
+
17 | Orangesoda (BC03)
|
271
|
+
18 | Orangesoda (BC03)
|
272
|
+
19 | Salmon (BC01)
|
273
|
+
|
274
|
+
Highlight Color (HC) - Genes 20-23:
|
275
|
+
20 | Swampgreen (HC08)
|
276
|
+
21 | Royalpurple (HC06)
|
277
|
+
22 | Swampgreen (HC08)
|
278
|
+
23 | Lemonade (HC13)
|
279
|
+
|
280
|
+
Accent Color (AC) - Genes 24-27:
|
281
|
+
24 | Granitegrey (AC04)
|
282
|
+
25 | Granitegrey (AC04)
|
283
|
+
26 | Kittencream (AC06)
|
284
|
+
27 | Kittencream (AC06)
|
285
|
+
|
286
|
+
Wild Element (WE) - Genes 28-31:
|
287
|
+
28 | ∅ (WE00)
|
288
|
+
29 | ∅ (WE05)
|
289
|
+
30 | ∅ (WE05)
|
290
|
+
31 | ∅ (WE00)
|
291
|
+
|
292
|
+
Mouth (MO) - Genes 32-35:
|
293
|
+
32 | Happygokitty (MO14)
|
294
|
+
33 | Happygokitty (MO14)
|
295
|
+
34 | Soserious (MO15)
|
296
|
+
35 | Pouty (MO09)
|
297
|
+
|
298
|
+
Environment (EN) - Genes 36-39:
|
299
|
+
36 | ∅ (EN01)
|
300
|
+
37 | ∅ (EN14)
|
301
|
+
38 | ∅ (EN01)
|
302
|
+
39 | ∅ (EN01)
|
303
|
+
|
304
|
+
Secret Y Gene (SE) - Genes 40-43:
|
305
|
+
40 | ∅ (SE04)
|
306
|
+
41 | ∅ (SE07)
|
307
|
+
42 | ∅ (SE07)
|
308
|
+
43 | ∅ (SE06)
|
309
|
+
|
310
|
+
Purrstige (PU) - Genes 44-47:
|
311
|
+
44 | ∅ (PU09)
|
312
|
+
45 | ∅ (PU09)
|
313
|
+
46 | ∅ (PU09)
|
314
|
+
47 | ∅ (PU09)
|
315
|
+
```
|
316
|
+
|
317
|
+
|
318
|
+
Tip: See the chapter 2 in the
|
319
|
+
"[Programming Crypto Collectibles Step-by-Step Book / Guide. Let's start with CryptoKitties & Copycats. Inside Unique Bits & Bytes on the Blockchain...](https://github.com/openblockchains/programming-cryptocollectibles/blob/master/02_genereader.md)"
|
320
|
+
for how to create your own gene reader from scratch.
|
321
|
+
|
322
|
+
|
323
|
+
More ways to slice and dice the genome / genes:
|
324
|
+
|
325
|
+
``` ruby
|
326
|
+
genome[0].class #=> Trait
|
327
|
+
genome[0].name #=> "Ragamuffin"
|
328
|
+
genome[0].code #=> "FU14"
|
329
|
+
|
330
|
+
genome[5].class #=> Trait
|
331
|
+
genome[5].name #=> "Luckystripe"
|
332
|
+
genome[5].code #=> "PA09"
|
333
|
+
|
334
|
+
genome[40].class #=> Trait
|
335
|
+
genome[40].name #=> nil
|
336
|
+
genome[40].code #=> "SE04"
|
337
|
+
|
338
|
+
genome.body.class #=> Gene::Slice
|
339
|
+
genome.body.type.name #=> "Fur"
|
340
|
+
genome.body.type.code #=> "FU"
|
341
|
+
# -or-
|
342
|
+
genome[:body].class #=> Gene::Slice
|
343
|
+
genome[:body].type.name #=> "Fur"
|
344
|
+
genome[:body].type.code #=> "FU"
|
345
|
+
# -or-
|
346
|
+
genome.fu.class #=> Gene::Slice
|
347
|
+
genome.fu.type.name #=> "Fur"
|
348
|
+
genome.fu.type.code #=> "FU"
|
349
|
+
# -or-
|
350
|
+
genome[:FU].class #=> Gene::Slice
|
351
|
+
genome[:FU].type.name #=> "Fur"
|
352
|
+
genome[:FU].type.code #=> "FU"
|
353
|
+
|
354
|
+
genome.body.d.class #=> Trait
|
355
|
+
genome.body.d.name #=> "Ragamuffin"
|
356
|
+
genome.body.d.code #=> "FU14"
|
357
|
+
# -or-
|
358
|
+
genome[:body].d.class #=> Trait
|
359
|
+
genome[:body].d.name #=> "Ragamuffin"
|
360
|
+
genome[:body].d.code #=> "FU14"
|
361
|
+
# -or-
|
362
|
+
genome.body[0].class #=> Trait
|
363
|
+
genome.body[0].name #=> "Ragamuffin"
|
364
|
+
genome.body[0].code #=> "FU14"
|
365
|
+
# -or-
|
366
|
+
genome[:body][0].class #=> Trait
|
367
|
+
genome[:body][0].name #=> "Ragamuffin"
|
368
|
+
genome[:body][0].code #=> "FU14"
|
369
|
+
# -or-
|
370
|
+
genome.fu.d.class #=> Trait
|
371
|
+
genome.fu.d.name #=> "Ragamuffin"
|
372
|
+
genome.fu.d.code #=> "FU14"
|
373
|
+
# -or-
|
374
|
+
genome.fu[0].class #=> Trait
|
375
|
+
genome.fu[0].name #=> "Ragamuffin"
|
376
|
+
genome.fu[0].code #=> "FU14"
|
377
|
+
|
378
|
+
genome.fu.r1.class #=> Trait
|
379
|
+
genome.fu.r1.name #=> "Ragamuffin"
|
380
|
+
genome.fu.r1.code #=> "FU14"
|
381
|
+
# -or-
|
382
|
+
genome.body[1].class #=> Trait
|
383
|
+
genome.body[1].name #=> "Ragamuffin"
|
384
|
+
genome.body[1].code #=> "FU14"
|
385
|
+
```
|
386
|
+
|
387
|
+
and so on and so forth.
|
388
|
+
|
389
|
+
|
390
|
+
## Real World Usage
|
391
|
+
|
392
|
+
### Reference Pages / Cheat Sheets
|
393
|
+
|
394
|
+
Auto-generated CryptoKitties reference pages / cheat sheets include:
|
395
|
+
|
396
|
+
- [**CryptoKitties Cattributes Rarity / Popularity Statistics**](CATTRIBUTES.md)
|
397
|
+
- [**CryptoKitties Genome / Genes Cheat Sheet**](GENES.md) - Fur (FU) • Pattern (PA) • Eye Color (EC) • Eye Shape (ES) • Base Color (BC) • Highlight Color (HC) • Accent Color (AC) • Wild Element (WE) • Mouth (MO) • Environment (EN) • Secret Y Gene (SE) • Purrstige (PU)
|
398
|
+
- [**CryptoKitties Traits Cheat Sheet (with Codes, Mewtation Levels / Tiers, Search Links and More)**](TRAITS.md)
|
399
|
+
- [**CryptoKitties Updates - Fancy / Exclusive / Special Edition Cats - Timeline**](updates/FANCIES.md)
|
400
|
+
- [**CryptoKitties Updates - Purrstige Trait Recipes / Formulas - Timeline**](updates/PURRSTIGES.md)
|
401
|
+
- and others
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
### More
|
406
|
+
|
407
|
+
See the [copycats command line tool (and core library)](https://github.com/cryptocopycats/copycats) - crypto cats / kitties collectibles unchained - buy! sell! hodl! sire! - play for free - runs off the blockchain - no ether / gas required
|
408
|
+
|
409
|
+
|
410
|
+
## More Documentation / Articles / Samples
|
411
|
+
|
412
|
+
- [Programming Crypto Collectibles Step-by-Step Book / Guide](https://github.com/openblockchains/programming-cryptocollectibles) -
|
413
|
+
Let's start with CryptoKitties & Copycats. Inside Unique Bits & Bytes on the Blockchain...
|
414
|
+
- [Ruby Quiz - Challenge #8 - Base32 Alphabet](https://github.com/planetruby/quiz/tree/master/008) - Convert the Super "Sekretoooo" 256-Bit CryptoKitties Genome to Kai Notation - Annipurrsary!
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
## License
|
419
|
+
|
420
|
+
![](https://publicdomainworks.github.io/buttons/zero88x31.png)
|
421
|
+
|
422
|
+
The `kittyverse` scripts are dedicated to the public domain.
|
423
|
+
Use it as you please with no restrictions whatsoever.
|
424
|
+
|
425
|
+
|
426
|
+
## Questions? Comments?
|
427
|
+
|
428
|
+
Post them on the [cryptokitties reddit](https://www.reddit.com/r/cryptokitties). Thanks.
|