ECT Pencil Code Program: Stroke Order of a Chinese Character


 At a glance…

Core subject(s)

English-Language Arts; Computer Science

Subject area(s)

Language; Programming Fundamentals

Suggested age

8 to 18 years old

Overview

Use this program to illustrate the stroke order of a chinese character by having students create their own rendering of a Chinese character, being careful to draw the strokes in the right order. Have students analyze or fill in or change parts of the program. This program could be used to further your understanding of how you could use Pencil Code in the classroom, as a demonstration or discussion with your students, or as a way to introduce various CT concepts, such as pattern recognition or abstraction, to your students by inviting them to extend the existing functionality of the program.

Pencil Code Program

Copy/Paste the following program into a ‘Blank Editor’ on the Pencil Code website (new.pencilcode.net)

# Copyright 2015 Google Inc. All Rights Reserved.

 

# Licensed under the Apache License, Version 2.0 (the "License");

# you may not use this file except in compliance with the License.

# You may obtain a copy of the License at

 

# http://www.apache.org/licenses/LICENSE-2.0

 

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

chgrid = (size) ->

  d = size * sqrt 2

  pen gray, 0.5

  for [1..4]

    for [1..4]

      fd size; rt 90

    rt 45; fd d; bk d; rt 45

chgrid(150)

pen blue, 5

pen off

movexy -25, 125

pen on

rt 135

fd 50

pen off

movexy -75, -40

lt 45

pen on

fd 65

rt 90

fd 175

rt 135

fd 40

pen off

movexy -75, 95

rt 135

pen on

fd 75

rt 135

fd 130

pen off

movexy +200, +120

pen on

rt 25

fd 75

pen off

fd 5

pen on

lt 120

fd 150

Sample Output


Screen Shot 2015-06-09 at 1.40.52 PM.png

Additional Information and Resources

Computational Thinking Concepts*

Concept

Definition

Abstraction

Identifying and extracting relevant information to define main idea(s)

Pattern Recognition

Observing patterns, trends, and regularities in data

* Explore the Computational Thinking Concepts Guide for a list of the CT concepts noted on ECT, including tips for implementing each concept in your classroom

Additional Resource Links

Administrative Details

Contact info

For more info about Exploring Computational Thinking (ECT), visit the ECT website (g.co/exploringCT)

Credits

Developed by the Exploring Computational Thinking team at Google and reviewed by K-12 educators from around the world.

Last updated on

06/09/2015

Copyright info

Except as otherwise noted, the content of this document is licensed under the Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache 2.0 License.


 ECT Pencil Code Program: Stroke Order of a Chinese Character                                                    of