kittypedia 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/Manifest.txt +9 -0
- data/README.md +50 -0
- data/Rakefile +30 -0
- data/lib/kittypedia.rb +19 -0
- data/lib/kittypedia/genome_tables.rb +59 -0
- data/lib/kittypedia/links.rb +54 -0
- data/lib/kittypedia/pages/genes.rb +99 -0
- data/lib/kittypedia/version.rb +20 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 064256ae823ca2bfdfc58f6c2d7c39403e9a1e438c72b0b6b8f94440aad9a880
|
4
|
+
data.tar.gz: 689d9abe788c0b40d825c6280e1410dbe4202491c4c345fa1ae6ec33c278383c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f437dd79d64160272ecc27809377b19cd2fd809b21eba26b69b5484d91701a4e4ae1640d363da40eb69d35ccd12f03a609ef44b331f045146cfe8c0e7e36e93
|
7
|
+
data.tar.gz: 5517ee6004ed766aaade5613017b00f6cedb47dbbe457b1ae89517e18c0f2b6ddf33796b291d0e13acd6cc865fcc2ee0277cff54c33b3a5ba3e277ecf466d950
|
data/CHANGELOG.md
ADDED
data/Manifest.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Kittypedia
|
2
|
+
|
3
|
+
kittypedia - (auto-)generate and update pages on cattributes, traits, fancies (normal, exclusive, special editions) and more
|
4
|
+
|
5
|
+
* home :: [github.com/cryptocopycats/kittyverse](https://github.com/cryptocopycats/kittyverse)
|
6
|
+
* bugs :: [github.com/cryptocopycats/kittyverse/issues](https://github.com/cryptocopycats/kittyverse/issues)
|
7
|
+
* gem :: [rubygems.org/gems/kittypedia](https://rubygems.org/gems/kittypedia)
|
8
|
+
* rdoc :: [rubydoc.info/gems/kittypedia](http://rubydoc.info/gems/kittypedia)
|
9
|
+
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
To be done
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## Real World Usage
|
22
|
+
|
23
|
+
### Reference Pages / Cheat Sheets @ Kittypedia
|
24
|
+
|
25
|
+
Auto-generated reference pages / cheat sheets
|
26
|
+
in the [Kittypedia - The Free CryptoKitties Encyclopedia](https://github.com/cryptocopycats/kittypedia) include:
|
27
|
+
|
28
|
+
- [Cattributes Rarity / Popularity Statistics](https://github.com/cryptocopycats/kittypedia/blob/master/CATTRIBUTES.md)
|
29
|
+
- [Genome / Genes Cheat Sheet](https://github.com/cryptocopycats/kittypedia/blob/master/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)
|
30
|
+
- [Traits Cheat Sheet (with Codes, Mewtation Levels / Tiers, Search Links and More)](https://github.com/cryptocopycats/kittypedia/blob/master/TRAITS.md)
|
31
|
+
- [Fancy / Exclusive / Special Edition Cats - Timeline](https://github.com/cryptocopycats/kittypedia/blob/master/TIMELINE-FANCIES.md)
|
32
|
+
- [Purrstige Trait Recipes / Formulas - Timeline](https://github.com/cryptocopycats/kittypedia/blob/master/TIMELINE-PURRSTIGES.md)
|
33
|
+
- and others
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+

|
43
|
+
|
44
|
+
The `kittypedia` scripts are dedicated to the public domain.
|
45
|
+
Use it as you please with no restrictions whatsoever.
|
46
|
+
|
47
|
+
|
48
|
+
## Questions? Comments?
|
49
|
+
|
50
|
+
Post them on the [cryptokitties reddit](https://www.reddit.com/r/cryptokitties). Thanks.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/kittypedia/version.rb'
|
3
|
+
|
4
|
+
Hoe.spec 'kittypedia' do
|
5
|
+
|
6
|
+
self.version = Kittypedia::VERSION
|
7
|
+
|
8
|
+
self.summary = "kittypedia - (auto-)generate and update pages on cattributes, traits, fancies (normal, exclusive, special editions) and more"
|
9
|
+
self.description = summary
|
10
|
+
|
11
|
+
self.urls = { home: 'https://github.com/cryptocopycats/kittyverse' }
|
12
|
+
|
13
|
+
self.author = 'Gerald Bauer'
|
14
|
+
self.email = 'wwwmake@googlegroups.com'
|
15
|
+
|
16
|
+
# switch extension to .markdown for gihub formatting
|
17
|
+
self.readme_file = 'README.md'
|
18
|
+
self.history_file = 'CHANGELOG.md'
|
19
|
+
|
20
|
+
self.extra_deps = [
|
21
|
+
['kittyverse', '>= 1.0.1']
|
22
|
+
]
|
23
|
+
|
24
|
+
self.licenses = ['Public Domain']
|
25
|
+
|
26
|
+
self.spec_extras = {
|
27
|
+
required_ruby_version: '>= 2.2.2'
|
28
|
+
}
|
29
|
+
|
30
|
+
end
|
data/lib/kittypedia.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
## 3rd party libs
|
2
|
+
require 'kittyverse'
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
## our own code
|
7
|
+
require 'kittypedia/version' # note: let version always go first
|
8
|
+
|
9
|
+
require 'kittypedia/links'
|
10
|
+
require 'kittyverse/genome_tables'
|
11
|
+
require 'kittypedia/pages/genes'
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# say hello
|
18
|
+
puts Kittypedia.banner
|
19
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
class Genome
|
3
|
+
def build_tables() GenomeTables.new( self ).build; end
|
4
|
+
end # class Genome
|
5
|
+
|
6
|
+
|
7
|
+
class GenomeTables
|
8
|
+
def initialize( genome )
|
9
|
+
@genome = genome
|
10
|
+
end
|
11
|
+
|
12
|
+
def build
|
13
|
+
pos = 0
|
14
|
+
buf = ""
|
15
|
+
buf << "Genes (256-Bit Integer Number):\n"
|
16
|
+
buf << "- Base 10 (Decimal): #{@genome.num}\n"
|
17
|
+
buf << "- Base 2 (Binary): #{@genome.binary}\n"
|
18
|
+
buf << "- Base 2⁵ = 32\n"
|
19
|
+
buf << " - (Kai): #{@genome.kai}\n"
|
20
|
+
buf << " - (Codes): #{@genome.codes}\n"
|
21
|
+
buf << "\n\n"
|
22
|
+
|
23
|
+
@genome.each do |slice|
|
24
|
+
tt = slice.type
|
25
|
+
|
26
|
+
buf << "#{tt.name} (#{tt.code}) - Genes #{tt.genes}\n\n"
|
27
|
+
|
28
|
+
###
|
29
|
+
## fix/todo: add stars for purity?
|
30
|
+
## **** - all traits the same
|
31
|
+
## *** - two same pairs of traits
|
32
|
+
## ** - one pair of same traits
|
33
|
+
|
34
|
+
buf << "|Gene |Binary |Kai |Code | Name | |\n"
|
35
|
+
buf << "|------|---------|-----|-----|----------|---|\n"
|
36
|
+
buf << "| #{pos} | #{slice.d.binary} | #{slice.d.kai} | #{slice.d.code} |**#{fmt_trait(slice.d)}** | d |\n"; pos+=1
|
37
|
+
buf << "| #{pos} | #{slice.r1.binary} | #{slice.r1.kai} | #{slice.r1.code} |#{fmt_trait(slice.r1)} | r1 |\n"; pos+=1
|
38
|
+
buf << "| #{pos} | #{slice.r2.binary} | #{slice.r2.kai} | #{slice.r2.code} |#{fmt_trait(slice.r2)} | r2 |\n"; pos+=1
|
39
|
+
buf << "| #{pos} | #{slice.r3.binary} | #{slice.r3.kai} | #{slice.r3.code} |#{fmt_trait(slice.r3)} | r3 |\n"; pos+=1
|
40
|
+
buf << "\n"
|
41
|
+
|
42
|
+
if tt.key == :body ## add legend for first entry
|
43
|
+
buf << "d = dominant, r1 = 1st order recessive, r2 = 2nd order recessive, r3 = 3rd order recessive\n\n"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
buf
|
48
|
+
end
|
49
|
+
|
50
|
+
####################
|
51
|
+
## helpers
|
52
|
+
|
53
|
+
def fmt_trait( trait )
|
54
|
+
buf = ""
|
55
|
+
buf << (trait.name || '∅')
|
56
|
+
buf << " #{trait.tier_roman}" if trait.tier > 0
|
57
|
+
buf
|
58
|
+
end
|
59
|
+
end # class GenomeTables
|
@@ -0,0 +1,54 @@
|
|
1
|
+
###############################
|
2
|
+
# cryptokitties.co links
|
3
|
+
|
4
|
+
def kitties_kitty_url( id )
|
5
|
+
"https://www.cryptokitties.co/kitty/#{id}"
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def kitties_search_url( q )
|
10
|
+
"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}"
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
def kitties_fancy_search_url( fancy ) ## todo: find a better name - why? why not?
|
17
|
+
|
18
|
+
## note: use (official) chinese name for search param if present
|
19
|
+
param = fancy.name_cn ? fancy.name_cn : fancy.key
|
20
|
+
|
21
|
+
if fancy.special_edition?
|
22
|
+
q = "specialedition:#{param}" ## todo: urlescape param - why? why not?
|
23
|
+
elsif fancy.exclusive? ## just use fancy too - why? why not?
|
24
|
+
q = "exclusive:#{param}"
|
25
|
+
else ## assume "normal/regular" fancy
|
26
|
+
q = "fancy:#{param}"
|
27
|
+
end
|
28
|
+
|
29
|
+
"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}"
|
30
|
+
end
|
31
|
+
|
32
|
+
## alias :kitties_special_search_url :kitties_fancy_search_url
|
33
|
+
def kitties_specialedition_search_url( fancy ) kitties_fancy_search_url( fancy ); end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
################################
|
38
|
+
# /media - image links
|
39
|
+
|
40
|
+
def media_fancy_url( key, variant_key=nil ) ### todo: find a better name - why? why not?
|
41
|
+
if variant_key
|
42
|
+
"https://cryptocopycats.github.io/media/kitties/100x100/fancy-#{key}-#{variant_key}.png"
|
43
|
+
else
|
44
|
+
"https://cryptocopycats.github.io/media/kitties/100x100/fancy-#{key}.png"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
## (old) alias for media_fany_url
|
49
|
+
def media_fancy_pic_url( key, variant_key=nil ) media_fancy_url( key, variant_key ); end
|
50
|
+
|
51
|
+
|
52
|
+
def media_icon_url( key ) ## note: use :unlocked, :locked, etc.
|
53
|
+
"https://cryptocopycats.github.io/media/icons/18x18/#{key}.png"
|
54
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
|
2
|
+
class GenesPage
|
3
|
+
|
4
|
+
def build
|
5
|
+
buf = ""
|
6
|
+
buf << "# Genes (#{TraitType.size} x 4)\n\n"
|
7
|
+
|
8
|
+
headings = []
|
9
|
+
TraitType.each do |tt|
|
10
|
+
anchor = "#{tt.name} #{tt.code}".downcase.gsub( ' ', '-' )
|
11
|
+
headings << "[#{tt.name} (#{tt.code})](##{anchor})"
|
12
|
+
end
|
13
|
+
|
14
|
+
buf << headings.join( " • " )
|
15
|
+
buf << "\n\n"
|
16
|
+
|
17
|
+
|
18
|
+
TraitType.each do |tt|
|
19
|
+
buf << "## #{tt.name} (#{tt.code})\n\n"
|
20
|
+
buf << "_Genes #{tt.genes}_\n\n"
|
21
|
+
buf << make_table( tt.traits )
|
22
|
+
buf << "\n\n"
|
23
|
+
end
|
24
|
+
|
25
|
+
puts buf
|
26
|
+
|
27
|
+
buf
|
28
|
+
end ## method build
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
def make_table( traits )
|
33
|
+
rows = make_rows( traits, columns: 2 ) ## was 4
|
34
|
+
## pp rows
|
35
|
+
|
36
|
+
buf = ""
|
37
|
+
buf << "|Kai|Code|Name |Kai|Code|Name |\n"
|
38
|
+
buf << "|--:|---:|-------------|--:|---:|------------|\n"
|
39
|
+
|
40
|
+
rows.each do |row|
|
41
|
+
buf << "| "
|
42
|
+
|
43
|
+
parts = row.map do |trait|
|
44
|
+
kai = trait.kai
|
45
|
+
## binary = "%05b" % Kai::NUM[kai]
|
46
|
+
code = trait.code
|
47
|
+
name = trait.name
|
48
|
+
tier = trait.tier_roman ## e.g. I,II,III, etc. : String
|
49
|
+
|
50
|
+
if name.nil?
|
51
|
+
## note: so far x/31 trait is unknown/undefined!!!
|
52
|
+
if kai == "x"
|
53
|
+
cattribute = "?"
|
54
|
+
elsif trait.type.key == :secret
|
55
|
+
cattribute = "? #{tier}" ## unknown unknown
|
56
|
+
else ## "anonymous / unnamed" gene / trait
|
57
|
+
cattribute = "∅ #{tier}" ## known unknown :-)
|
58
|
+
end
|
59
|
+
else
|
60
|
+
if name.downcase.start_with?( "totesbasic" ) ## note: special case for three totesbasic traits
|
61
|
+
q = "totesbasic"
|
62
|
+
else
|
63
|
+
q = name
|
64
|
+
end
|
65
|
+
cattribute = "**[#{name}](#{kitties_search_url(q)})** #{tier}"
|
66
|
+
end
|
67
|
+
|
68
|
+
"#{kai} | #{code} | #{cattribute}"
|
69
|
+
end
|
70
|
+
|
71
|
+
buf << parts.join( " | " )
|
72
|
+
buf << " |\n"
|
73
|
+
end
|
74
|
+
|
75
|
+
buf
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
## helpers
|
80
|
+
def make_rows( items, columns: 2 )
|
81
|
+
offset = items.size / columns
|
82
|
+
pp offset
|
83
|
+
|
84
|
+
rows = []
|
85
|
+
offset.times.with_index do |row|
|
86
|
+
## note: construct [items[row],items[offset+row],items[offset*2+row], ...]
|
87
|
+
rows << columns.times.with_index.map { |col| items[offset*col+row] }
|
88
|
+
end
|
89
|
+
rows
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
def save( path )
|
94
|
+
File.open( path, "w:utf-8" ) do |f|
|
95
|
+
f.write build
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
end # class GenesPage
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Kittypedia
|
2
|
+
|
3
|
+
MAJOR = 0
|
4
|
+
MINOR = 0
|
5
|
+
PATCH = 1
|
6
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
7
|
+
|
8
|
+
def self.version
|
9
|
+
VERSION
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.banner
|
13
|
+
"kittypedia/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.root
|
17
|
+
File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
|
18
|
+
end
|
19
|
+
|
20
|
+
end # module Kittypedia
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kittypedia
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerald Bauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kittyverse
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '7'
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '4.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '7'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: hoe
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.22'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.22'
|
61
|
+
description: kittypedia - (auto-)generate and update pages on cattributes, traits,
|
62
|
+
fancies (normal, exclusive, special editions) and more
|
63
|
+
email: wwwmake@googlegroups.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files:
|
67
|
+
- CHANGELOG.md
|
68
|
+
- Manifest.txt
|
69
|
+
- README.md
|
70
|
+
files:
|
71
|
+
- CHANGELOG.md
|
72
|
+
- Manifest.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- lib/kittypedia.rb
|
76
|
+
- lib/kittypedia/genome_tables.rb
|
77
|
+
- lib/kittypedia/links.rb
|
78
|
+
- lib/kittypedia/pages/genes.rb
|
79
|
+
- lib/kittypedia/version.rb
|
80
|
+
homepage: https://github.com/cryptocopycats/kittyverse
|
81
|
+
licenses:
|
82
|
+
- Public Domain
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options:
|
86
|
+
- "--main"
|
87
|
+
- README.md
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.2.2
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubygems_version: 3.1.4
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: kittypedia - (auto-)generate and update pages on cattributes, traits, fancies
|
105
|
+
(normal, exclusive, special editions) and more
|
106
|
+
test_files: []
|