Roll ‘n’ Code

Junior (Age 9 – 12)

Curriculum Goal

Junior: Patterning and Algebra

  • Solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves sequential, concurrent, repeating, and nested events

Intermediate: Patterning and Algebra

  • Solve problems and create computational representations of mathematical situations by writing and executing efficient code, including code that involves events influenced by a defined count and/or sub-program and other control structures


  • Students work individually to create a coding square, and then challenge a partner to interpret their code before working in a group mix and match activity
  • Students should be familiar with spatial language
  • Students should have had an introduction to foundational coding


  • Roll N’ Code Slides (Appendix A)
  • Coding Square Templates (Appendix B)
  • Command Sheet/Coding Language (Appendix C)
  • Colouring Tools (red, blue, green, and yellow)
  • Dice
  • Pencil
  • Eraser


Part 1: Quilt Square Creations

  • Project Appendix A and engage students in a discussion about which code matches the design on the left. The code for the example starts in the left-most box. Remind students that codes are read and written from left to right, top to bottom.
  • Each student will work with their own coding square (Appendix B).
    • Teachers should choose the coding square option most appropriate for their students.
    • Coding squares with more tiles will increase difficulty for students.
  • Show Slide 3 of Appendix A. Use the footnotes or the lesson plan to instruct students how to complete the activity.
  • Have students start by rolling the die to determine how many squares to colour in. The number on the die represents the number of squares the student will colour. Have students start with blue, continue with red, then green, then yellow.
  • The student will continue rolling the die until all the squares are filled by a colour.
    • If students are left with blank squares, have them continue rolling the die until all squares are coloured. Use the same order of colours as before (blue, red, green, then yellow.)
  • Advance the slideshow to slide 4.
  • When the squares are coloured in, have students design a code on the command sheet (Appendix C) to provide instructions on how to replicate their coding square. Students can add boxes and numbers to their command sheet as necessary. Have students begin their code in a designated area (i.e., top left-hand square.)
    • An example of coding language that can be used is found in Appendix C.
    • The programmer can write the code in two ways, yet keep the same meaning:
      • Use only symbols (e.g., →|→, to signify two squares to the right).
      • Use numbers and symbols (e.g., 2 →, to signify two squares to the right)
    • Encourage the programmer to find the simplest way to write their code.
      • Ask students to share strategies on the simplest or most efficient way to write code.
    • When the code is complete, have students write their name or an identifiable symbol on the back of their code and quilting square.

Part 2: Quilt Square Recreation

  • Students should be provided with a new, blank coding square.
  • Students will pair up and exchange coding instructions.
  • Using the coding instructions from their partner, students will recreate their partner’s coding square.
  • When both partners have finished recreating their partner’s coding square, students will bring out the originals to compare.
    • Encourage students to work cooperatively using coding language to recreate the correct coding square from the code. Emphasize it is not a competition, but the task is to master creating and interpreting the correct code to excel in the challenge.

Part 3: Mix and Match

  • Instruct students to hand in their coding squares and coding instructions. Place the coding squares and coding instructions into groups of 6, ensuring that the matching code and square remain in the same group.
  • Arrange students into groups of 6.
  • Place six corresponding coding squares and instructions, face up on a surface (i.e., a table, the floor, around the room, etc.)
    • The coding squares may need to be taped down so students cannot flip the square to find the matching name or symbol to the code.
  • Once each group has matched the code with its corresponding coding square, have students circulate tables to see if they can match another group of six codes.
    • Encourage collaboration and discussion between students.


  • Create a large class display of coding squares using the smaller coding squares, organized by a mathematical concept of choice (i.e., biggest area covered by a colour, fraction of coding square coloured in blue, etc.)
  • Once the coding display is created, challenge groups of students to create code to represent the class’ large quilt.

Look Fors

  • Do students understand that code is read from left to right before moving down to the next line?
  • Are students able to recreate their partner’s coding square using their coding instructions?
  • Are students able to look at a code and find its match without redrawing the coding square?
  • Do students colour all their boxes in a straight line? Or do they spread boxes with the same colours out in different patterns?


  • Have students work in partners to determine the fraction of the coding square represented by each colour. Ask students to simplify or reduce fractions using concepts such as equivalent fractions.
  • Once the fractions are determined, have students order the colours from biggest fraction to smallest. For intermediate students, have them convert fractions to decimal numbers.
  • Students can highlight how similar fractions can appear different on coding squares despite the same set of parameters.
  • Students can also create more complex fractions by creating designs with triangles within their coding square.

Share this lesson

Share on facebook
Share on twitter
Share on email