truchet_numworks.py

Created by vnap0v

Created on July 11, 2025

3.32 KB

Truchet Tiles using Python & Turtle

This script is a strong simplification of a version made for CPython to run on a PC see: GitHub truchet_tiles2.py

This numworks version also uses the Turtle library, unlike the PC version it does not have the capability to fill a shape.

This script shows a series of patterns of Truchet Tiles.

The tiles are drawn using the Turtle libary. All patters are made from 4 different tiles.

The patterns are defined as rows and columns of tile numbers, for this nested tuples are used:

pattern_X = (
    (2,4,3,4,4,2),
    (2,1,2,2,4,4),
    (3,4,4,2,2,4),
    (2,2,4,4,2,1),
    (4,2,2,4,3,4),
    (4,4,2,1,2,2)
    )


During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.