draw_color_repeat 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +556 -0
  4. data/VERSION +1 -0
  5. data/app/dcr.rb +51 -0
  6. data/app/dcr/launch.rb +3 -0
  7. data/app/models/dcr/command.rb +129 -0
  8. data/app/models/dcr/command/backward.rb +45 -0
  9. data/app/models/dcr/command/color.rb +120 -0
  10. data/app/models/dcr/command/empty.rb +30 -0
  11. data/app/models/dcr/command/forward.rb +47 -0
  12. data/app/models/dcr/command/left.rb +37 -0
  13. data/app/models/dcr/command/repeat.rb +42 -0
  14. data/app/models/dcr/command/right.rb +36 -0
  15. data/app/models/dcr/polygon.rb +37 -0
  16. data/app/models/dcr/program.rb +130 -0
  17. data/app/views/dcr/app_view.rb +128 -0
  18. data/app/views/dcr/compass.rb +56 -0
  19. data/bin/dcr +13 -0
  20. data/config/warble.rb +183 -0
  21. data/dcr.gemspec +0 -0
  22. data/lib/icon.rb +53 -0
  23. data/package/linux/Draw Color Repeat.png +0 -0
  24. data/package/macosx/Draw Color Repeat.icns +0 -0
  25. data/package/windows/Draw Color Repeat.ico +0 -0
  26. data/samples/aztec_pyramid.dcr +15 -0
  27. data/samples/bee_hive.dcr +15 -0
  28. data/samples/circle.dcr +4 -0
  29. data/samples/circle_of_circles.dcr +7 -0
  30. data/samples/envelope.dcr +14 -0
  31. data/samples/equilateral_triangle.dcr +6 -0
  32. data/samples/five_pointed_star.dcr +4 -0
  33. data/samples/house.dcr +25 -0
  34. data/samples/octagon.dcr +4 -0
  35. data/samples/octagon_of_octagons.dcr +6 -0
  36. data/samples/octagon_of_squares.dcr +7 -0
  37. data/samples/playing_cards.dcr +9 -0
  38. data/samples/rectangle.dcr +6 -0
  39. data/samples/sherrif_badge_star.dcr +8 -0
  40. data/samples/spider_web.dcr +6 -0
  41. data/samples/square.dcr +4 -0
  42. data/samples/stairs.dcr +16 -0
  43. data/samples/stick_figure.dcr +21 -0
  44. data/samples/sun.dcr +9 -0
  45. data/samples/swirl.dcr +7 -0
  46. data/samples/traffic_light.dcr +29 -0
  47. data/samples/triangle.dcr +5 -0
  48. data/vendor/jars/org/yaml/snakeyaml/1.28/snakeyaml-1.28.jar +0 -0
  49. metadata +207 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a2584e1be0c7a9307398807d877dabfe720e603d5d7113471d78713f7d9ec600
