Home

Awesome

<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

Gem Version

A young child programming language for drawing and coloring with repetition.

Draw Color Repeat Demo

DCR is a minimal subset of Logo (turtle graphics) that is intentionally simplified to teach computer programming to all 1st-3rd grade young children in elementary school (not just the ones who already gravitate towards math and computers). It uses a stick figure to draw instead of Logo's turtle.

Draw Color Repeat Screenshot

<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)

Programming Language Syntax

DCR always starts with a stick figure at the center of the drawing area, facing up.

Draw Color Repeat Start

Programming language commands may be entered as text with the keyboard.

Commands are automatically executed while being entered, so no "Run" button is needed. Children 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.

Any invalid commands or values are simply ignored, so the programming language never errors.

If a partial command is entered (e.g. lef for left or rig for right), it is interpreted as the full command.

If a partial color value is entered (e.g. gree for green or rd for red), it is interpreted as the full color value.

If an invalid value is entered (e.g. right asdf), the default is assumed (e.g. 90 degrees).

Turning

Drawing

Coloring

Repetition

Samples

Rectangle

DCR Code:

forward 80
right
forward 160
right
repeat
color green

Screenshot:

rectangle

Square

DCR Code:

forward 80
right
repeat 3
color yellow

Screenshot:

square

Triangle

DCR Code:

right 60
forward 180
right 80
forward 270
color black

Screenshot:

triangle

Equilateral Triangle

DCR Code:

left

forward 100
right 120
repeat 2
color blue

Screenshot:

equilateral triangle

Octagon

DCR Code:

right 45
forward 80
repeat 7
color red

Screenshot:

octagon

Circle

DCR Code:

forward
right 1
repeat 360
color orange

Screenshot:

circle

Envelope

DCR Code:

left 60
forward 104
right 150
forward 180
right 150
forward 104
backward 104
left 60
forward 90
right
forward 180
right
forward 90
color white

Screenshot:

envelope

Bee Hive

DCR Code:

right 60
forward 20
repeat 4
color yellow
left 60
forward 20
repeat 2
right 60
forward 20
repeat 4
right 60
forward 20
left 60
forward 20
repeat 5

Screenshot:

bee hive

Five Pointed Star

DCR Code:

left 144
forward 140
repeat 4
color white

Screenshot:

five pointed star

Sherrif Badge Star

DCR Code:

right 37

forward 28
right 51
forward 28
left 102
repeat 6
color yellow

Screenshot:

sherrif badge star

Stairs

DCR Code:

forward 20
right
forward 20
left
repeat 5
backward 240
left
forward 240
right

forward 20
right
forward 20
left
repeat 5
color white

Screenshot:

stairs

Aztec Pyramid

DCR Code:

right
forward 20
left
forward 20
repeat 5
right
forward 20

right
forward 20
left
forward 20
repeat 5
color yellow

Screenshot:

aztec pyramid

Stick Figure

DCR Code:

right 65
forward 70
backward 70
left 130
forward 70
backward 70
right 65
forward 30
right

left 4
forward 1
repeat 90

right 94
forward 80
right 55
forward 90
backward 90
left 110
forward 90

Screenshot:

stick figure

Octagon of Squares

DCR Code:

right
forward 30
repeat 2
right 45
forward 60
repeat 7
color blue

Screenshot:

octagon of squares

Octagon of Octagons

DCR Code:

forward 20
right 45
repeat 6
color
forward 70
repeat 9

Screenshot:

octagon of octagons

Circle of Circles

DCR Code:

right 8
forward 2
repeat 45
color
right 10
forward 32
repeat 19

Screenshot:

circle of circles

Spider Web

DCR Code:

right 10
forward 180
repeat 35
right 110
forward 260
repeat 35

Screenshot:

house

Swirl

DCR Code:

forward 200
right 45
repeat 6
color
forward 200
right 38
repeat 51

Screenshot:

swirl

Sun

DCR Code:

back 450

forward 150
right 5
repeat
color yellow
back 300
left 5
repeat 180

Screenshot:

sun

Playing Cards

DCR Code:

forward 50
right
forward 36
right
repeat
color
left 9
forward 5
repeat 14

Screenshot:

playing cards

Traffic Light

DCR Code:

backward 40

forward
right 2
repeat 180
color green

left 2
forward 60

forward
right 2
repeat 180
color yellow

left 2
forward 60

forward
right 2
repeat 180
color red

forward
right 2
repeat 90

left 4
forward 120

Screenshot:

traffic light

House

DCR Code:

right 45
forward 80
right
forward 80
right 135
forward 113
color red
right

right
forward 113
right
forward 113
right
forward 74
right
forward 40
right
forward 30
right
forward 40
right
forward 70
right
color gray

Screenshot:

house

Sandra's Samples

Sandra, an elementary school girl, was kind enough to share her own programs written in the DCR Programming Language, included as Sandra's Samples below.

Sandra's Sample 1

DCR Code:

l
f 300
r 230
f 150
l 140
f 270
r 128
f 240
re 98

Screenshot:

sandra sample1

Sandra's Sample 2

DCR Code:

left 200
forward 100
left 40
forward 100
left 60
forward 100
left 40
forward 100
right -40
forward 100
right -40
forward 100
right -70
forward 100
left 20
forward 80
repeat 30

Screenshot:

sandra sample2

Sandra's Sample 3

DCR Code:

forward 20
right 45
forward 22
repeat 8
left
forward 20
right
forward 10
right
forward 50
right
forward 100
right
forward 30
right
forward 20
right
forward 40
repeat 10

Screenshot:

sandra sample3

Sandra's Sample 4

DCR Code:

forward 50
left 50
forward 50
right 50
forward 50
right 50
forward 50
left 50
forward 50
right 50
forward 50
right 50
forward 50
right 50
forward 50
left 50
forward 50
right 50
forward 50
forward 50
right 50
forward 50
left 50
forward
repeat 40
color or

Screenshot:

sandra sample4

Sandra's Sample 5

DCR Code:

f 100
r 4
f 50
l 79
f 100
color
rep 50

Screenshot:

sandra sample5

Sandra's Sample 6

This is a continuation of Sandra's Sample 5.

DCR Code:

f 100
r 4
f 50
l 79
f 100
color
rep 50
l
f 300
r 230
f 150
l 140
f 270
r 128
f 240
re 98

Screenshot:

sandra sample6

Ruby gem

The draw_color_repeat ruby gem requires the JDK and JRuby versions mentioned in the pre-requisites of Glimmer DSL for SWT to run via the dcr command.

To setup DCR view the Ruby gem, run:

gem install draw_color_repeat

Afterwards, run:

dcr

If you run into trouble, then perhaps the newest version of JRuby is no longer compatible with this project. Try to setup by cloning the GitHub repo and running the Ruby code directly as per the next section.

Ruby code

To setup DCR, make sure to have the JRuby version in .ruby-version installed (e.g. jruby-9.4.9.0), and then run the following commands:

git clone https://github.com/AndyObtiva/dcr.git
cd dcr
bundle
bin/dcr

(running glimmer run works as an alternative to bin/dcr if there is a need to pass glimmer options for troubleshooting)

Contributing to dcr

Copyright

Copyright (c) 2021 Andy Maleh. See LICENSE.txt for further details.

--

<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 /> Built with Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)