mooncats 0.1.2 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,20 +11,37 @@ POSES = [
11
11
  'Stalking', ## 11
12
12
  ]
13
13
 
14
- FACES = [
14
+
15
+ OLD_FACES = [ ## old names for face (expressions)
15
16
  'Smile', ## 00
16
17
  'Frown (Look Down)', ## 01
17
18
  'Frown (Look Up)', ## 10
18
19
  'Flat Whiskers', ## 11
19
20
  ]
20
21
 
21
- FURS = [
22
+ FACES = [ ## face expressions
23
+ 'Smiling', ## 00
24
+ 'Grumpy', ## 01
25
+ 'Pouting', ## 10
26
+ 'Shy', ## 11
27
+ ]
28
+
29
+
30
+ OLD_FURS = [ ## old names for fur (patterns)
22
31
  'Solid', ## 00
23
32
  'Striped', ## 01
24
33
  'Eyepatch', ## 10
25
34
  'Half/Half', ## 11
26
35
  ]
27
36
 
37
+ FURS = [ ## fur (patterns)
38
+ 'Pure', ## 00
39
+ 'Tabby', ## 01
40
+ 'Spotted', ## 10
41
+ 'Tortie', ## 11
42
+ ]
43
+
44
+
28
45
  FACINGS = [
29
46
  'Left', # 0
30
47
  'Right', # 1
@@ -50,12 +67,15 @@ class Metadata
50
67
  def facing
51
68
  @facing ||= FACINGS[ bits[1,1].to_i(2) ] ## use desgin > 63 instead - why? why not?
52
69
  end
53
- def face
70
+ def face ## face (expression)
54
71
  @face ||= FACES[ bits[2,2].to_i(2) ]
55
72
  end
56
- def fur
73
+ alias_method :expression, :face
74
+
75
+ def fur ## fur (pattern) - add pattern alias - why? why not?
57
76
  @fur ||= FURS[ bits[4,2].to_i(2) ]
58
77
  end
78
+
59
79
  def pose
60
80
  @poses ||= POSES[ bits[6,2].to_i(2) ] ## use design % 4 instead - why? why not?
61
81
  end
@@ -87,7 +107,69 @@ class Metadata
87
107
  def rgb() [r,g,b]; end ## add rgb shortcut helper - why? why not?
88
108
 
89
109
  def invert?() k >= 128; end
90
- def pattern() k % 64; end ## treat facing left|right as the same
110
+ alias_method :pale?, :invert?
111
+
112
+
113
+ def pattern() k % 64; end ## treat facing left|right as the same - note: conflicts with fur (pattern) - find a better/different name?
114
+
115
+
116
+ def hue
117
+ @hue ||= begin
118
+ ## note: hsl[0], that is, hue MIGHT BE NEGATIVE!
119
+ ## e.g. try rbg( 91, 27, 41 )
120
+ ## resulting in
121
+ ## hsl( -13, 0.5423728813559322, 0.23137254901960785 )
122
+ ## remember: always use % 360 to make positive!!!
123
+ ## e.g. -13 % 360 => 347
124
+ ## -25 % 360 => 335
125
+ rgb = ChunkyPNG::Color.rgb( r, g, b )
126
+ hsl = ChunkyPNG::Color.to_hsl( rgb )
127
+ hsl[0] % 360 ## make sure number is always POSITIVE!!!
128
+ end
129
+ end
130
+
131
+
132
+ def color
133
+ case hue
134
+ when 345..359,
135
+ 0..14 then 'Red'
136
+ when 15..44 then 'Orange'
137
+ when 45..74 then 'Yellow'
138
+ when 75..104 then 'Chartreuse'
139
+ when 105..134 then 'Green'
140
+ when 135..164 then 'Teal'
141
+ when 165..194 then 'Cyan'
142
+ when 195..224 then 'Sky Blue'
143
+ when 225..254 then 'Blue'
144
+ when 255..284 then 'Purple'
145
+ when 285..314 then 'Magenta'
146
+ when 315..344 then 'Fuchsia'
147
+ else
148
+ puts "!! ERROR - unexpected hue (in degress); got #{hue} - expected 0 to 359"
149
+ exit 1
150
+ end
151
+ end
152
+
153
+
154
+ def xxx_color_old_formula ## remove - move to attic??
155
+ case hue
156
+ when 0..29 then 'Red'
157
+ when 30..59 then 'Orange'
158
+ when 60..89 then 'Yellow'
159
+ when 90..119 then 'Chartreuse'
160
+ when 120..149 then 'Green'
161
+ when 150..179 then 'Lime Green' ## now renamed to Teal
162
+ when 180..209 then 'Cyan'
163
+ when 210..239 then 'Sky Blue'
164
+ when 240..269 then 'Blue'
165
+ when 270..299 then 'Purple'
166
+ when 300..329 then 'Magenta'
167
+ when 330..359 then 'Fuchsia'
168
+ else
169
+ puts "!! ERROR - unexpected hue (in degress); got #{hue} - expected 0 to 359"
170
+ exit 1
171
+ end
172
+ end
91
173
 
92
174
 
93
175
  def design
@@ -96,32 +178,41 @@ class Metadata
96
178
 
97
179
  def facing() design.facing; end
98
180
  def face() design.face; end
181
+ alias_method :expression, :face
99
182
  def fur() design.fur; end
100
183
  def pose() design.pose; end
101
184
 
102
185
 
103
186
  ####
104
187
  # more "external" attributes
105
- def mint() @more[:mint]; end
188
+ def mint() @more[:mint]; end
189
+ def block() @more[:block]; end
190
+ def timestamp() @more[:timestamp]; end
191
+ def year() timestamp ? timestamp.year : nil; end
106
192
 
107
193
  #####
108
194
  # enable array-like access to - why? why not?
109
195
  def []( key )
110
196
  case key.to_sym
111
- when :id then id
112
- when :genesis then genesis?
113
- when :k then k
114
- when :r then r
115
- when :g then g
116
- when :b then b
117
- when :rgb then rgb
118
- when :invert then invert?
119
- when :design then design.to_i
120
- when :pattern then pattern
121
- when :facing then facing
122
- when :face then face
123
- when :fur then fur
124
- when :pose then pose
197
+ when :id then id
198
+ when :genesis then genesis?
199
+ when :k then k
200
+ when :r then r
201
+ when :g then g
202
+ when :b then b
203
+ when :rgb then rgb
204
+ when :invert,
205
+ :pale then invert?
206
+ when :hue then hue
207
+ when :color then color
208
+ when :design then design.to_i
209
+ when :pattern then pattern
210
+ when :facing then facing
211
+ when :face,
212
+ :expression then face
213
+ when :fur then fur
214
+ when :pose then pose
215
+ when :year then year # note: from more via timestamp
125
216
  else
126
217
  @more[ key ]
127
218
  end
@@ -1,9 +1,9 @@
1
1
 
2
2
  module Mooncats
3
3
 
4
- MAJOR = 0
4
+ MAJOR = 1
5
5
  MINOR = 1
6
- PATCH = 2
6
+ PATCH = 1
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mooncats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: chunky_png
14
+ name: pixelart
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -81,19 +81,42 @@ executables:
81
81
  extensions: []
82
82
  extra_rdoc_files:
83
83
  - CHANGELOG.md
84
- - LICENSE.md
85
84
  - Manifest.txt
86
85
  - README.md
86
+ - config/cryptocats/000.txt
87
+ - config/cryptocats/001.txt
88
+ - config/cryptocats/002.txt
89
+ - config/cryptocats/003.txt
90
+ - config/v2/008.txt
91
+ - config/v2/009.txt
92
+ - config/v2/010.txt
93
+ - config/v2/011.txt
94
+ - config/v2/012.txt
95
+ - config/v2/013.txt
96
+ - config/v2/014.txt
97
+ - config/v2/015.txt
87
98
  files:
88
99
  - CHANGELOG.md
89
- - LICENSE.md
90
100
  - Manifest.txt
91
101
  - README.md
92
102
  - Rakefile
93
103
  - bin/mooncat
104
+ - config/cryptocats/000.txt
105
+ - config/cryptocats/001.txt
106
+ - config/cryptocats/002.txt
107
+ - config/cryptocats/003.txt
108
+ - config/v2/008.txt
109
+ - config/v2/009.txt
110
+ - config/v2/010.txt
111
+ - config/v2/011.txt
112
+ - config/v2/012.txt
113
+ - config/v2/013.txt
114
+ - config/v2/014.txt
115
+ - config/v2/015.txt
94
116
  - lib/mooncats.rb
95
117
  - lib/mooncats/composite.rb
96
118
  - lib/mooncats/dataset.rb
119
+ - lib/mooncats/design.rb
97
120
  - lib/mooncats/designs.rb
98
121
  - lib/mooncats/image.rb
99
122
  - lib/mooncats/structs.rb
data/LICENSE.md DELETED
@@ -1,116 +0,0 @@
1
- CC0 1.0 Universal
2
-
3
- Statement of Purpose
4
-
5
- The laws of most jurisdictions throughout the world automatically confer
6
- exclusive Copyright and Related Rights (defined below) upon the creator and
7
- subsequent owner(s) (each and all, an "owner") of an original work of
8
- authorship and/or a database (each, a "Work").
9
-
10
- Certain owners wish to permanently relinquish those rights to a Work for the
11
- purpose of contributing to a commons of creative, cultural and scientific
12
- works ("Commons") that the public can reliably and without fear of later
13
- claims of infringement build upon, modify, incorporate in other works, reuse
14
- and redistribute as freely as possible in any form whatsoever and for any
15
- purposes, including without limitation commercial purposes. These owners may
16
- contribute to the Commons to promote the ideal of a free culture and the
17
- further production of creative, cultural and scientific works, or to gain
18
- reputation or greater distribution for their Work in part through the use and
19
- efforts of others.
20
-
21
- For these and/or other purposes and motivations, and without any expectation
22
- of additional consideration or compensation, the person associating CC0 with a
23
- Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24
- and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25
- and publicly distribute the Work under its terms, with knowledge of his or her
26
- Copyright and Related Rights in the Work and the meaning and intended legal
27
- effect of CC0 on those rights.
28
-
29
- 1. Copyright and Related Rights. A Work made available under CC0 may be
30
- protected by copyright and related or neighboring rights ("Copyright and
31
- Related Rights"). Copyright and Related Rights include, but are not limited
32
- to, the following:
33
-
34
- i. the right to reproduce, adapt, distribute, perform, display, communicate,
35
- and translate a Work;
36
-
37
- ii. moral rights retained by the original author(s) and/or performer(s);
38
-
39
- iii. publicity and privacy rights pertaining to a person's image or likeness
40
- depicted in a Work;
41
-
42
- iv. rights protecting against unfair competition in regards to a Work,
43
- subject to the limitations in paragraph 4(a), below;
44
-
45
- v. rights protecting the extraction, dissemination, use and reuse of data in
46
- a Work;
47
-
48
- vi. database rights (such as those arising under Directive 96/9/EC of the
49
- European Parliament and of the Council of 11 March 1996 on the legal
50
- protection of databases, and under any national implementation thereof,
51
- including any amended or successor version of such directive); and
52
-
53
- vii. other similar, equivalent or corresponding rights throughout the world
54
- based on applicable law or treaty, and any national implementations thereof.
55
-
56
- 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57
- applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58
- unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59
- and Related Rights and associated claims and causes of action, whether now
60
- known or unknown (including existing as well as future claims and causes of
61
- action), in the Work (i) in all territories worldwide, (ii) for the maximum
62
- duration provided by applicable law or treaty (including future time
63
- extensions), (iii) in any current or future medium and for any number of
64
- copies, and (iv) for any purpose whatsoever, including without limitation
65
- commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66
- the Waiver for the benefit of each member of the public at large and to the
67
- detriment of Affirmer's heirs and successors, fully intending that such Waiver
68
- shall not be subject to revocation, rescission, cancellation, termination, or
69
- any other legal or equitable action to disrupt the quiet enjoyment of the Work
70
- by the public as contemplated by Affirmer's express Statement of Purpose.
71
-
72
- 3. Public License Fallback. Should any part of the Waiver for any reason be
73
- judged legally invalid or ineffective under applicable law, then the Waiver
74
- shall be preserved to the maximum extent permitted taking into account
75
- Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76
- is so judged Affirmer hereby grants to each affected person a royalty-free,
77
- non transferable, non sublicensable, non exclusive, irrevocable and
78
- unconditional license to exercise Affirmer's Copyright and Related Rights in
79
- the Work (i) in all territories worldwide, (ii) for the maximum duration
80
- provided by applicable law or treaty (including future time extensions), (iii)
81
- in any current or future medium and for any number of copies, and (iv) for any
82
- purpose whatsoever, including without limitation commercial, advertising or
83
- promotional purposes (the "License"). The License shall be deemed effective as
84
- of the date CC0 was applied by Affirmer to the Work. Should any part of the
85
- License for any reason be judged legally invalid or ineffective under
86
- applicable law, such partial invalidity or ineffectiveness shall not
87
- invalidate the remainder of the License, and in such case Affirmer hereby
88
- affirms that he or she will not (i) exercise any of his or her remaining
89
- Copyright and Related Rights in the Work or (ii) assert any associated claims
90
- and causes of action with respect to the Work, in either case contrary to
91
- Affirmer's express Statement of Purpose.
92
-
93
- 4. Limitations and Disclaimers.
94
-
95
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
96
- surrendered, licensed or otherwise affected by this document.
97
-
98
- b. Affirmer offers the Work as-is and makes no representations or warranties
99
- of any kind concerning the Work, express, implied, statutory or otherwise,
100
- including without limitation warranties of title, merchantability, fitness
101
- for a particular purpose, non infringement, or the absence of latent or
102
- other defects, accuracy, or the present or absence of errors, whether or not
103
- discoverable, all to the greatest extent permissible under applicable law.
104
-
105
- c. Affirmer disclaims responsibility for clearing rights of other persons
106
- that may apply to the Work or any use thereof, including without limitation
107
- any person's Copyright and Related Rights in the Work. Further, Affirmer
108
- disclaims responsibility for obtaining any necessary consents, permissions
109
- or other rights required for any use of the Work.
110
-
111
- d. Affirmer understands and acknowledges that Creative Commons is not a
112
- party to this document and has no duty or obligation with respect to this
113
- CC0 or use of the Work.
114
-
115
- For more information, please see
116
- <http://creativecommons.org/publicdomain/zero/1.0/>