4
+ data.tar.gz: a9dc4303c7246f2bc39a6bab8ce511486e9da617d2e7e345aed45b54e8602e2f
5
+ SHA512:
6
+ metadata.gz: 5888e74e47615c3b0f9a5367b66bbb26807840213a9c2d21e0da8f312f2c3ca9fd1bf19d962e6ec9ba4e9679463df01b2a4c64afaa0d8ed90304b04d6bffe3b5
7
+ data.tar.gz: f5da1c94ac663921f34ae06ff303fe0df211a1c69ac66a17d9fbbe86de42e48ed5bbf3244e3ec2a5d00318249c3d21299a23203b569a920620fbc6eee7807571
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2021 Andy Maleh
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,556 @@
1
+ # <img alt="DCR" src="https://raw.githubusercontent.com/AndyObtiva/dcr/master/package/linux/Draw%20Color%20Repeat.png" height=85 /> DCR (Draw Color Repeat) 1.0.0
2
+ [![Gem Version](https://badge.fury.io/rb/draw_color_repeat.svg)](http://badge.fury.io/rb/draw_color_repeat)
3
+
4
+
5
+ A young child programming language for drawing and coloring with repetition.
6
+
7
+ DCR is a minimal subset of [Logo](https://el.media.mit.edu/logo-foundation/what_is_logo/logo_primer.html) that is intentionally simplified to teach computer programming to all 1-3 grade young children in school (not just the ones who already gravitate towards math and computers). It uses a stick figure to draw instead of [Logo](https://el.media.mit.edu/logo-foundation/what_is_logo/logo_primer.html)'s turtle.
8
+
9
+ ![Draw Color Repeat Screenshot](/images/dcr-screenshot.png)
10
+
11
+ [<img alt="DCR" src="https://raw.githubusercontent.com/AndyObtiva/dcr/master/package/linux/Draw%20Color%20Repeat.png" height=40 /> Download version 1.0.0 for the Mac (x64 Big Sur and older)](https://www.dropbox.com/s/uuu05kzg0grhune/Draw%20Color%20Repeat-1.0.0.dmg?dl=1)
12
+
13
+ ## Programming Language Syntax
14
+
15
+ DCR always starts with a stick figure at the center of the drawing area, facing up.
16
+
17
+ ![Draw Color Repeat Start](/images/dcr-start.png)
18
+
19
+ Programming language commands may be entered as text with the keyboard or through the graphical user interface using the mouse.
20
+
21
+ This programming language is automatically executed while commands are being entered, so no "Run" button is needed. Chilren will get to see their commands instantly drawn and alter the drawings spontaneously, thus turning this into a sort of a game too, not just a programming language.
22
+
23
+ Any invalid commands or values are simply ignored, so the programming language never errors.
24
+
25
+ If a partial command is entered (e.g. `lef` for `left` or `rig` for `right`), it is interpreted as the full command.
26
+
27
+ If a partial color value is entered (e.g. `gree` for `green` or `rd` for `red`), it is interpreted as the full color value.
28
+
29
+ If an invalid value is entered (e.g. `right asdf`), the default is assumed (e.g. `90` degrees).
30
+
31
+ ### Turning
32
+
33
+ - `right` (or `r`): Turn right by 90 degrees or any angle (e.g. `right`, `right 30`, or `r 30`)
34
+ - `left` (or `l`): Turn left by 90 degrees or any angle (e.g. `left`, `left 120`, or `l 120`)
35
+
36
+ ### Drawing
37
+
38
+ - `forward` (or `f`): Draw in black while moving foreward by one or more pixels (e.g. `forward`, `forward 50`, or `f 50`)
39
+ - `backward` (or `b`): Draw in black while moving backward by one or more pixels (e.g. `backward`, `backward 30`, or `b 30`)
40
+
41
+ ### Coloring
42
+
43
+ - `color` (or `c`): Color the shape already drawn by closing it and filling it with a random or specified color from the following list (e.g. `color`, `color red`, or `c red`):
44
+ - `black` (or `k`)
45
+ - `blue` (or `b`)
46
+ - `gray` (or `a`)
47
+ - `green` (or `g`)
48
+ - `orange` (or `o`)
49
+ - `pink` (or `i`)
50
+ - `purple` (or `p`)
51
+ - `red` (or `r`)
52
+ - `white` (or `w`)
53
+ - `yellow` (or `y`)
54
+
55
+ ### Repetition
56
+
57
+ - `repeat` (or `p`): Repeat all previous operations (up to the last empty line or the beginning otherwise) once or a number of times (e.g. `repeat`, `repeat 5`, or `p 5`)
58
+
59
+ ## Samples
60
+
61
+ ### Rectangle
62
+
63
+ DCR Code:
64
+
65
+ ```ruby
66
+ forward 80
67
+ right
68
+ forward 160
69
+ right
70
+ repeat
71
+ color green
72
+ ```
73
+
74
+ Screenshot:
75
+
76
+ ![rectangle](/images/dcr-samples-rectangle.png)
77
+
78
+ ### Square
79
+
80
+ DCR Code:
81
+
82
+ ```ruby
83
+ forward 80
84
+ right
85
+ repeat 3
86
+ color yellow
87
+ ```
88
+
89
+ Screenshot:
90
+
91
+ ![square](/images/dcr-samples-square.png)
92
+
93
+ ### Triangle
94
+
95
+ DCR Code:
96
+
97
+ ```ruby
98
+ right 60
99
+ forward 180
100
+ right 80
101
+ forward 270
102
+ color black
103
+ ```
104
+
105
+ Screenshot:
106
+
107
+ ![triangle](/images/dcr-samples-triangle.png)
108
+
109
+ ### Equilateral Triangle
110
+
111
+ DCR Code:
112
+
113
+ ```ruby
114
+ left
115
+
116
+ forward 100
117
+ right 120
118
+ repeat 2
119
+ color blue
120
+ ```
121
+
122
+ Screenshot:
123
+
124
+ ![equilateral triangle](/images/dcr-samples-equilateral-triangle.png)
125
+
126
+ ### Octagon
127
+
128
+ DCR Code:
129
+
130
+ ```ruby
131
+ right 45
132
+ forward 80
133
+ repeat 7
134
+ color red
135
+ ```
136
+
137
+ Screenshot:
138
+
139
+ ![octagon](/images/dcr-samples-octagon.png)
140
+
141
+ ### Circle
142
+
143
+ DCR Code:
144
+
145
+ ```ruby
146
+ forward
147
+ right 1
148
+ repeat 360
149
+ color orange
150
+ ```
151
+
152
+ Screenshot:
153
+
154
+ ![circle](/images/dcr-samples-circle.png)
155
+
156
+ ### Envelope
157
+
158
+ DCR Code:
159
+
160
+ ```ruby
161
+ left 60
162
+ forward 104
163
+ right 150
164
+ forward 180
165
+ right 150
166
+ forward 104
167
+ backward 104
168
+ left 60
169
+ forward 90
170
+ right
171
+ forward 180
172
+ right
173
+ forward 90
174
+ color white
175
+ ```
176
+
177
+ Screenshot:
178
+
179
+ ![envelope](/images/dcr-samples-envelope.png)
180
+
181
+ ### Bee Hive
182
+
183
+ DCR Code:
184
+
185
+ ```ruby
186
+ right 60
187
+ forward 20
188
+ repeat 4
189
+ color yellow
190
+ left 60
191
+ forward 20
192
+ repeat 2
193
+ right 60
194
+ forward 20
195
+ repeat 4
196
+ right 60
197
+ forward 20
198
+ left 60
199
+ forward 20
200
+ repeat 5
201
+ ```
202
+
203
+ Screenshot:
204
+
205
+ ![bee hive](/images/dcr-samples-bee-hive.png)
206
+
207
+ ### Five Pointed Star
208
+
209
+ DCR Code:
210
+
211
+ ```ruby
212
+ left 144
213
+ forward 140
214
+ repeat 4
215
+ color white
216
+ ```
217
+
218
+ Screenshot:
219
+
220
+ ![five pointed star](/images/dcr-samples-five-pointed-star.png)
221
+
222
+ ### Sherrif Badge Star
223
+
224
+ DCR Code:
225
+
226
+ ```ruby
227
+ right 37
228
+
229
+ forward 28
230
+ right 51
231
+ forward 28
232
+ left 102
233
+ repeat 6
234
+ color yellow
235
+ ```
236
+
237
+ Screenshot:
238
+
239
+ ![sherrif badge star](/images/dcr-samples-sherrif-badge-star.png)
240
+
241
+ ### Stairs
242
+
243
+ DCR Code:
244
+
245
+ ```ruby
246
+ forward 20
247
+ right
248
+ forward 20
249
+ left
250
+ repeat 5
251
+ backward 240
252
+ left
253
+ forward 240
254
+ right
255
+
256
+ forward 20
257
+ right
258
+ forward 20
259
+ left
260
+ repeat 5
261
+ color white
262
+ ```
263
+
264
+ Screenshot:
265
+
266
+ ![stairs](/images/dcr-samples-stairs.png)
267
+
268
+ ### Aztec Pyramid
269
+
270
+ DCR Code:
271
+
272
+ ```ruby
273
+ right
274
+ forward 20
275
+ left
276
+ forward 20
277
+ repeat 5
278
+ right
279
+ forward 20
280
+
281
+ right
282
+ forward 20
283
+ left
284
+ forward 20
285
+ repeat 5
286
+ color yellow
287
+ ```
288
+
289
+ Screenshot:
290
+
291
+ ![aztec pyramid](/images/dcr-samples-aztec-pyramid.png)
292
+
293
+ ### Stick Figure
294
+
295
+ DCR Code:
296
+
297
+ ```ruby
298
+ right 65
299
+ forward 70
300
+ backward 70
301
+ left 130
302
+ forward 70
303
+ backward 70
304
+ right 65
305
+ forward 30
306
+ right
307
+
308
+ left 4
309
+ forward 1
310
+ repeat 90
311
+
312
+ right 94
313
+ forward 80
314
+ right 55
315
+ forward 90
316
+ backward 90
317
+ left 110
318
+ forward 90
319
+ ```
320
+
321
+ Screenshot:
322
+
323
+ ![stick figure](/images/dcr-samples-stick-figure.png)
324
+
325
+
326
+ ### Octagon of Squares
327
+
328
+ DCR Code:
329
+
330
+ ```ruby
331
+ right
332
+ forward 30
333
+ repeat 2
334
+ right 45
335
+ forward 60
336
+ repeat 7
337
+ color blue
338
+ ```
339
+
340
+ Screenshot:
341
+
342
+ ![octagon of squares](/images/dcr-samples-octagon-of-squares.png)
343
+
344
+ ### Octagon of Octagons
345
+
346
+ DCR Code:
347
+
348
+ ```ruby
349
+ forward 20
350
+ right 45
351
+ repeat 6
352
+ color
353
+ forward 70
354
+ repeat 9
355
+ ```
356
+
357
+ Screenshot:
358
+
359
+ ![octagon of octagons](/images/dcr-samples-octagon-of-octagons.png)
360
+
361
+ ### Circle of Circles
362
+
363
+ DCR Code:
364
+
365
+ ```ruby
366
+ right 8
367
+ forward 2
368
+ repeat 45
369
+ color
370
+ right 10
371
+ forward 32
372
+ repeat 19
373
+ ```
374
+
375
+ Screenshot:
376
+
377
+ ![circle of circles](/images/dcr-samples-circle-of-circles.png)
378
+
379
+ ### Spider Web
380
+
381
+ DCR Code:
382
+
383
+ ```ruby
384
+ right 10
385
+ forward 180
386
+ repeat 35
387
+ right 110
388
+ forward 260
389
+ repeat 35
390
+ ```
391
+
392
+ Screenshot:
393
+
394
+ ![house](/images/dcr-samples-spider-web.png)
395
+
396
+ ### Swirl
397
+
398
+ DCR Code:
399
+
400
+ ```ruby
401
+ forward 200
402
+ right 45
403
+ repeat 6
404
+ color
405
+ forward 200
406
+ right 38
407
+ repeat 51
408
+ ```
409
+
410
+ Screenshot:
411
+
412
+ ![swirl](/images/dcr-samples-swirl.png)
413
+
414
+ ### Sun
415
+
416
+ DCR Code:
417
+
418
+ ```ruby
419
+ back 450
420
+
421
+ forward 150
422
+ right 5
423
+ repeat
424
+ color yellow
425
+ back 300
426
+ left 5
427
+ repeat 180
428
+ ```
429
+
430
+ Screenshot:
431
+
432
+ ![sun](/images/dcr-samples-sun.png)
433
+
434
+ ### Playing Cards
435
+
436
+ DCR Code:
437
+
438
+ ```ruby
439
+ forward 50
440
+ right
441
+ forward 36
442
+ right
443
+ repeat
444
+ color
445
+ left 9
446
+ forward 5
447
+ repeat 14
448
+ ```
449
+
450
+ Screenshot:
451
+
452
+ ![playing cards](/images/dcr-samples-playing-cards.png)
453
+
454
+ ### Traffic Light
455
+
456
+ DCR Code:
457
+
458
+ ```ruby
459
+ backward 40
460
+
461
+ forward
462
+ right 2
463
+ repeat 180
464
+ color green
465
+
466
+ left 2
467
+ forward 60
468
+
469
+ forward
470
+ right 2
471
+ repeat 180
472
+ color yellow
473
+
474
+ left 2
475
+ forward 60
476
+
477
+ forward
478
+ right 2
479
+ repeat 180
480
+ color red
481
+
482
+ forward
483
+ right 2
484
+ repeat 90
485
+
486
+ left 4
487
+ forward 120
488
+ ```
489
+
490
+ Screenshot:
491
+
492
+ ![traffic light](/images/dcr-samples-traffic-light.png)
493
+
494
+ ### House
495
+
496
+ DCR Code:
497
+
498
+ ```ruby
499
+ right 45
500
+ forward 80
501
+ right
502
+ forward 80
503
+ right 135
504
+ forward 113
505
+ color red
506
+ right
507
+
508
+ right
509
+ forward 113
510
+ right
511
+ forward 113
512
+ right
513
+ forward 74
514
+ right
515
+ forward 40
516
+ right
517
+ forward 30
518
+ right
519
+ forward 40
520
+ right
521
+ forward 70
522
+ right
523
+ color gray
524
+ ```
525
+
526
+ Screenshot:
527
+
528
+ ![house](/images/dcr-samples-house.png)
529
+
530
+ ## Ruby gem
531
+
532
+ The [draw_color_repeat](https://rubygems.org/gems/draw_color_repeat) ruby gem requires the [JDK](https://www.oracle.com/ca-en/java/technologies/javase-downloads.html) and [JRuby](https://www.jruby.org) versions mentioned in the pre-requisites of [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt#pre-requisites) to run via `dcr` command.
533
+
534
+ ## Contributing to dcr
535
+
536
+ - Check out the latest master to make sure the feature hasn't been
537
+ implemented or the bug hasn't been fixed yet.
538
+ - Check out the issue tracker to make sure someone already hasn't
539
+ requested it and/or contributed it.
540
+ - Fork the project.
541
+ - Start a feature/bugfix branch.
542
+ - Commit and push until you are happy with your contribution.
543
+ - Make sure to add tests for it. This is important so I don't break it
544
+ in a future version unintentionally.
545
+ - Please try not to mess with the Rakefile, version, or history. If
546
+ you want to have your own version, or is otherwise necessary, that
547
+ is fine, but please isolate to its own commit so I can cherry-pick
548
+ around it.
549
+
550
+ ## Copyright
551
+
552
+ Copyright (c) 2021 Andy Maleh. See [LICENSE.txt](LICENSE.txt) for further details.
553
+
554
+ --
555
+
556
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) (JRuby Desktop Development GUI Framework)