Widgets

Students can explore concepts from our Computer Science Principles course hands-on using these digital tools. Let them encrypt and decrypt messages, compress song lyrics, and more! Use the widgets on their own, or create a single-concept lesson for your class using the plans linked with each widget below.

Binary Calculator

This widget allows students to input a number (in decimal), and then the number is converted to binary, octal, and hexadecimal. This widget is used in Unit 1 Lesson 5.

Text Compression

These widgets let students compress textual phrases into smaller pieces. One widget performs lossless text compression, while the other performs lossy text compression. The following video uses Code.org's text compression widgets as examples, but helps explain the purpose of each. Further information can be found in the lessons in which the widgets are used.

Lossless Text Compression

This widget gives students the chance to compress a piece of text. Students can use this to learn how to identify patterns, store those patterns in a "dictionary," and then replace the dictionary pattern with a number to create a lossless compressed version of text. The widget updates with each new portion entered and performs compression calculations so students can see if they're increasing or decreasing the total file size in real-time as they work. This widget is used in Unit 2 Lesson 2.

A challenge for students: How can you achieve the best compression possible by representing patterns of patterns? Have fun harnessing the power of this compression technique through experimentation, but also be aware that it can go very, very wrong.

Lossy Compression

This widget gives another chance for students to compress a piece of text, though this one works differently from the "Text Compression" widget. Instead of substituting patterns of text using a "dictionary," lossy compression loses part of the original message but tries its best not to change the meaning of the message, though occassionally the result is ambiguous. For example, consider abbreviations people use in texting; most people recognize common abbreviations, such as "OMW" representing the statement "On My Way." This compresses the message to save us the trouble of fully writing out the phrase, but it is lossy compression because many letters are dropped, which could make the message ambiguous to those who aren't familiar with the abbreviation. This widget is used in Unit 2 Lesson 5.

Programming

These tools offer students a chance to write code, use algorithms, and learn the Quorum programming language.

Turtle Programming

Turtle programming is a classic methodology for teaching novices about programming. Originally the "turtle" was a physical robot dragging a pen across a floor surface, which students would program to draw shapes. The same concepts are still commonly used today to teach programming concepts. The turtle module is used predominantly in Unit 3, and first appears in Unit 3 Lesson 4.

Cryptography

These widgets let students play with some classic schemes for both encrypting and "cracking" secret messages. The following video uses Code.org's cryptography widgets as examples, but helps explain their purpose. Specific information on each individual widget can be found in the lessons in which the widgets are used.

Caesar Cipher

This widget uses the Caesar shift, which encrypts a message by shifting the alphabet forward or backward by a set number of places. This widget is used in Unit 4 Lesson 7.

Random Substitution Cipher

This widget uses the random substitution method of encryption, which does a 1:1 substitution of one alphabet letter for another, randomly assigning the substitutions. This widget is used in Unit 4 Lesson 7.

Vigenere Cipher

This widget allows students to play with a much more sophisticated encryption technique that was considered virtually unbreakable for a very long time. The Vigenere Cipher is similar to the Caesar or random substitution ciphers, but the alphabetic shift changes for each letter based on a secret key. This widget is used in Unit 4 Lesson 8.

Modulo Calculator

The Modulo Calculator widget helps students learn how to use the modulo operation, which results in the remainder after dividing two positive integers. Modulo operations are key to certain encryption methods, so understanding them is crucial to using the "Public Key Cryptography" widget. This widget is used in Unit 4 Lesson 9.

Public Key Cryptography

Compared to the other cipher widgets, Public Key Cryptography is much closer to methods actually used on the Internet today. By exchanging public information that can only be accessed using private information, Public Key Cryptography allows two people to exchange encrypted information over insecure channels, such as the Internet. This widget is used in Unit 4 Lesson 9.