copycats 0.0.1 → 0.5.0
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 +4 -4
- data/Manifest.txt +16 -0
- data/README.md +247 -1
- data/Rakefile +3 -1
- data/bin/kitty +17 -0
- data/lib/copycats.rb +53 -0
- data/lib/copycats/base32.rb +155 -0
- data/lib/copycats/data.rb +99 -0
- data/lib/copycats/gene.rb +87 -0
- data/lib/copycats/genome.rb +177 -0
- data/lib/copycats/models/kitty.rb +13 -0
- data/lib/copycats/reports/genes.rb +82 -0
- data/lib/copycats/reports/kitty.rb +45 -0
- data/lib/copycats/reports/mix.rb +45 -0
- data/lib/copycats/reports/traits.rb +122 -0
- data/lib/copycats/schema.rb +23 -0
- data/lib/copycats/tool.rb +66 -0
- data/lib/copycats/traits.rb +298 -0
- data/lib/copycats/version.rb +2 -2
- data/test/test_base32.rb +77 -0
- data/test/test_genome.rb +92 -0
- data/test/test_mixgenes.rb +63 -0
- metadata +53 -6
data/lib/copycats/version.rb
CHANGED
data/test/test_base32.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_base32.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
|
11
|
+
class TestBase32 < MiniTest::Test
|
12
|
+
|
13
|
+
|
14
|
+
def test_kai
|
15
|
+
|
16
|
+
## Kitty #1001
|
17
|
+
## see https://cryptokittydex.com/kitties/1001
|
18
|
+
|
19
|
+
binary = 0b0000000000000000010010100101001010010011000111001110010000001000010111000001010010111101110011100000000101001010000000110001100010000100011010100000110010000000100011000110000000101001010010100110001100010100101000110100101000010010100101011011100111001110 # binary
|
20
|
+
hex = 0x00004a52931ce4085c14bdce014a0318846a0c808c60294a6314a34a_1295_b9ce # hex
|
21
|
+
|
22
|
+
kai = "aaaa 7885 22f2 agff 1661 7755 e979 2441 6667 7664 a9aa cfff".gsub( ' ', '' )
|
23
|
+
|
24
|
+
assert_equal binary, hex
|
25
|
+
|
26
|
+
puts "binary number:"
|
27
|
+
pp binary
|
28
|
+
puts "hex number:"
|
29
|
+
pp hex
|
30
|
+
|
31
|
+
kai2 = Base32.encode( hex )
|
32
|
+
pp kai
|
33
|
+
pp kai2
|
34
|
+
|
35
|
+
hex2 = Base32.decode( kai2 )
|
36
|
+
pp hex2
|
37
|
+
assert_equal hex, hex2
|
38
|
+
assert_equal kai, kai2
|
39
|
+
|
40
|
+
|
41
|
+
kai3 = Kai.encode( hex )
|
42
|
+
hex3 = Kai.decode( kai3 )
|
43
|
+
assert_equal hex, hex3
|
44
|
+
assert_equal kai, kai3
|
45
|
+
|
46
|
+
puts "kai.length: #{kai.length}" ## 48
|
47
|
+
puts " first: #{kai[0]}"
|
48
|
+
puts " last: #{kai[-1]}"
|
49
|
+
puts " last: #{kai[47]}"
|
50
|
+
|
51
|
+
puts kai.reverse
|
52
|
+
puts kai.reverse[0,4]
|
53
|
+
puts kai.reverse[4,4]
|
54
|
+
puts kai.reverse[8,4]
|
55
|
+
eyes = kai.reverse[12,4]
|
56
|
+
puts "eyes:"
|
57
|
+
puts eyes
|
58
|
+
|
59
|
+
puts TRAITS[:eyes]
|
60
|
+
pp eyes[0]
|
61
|
+
puts TRAITS[:eyes][eyes[0]]
|
62
|
+
puts TRAITS[:eyes][eyes[1]]
|
63
|
+
puts TRAITS[:eyes][eyes[2]]
|
64
|
+
puts TRAITS[:eyes][eyes[3]]
|
65
|
+
|
66
|
+
color1 = kai.reverse[16,4]
|
67
|
+
puts "color1:"
|
68
|
+
puts color1
|
69
|
+
pp color1[0]
|
70
|
+
puts TRAITS[:color1][color1[0]]
|
71
|
+
puts TRAITS[:color1][color1[1]]
|
72
|
+
puts TRAITS[:color1][color1[2]]
|
73
|
+
puts TRAITS[:color1][color1[3]]
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
end # class TestBase32
|
data/test/test_genome.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_genome.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
|
11
|
+
class TestGenome < MiniTest::Test
|
12
|
+
|
13
|
+
def xx_test_traits
|
14
|
+
pp TRAITS
|
15
|
+
|
16
|
+
assert true ## (for now) everything ok if we get here
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def test_kitty_100000
|
21
|
+
## see https://cryptokittydex.com/kitties/100000
|
22
|
+
## https://www.cryptokitties.co/kitty/100000
|
23
|
+
|
24
|
+
kai = "dadc 557j 4aaa gb9g 1161 383k 7dbe 774b 6667 8438 dd9a cbbd"
|
25
|
+
|
26
|
+
genome = Genome.new( kai )
|
27
|
+
pp genome
|
28
|
+
|
29
|
+
puts "body: #{genome.body}"
|
30
|
+
puts "coloreyes: #{genome.coloreyes}"
|
31
|
+
puts "eyes: #{genome.eyes}"
|
32
|
+
puts "pattern: #{genome.pattern}"
|
33
|
+
puts "mouth: #{genome.mouth}"
|
34
|
+
puts "color1: #{genome.color1}"
|
35
|
+
puts "color2: #{genome.color2}"
|
36
|
+
puts "color3: #{genome.color3}"
|
37
|
+
|
38
|
+
assert_equal "munchkin", genome.body
|
39
|
+
assert_equal "strawberry", genome.coloreyes
|
40
|
+
assert_equal "crazy", genome.eyes
|
41
|
+
assert_equal "luckystripe", genome.pattern
|
42
|
+
assert_equal "soserious", genome.mouth
|
43
|
+
assert_equal "greymatter", genome.color1
|
44
|
+
assert_equal "lemonade", genome.color2
|
45
|
+
assert_equal "bloodred", genome.color3
|
46
|
+
|
47
|
+
|
48
|
+
puts genome.genes[:color1].d
|
49
|
+
puts genome.genes[:color1].r1
|
50
|
+
puts genome.genes[:color1].r2
|
51
|
+
puts genome.genes[:color1].r3
|
52
|
+
|
53
|
+
puts genome.genes[:eyes].d
|
54
|
+
puts genome.genes[:eyes].r1
|
55
|
+
puts genome.genes[:eyes].r2
|
56
|
+
puts genome.genes[:eyes].r3
|
57
|
+
|
58
|
+
puts TRAITS[:eyes][ genome.genes[:eyes].d ]
|
59
|
+
puts TRAITS[:eyes][ genome.genes[:eyes].r1 ]
|
60
|
+
puts TRAITS[:eyes][ genome.genes[:eyes].r2 ]
|
61
|
+
puts TRAITS[:eyes][ genome.genes[:eyes].r3 ]
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_kitty_99895
|
65
|
+
## see https://cryptokittydex.com/kitties/99895
|
66
|
+
## https://www.cryptokitties.co/kitty/99895
|
67
|
+
|
68
|
+
kai = "cdad 55r6 7f2f g9bg 1111 3757 d99d 272h 8k78 k884 9da9 fdee"
|
69
|
+
|
70
|
+
genome = Genome.new( kai )
|
71
|
+
pp genome
|
72
|
+
|
73
|
+
puts "body: #{genome.body}"
|
74
|
+
puts "coloreyes: #{genome.coloreyes}"
|
75
|
+
puts "eyes: #{genome.eyes}"
|
76
|
+
puts "pattern: #{genome.pattern}"
|
77
|
+
puts "mouth: #{genome.mouth}"
|
78
|
+
puts "color1: #{genome.color1}"
|
79
|
+
puts "color2: #{genome.color2}"
|
80
|
+
puts "color3: #{genome.color3}"
|
81
|
+
|
82
|
+
assert_equal "sphynx", genome.body
|
83
|
+
assert_equal "mintgreen", genome.coloreyes
|
84
|
+
assert_equal "thicccbrowz", genome.eyes
|
85
|
+
assert_equal "calicool", genome.pattern
|
86
|
+
assert_equal "soserious", genome.mouth
|
87
|
+
assert_equal "cloudwhite", genome.color1
|
88
|
+
assert_equal "coffee", genome.color2
|
89
|
+
assert_equal "kittencream", genome.color3
|
90
|
+
end
|
91
|
+
|
92
|
+
end # class TestGenome
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_mixgenes.rb
|
6
|
+
|
7
|
+
## note:
|
8
|
+
## rand(100) - random number between 0 and 100 inclusively
|
9
|
+
## todo/check: use rand(99) - why? why not? e.g. 0 to 99 inclusive (100 values)
|
10
|
+
|
11
|
+
|
12
|
+
require 'helper'
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
class TestMixGenes < MiniTest::Test
|
17
|
+
|
18
|
+
def setup
|
19
|
+
Lottery.random = Random.new( 1234 ) ## seed == 1234
|
20
|
+
end
|
21
|
+
|
22
|
+
def mixgenes( matron, sire )
|
23
|
+
matron.mix( sire )
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_random
|
27
|
+
assert_equal 47, Lottery.rand(100)
|
28
|
+
assert_equal 83, Lottery.rand(100)
|
29
|
+
assert_equal 38, Lottery.rand(100)
|
30
|
+
assert_equal 53, Lottery.rand(100)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def test_baby
|
35
|
+
|
36
|
+
kai1 = "dadc 557j 4aaa gb9g 1161 383k 7dbe 774b 6667 8438 dd9a cbbd" # kitty 100000
|
37
|
+
kai2 = "cdad 55r6 7f2f g9bg 1111 3757 d99d 272h 8k78 k884 9da9 fdee" # kitty 99895
|
38
|
+
|
39
|
+
matron = Genome.new( kai1 )
|
40
|
+
sire = Genome.new( kai2 )
|
41
|
+
baby = mixgenes( matron, sire )
|
42
|
+
pp baby
|
43
|
+
|
44
|
+
puts "body: #{baby.body}"
|
45
|
+
puts "coloreyes: #{baby.coloreyes}"
|
46
|
+
puts "eyes: #{baby.eyes}"
|
47
|
+
puts "pattern: #{baby.pattern}"
|
48
|
+
puts "mouth: #{baby.mouth}"
|
49
|
+
puts "color1: #{baby.color1}"
|
50
|
+
puts "color2: #{baby.color2}"
|
51
|
+
puts "color3: #{baby.color3}"
|
52
|
+
|
53
|
+
assert_equal "laperm", baby.body
|
54
|
+
assert_equal "strawberry", baby.coloreyes
|
55
|
+
assert_equal "simple", baby.eyes
|
56
|
+
assert_equal "calicool", baby.pattern
|
57
|
+
assert_equal "soserious", baby.mouth
|
58
|
+
assert_equal "salmon", baby.color1
|
59
|
+
assert_equal "coffee", baby.color2
|
60
|
+
assert_equal "bloodred", baby.color3
|
61
|
+
end
|
62
|
+
|
63
|
+
end # class TestMixGenes
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copycats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: rdoc
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,9 +68,11 @@ dependencies:
|
|
40
68
|
version: '3.16'
|
41
69
|
description: copycats - command line tool (and core library) crypto cats / kitties
|
42
70
|
collectibles unchained - buy! sell! hodl! sire! - play for free - runs off the blockchain
|
43
|
-
- no ether
|
71
|
+
w/ ledger lite - no ether / gas required; run your own peer-to-peer (P2P) network
|
72
|
+
node over HTTP
|
44
73
|
email: wwwmake@googlegroups.com
|
45
|
-
executables:
|
74
|
+
executables:
|
75
|
+
- kitty
|
46
76
|
extensions: []
|
47
77
|
extra_rdoc_files:
|
48
78
|
- HISTORY.md
|
@@ -55,9 +85,25 @@ files:
|
|
55
85
|
- Manifest.txt
|
56
86
|
- README.md
|
57
87
|
- Rakefile
|
88
|
+
- bin/kitty
|
58
89
|
- lib/copycats.rb
|
90
|
+
- lib/copycats/base32.rb
|
91
|
+
- lib/copycats/data.rb
|
92
|
+
- lib/copycats/gene.rb
|
93
|
+
- lib/copycats/genome.rb
|
94
|
+
- lib/copycats/models/kitty.rb
|
95
|
+
- lib/copycats/reports/genes.rb
|
96
|
+
- lib/copycats/reports/kitty.rb
|
97
|
+
- lib/copycats/reports/mix.rb
|
98
|
+
- lib/copycats/reports/traits.rb
|
99
|
+
- lib/copycats/schema.rb
|
100
|
+
- lib/copycats/tool.rb
|
101
|
+
- lib/copycats/traits.rb
|
59
102
|
- lib/copycats/version.rb
|
60
103
|
- test/helper.rb
|
104
|
+
- test/test_base32.rb
|
105
|
+
- test/test_genome.rb
|
106
|
+
- test/test_mixgenes.rb
|
61
107
|
- test/test_version.rb
|
62
108
|
homepage: https://github.com/openblockchains/copycats
|
63
109
|
licenses:
|
@@ -85,6 +131,7 @@ rubygems_version: 2.5.2
|
|
85
131
|
signing_key:
|
86
132
|
specification_version: 4
|
87
133
|
summary: copycats - command line tool (and core library) crypto cats / kitties collectibles
|
88
|
-
unchained - buy! sell! hodl! sire! - play for free - runs off the blockchain
|
89
|
-
ether
|
134
|
+
unchained - buy! sell! hodl! sire! - play for free - runs off the blockchain w/
|
135
|
+
ledger lite - no ether / gas required; run your own peer-to-peer (P2P) network node
|
136
|
+
over HTTP
|
90
137
|
test_files: []
|