Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
  1. Home
  2. /
  3. Learn
  4. /
  5. Piet

Learn Piet - 10 Code Examples & CST Typing Practice Test

Piet is an esoteric programming language where programs are abstract pictures. Instead of text, Piet code uses colored blocks, and program execution depends on transitions between colors.

View all 10 Piet code examples →
Hello World in PietPrint 'Hi' in PietSimple Counter in PietPrint Digits 0-9 in PietSimple Loop in PietPrint Alphabet A-Z in PietFibonacci Sequence in PietPrint 'Bye!' in PietSimple Arithmetic in PietNested Loop Output in Piet

Learn PIET with Real Code Examples

Updated Nov 25, 2025

Explain

Piet uses color codels (color blocks) to represent instructions.

Execution is controlled by the direction pointer (DP) and codel chooser (CC).

Instructions are determined by hue and brightness transitions between adjacent blocks.

Programs resemble abstract art inspired by Mondrian.

Piet is Turing-complete despite its visual and artistic nature.

Core Features

Color blocks act as operators

DP determines direction of movement

CC determines block-choice rules

Hue cycles represent command types

Brightness shifts represent command parameters

Basic Concepts Overview

Codel: smallest unit (pixel block) of a color

DP: direction pointer for execution flow

CC: codel chooser for flow handling

Hue transitions: determine commands

Brightness transitions: define operation magnitude

Project Structure

src/ - Piet image programs

assets/ - helper palettes and grids

examples/ - classic Piet artworks

tools/ - interpreters and debuggers

docs/ - design references and palettes

Building Workflow

Design program image in editor

Ensure valid Piet colors

Avoid compression artifacts

Run via interpreter

Debug using DP/CC visualization tools

Difficulty Use Cases

Beginner: simple push and output

Intermediate: arithmetic and stack manipulation

Advanced: loops using DP/CC blockers

Expert: full algorithms visually encoded

Artistic: large Mondrian-style programs

Comparisons

Piet vs INTERCAL: Piet is visual, INTERCAL is textual parody

Piet vs Brainfuck: Piet artistic, Brainfuck minimal

Piet vs Befunge: Both 2D, Piet uses color

Piet vs Python: Piet art-focused, Python practical

Piet vs Malbolge: Both hard, Piet more visual

Versioning Timeline

2001 - Piet created

2005 - npiet interpreter released

2010s - community examples grew

2020s - online editors and debuggers added

2025 - popular in coding-art events

Glossary

Codel: pixel block executing instruction

DP: direction pointer

CC: codel chooser

Hue cycle: color instruction wheel

Brightness: lightness level controlling command

Installation Setup

Install a Piet interpreter (npiet is popular)

Alternatively use online interpreters

Ensure images are saved as PNG or GIF

Use image editors that preserve color values exactly

Verify with simple push/print programs

Environment Setup

Install npiet or use online tools

Disable anti-aliasing in editor

Use exact Piet color palette

Test simple color blocks

Use debuggers for DP visualization

Config Files

No config needed

Optional interpreter flags

Palette reference files

Grid templates

Example project metadata

Cli Commands

npiet program.png

npiet --debug program.png

npiet --trace program.png

npiet --help

npiet --stackdump

Internationalization

Color-based, not language-based

Global community

Universally understandable

Documentation mainly in English

No locale-specific constraints

Accessibility

Platform-independent

Easy to run with online interpreters

Requires basic image-editing skills

Clear visual structure

Friendly for creative coders

Ui Styling

Programs look like abstract art

Sharp rectangular color regions

Mondrian style encouraged

No text, purely visual

Editor must preserve raw colors

State Management

Stack-based operations

DP/CC determine state flow

Color transitions update execution state

White/black influence navigation

No external persistent state

Data Management

Stack holds integers

Output via commands mapped to ASCII

Image acts as read-only code

Memory limited only by interpreter

Data encoded through color patterns

Architecture

Execution moves through adjacent codels

Hue changes encode stack operations

Brightness changes encode instruction types

DP and CC handle navigation

Execution halts when movement is blocked

Rendering Model

Image-based execution

DP moves through contiguous blocks

Hue/brightness deltas generate commands

White allows sliding

Black blocks movement

Architectural Patterns

Stack-based execution

Color-coded commands

Directional navigation

2D grid representation

Image-processing-based logic

Real World Architectures

Algorithmic art installations

Workshops on visual computation

Obfuscated-code contests

CS education for visual learners

Esolang community projects

Design Principles

Artistic expression meets computation

Color-driven logic

Minimal text, maximal visuals

Exploration of unconventional programming

Abstract aesthetic inspired by Mondrian

Scalability Guide

Larger images allow more logic

Small codels -> more detailed programs

Interpreter handles large grids fine

Organize blocks by logical grouping

Avoid unnecessary complexity

Migration Guide

Move images across interpreters safely

Ensure palette consistency

Avoid compression (use PNG/GIF)

Test DP/CC behavior

Fix artifacts before running

Performance Notes

Interpreter performance varies by image complexity

Large codel blocks improve visibility

Execution speed depends on DP traversal

Minimal memory footprint

Debugging slow for complex artworks

Security Notes

Runs locally in interpreters

Very low security risk

Image files cannot execute without interpreter

Untrusted images safe to load

Sandbox-friendly environment

Monitoring Analytics

Use debuggers to track DP path

Visualize stack changes

Check hue/brightness transitions

Animate execution for clarity

Interpret performance via codel traversal

Code Quality

Use consistent codel sizes

Maintain clean color regions

Avoid anti-aliasing

Group instruction blocks logically

Document DP logic externally

Practical Examples

Hello World using color transitions

Visual stack push/pop

ASCII output encoded through color shifts

Loop control with DP manipulation

Prime checker using block arrangements

Troubleshooting

Check color hex codes for exactness

Ensure DP/CC not stuck in loops

Avoid anti-aliasing in editing

Verify codel adjacency rules

Use interpreters with DP visualization

Testing Guide

Start with small programs

Check DP behavior after each block

Test color transitions carefully

Use online debuggers

Compare with known Piet examples

Deployment Options

Share as PNG/GIF images

Run locally with npiet

Publish in GitHub repositories

Use in esolang competitions

Showcase as programming artwork

Tools Ecosystem

npiet

PietCreator

Online Piet interpreters

Visual DP trackers

Piet color palette generators

Integrations

Use in coding-art exhibitions

Education tools for visual computation

Combine with generative art

Embed in esolang multi-language demos

Used in esolang compiler challenges

Productivity Tips

Use gridlines while drawing

Avoid tiny codels for beginners

Use official palette swatches

Debug frequently with DP traces

Start from minimal programs

Challenges

Managing precise color steps

Understanding DP/CC flow

Image editing without distortion

Debugging visual code

Designing large algorithms on a grid

Learning Path

Understand Piet color palette

Learn hue/brightness rules

Practice DP/CC movement

Build small blocks first

Create complete artistic programs

Skill Improvement Plan

Week 1: Learn palettes and rules

Week 2: Create simple arithmetic programs

Week 3: Implement loops and logic

Week 4: Build full ASCII output programs

Week 5: Create artistic/programmatic hybrids

Interview Questions

How does Piet encode instructions?

Explain DP and CC.

What is a codel?

Why are hue transitions important?

How does Piet achieve Turing completeness?

Cheat Sheet

Hue shift -> operation type

Brightness shift -> operation parameter

Black -> wall

White -> slide

DP -> movement direction

Books

The Piet Programming Guide

Artistic Programming in Esolangs

Visual Computation with Piet

Abstract Coding Structures

Esoteric Languages Illustrated

Tutorials

Understanding Piet color commands

Hello World in Piet

Stack manipulation via hues

Loops using DP/CC

Complex artworks that compute

Official Docs

https://www.dangermouse.net/esoteric/piet.html

https://esolangs.org/wiki/Piet

Community Links

Reddit r/esolangs

Esolangs.org Piet page

GitHub Piet art repositories

Online Piet interpreters

Piet Discord communities

Community Support

Esolangs.org Piet page

GitHub Piet repositories

Reddit r/esolangs

Piet online interpreters

Programming puzzles communities

Monetization

Sell artwork-as-code pieces

Workshops on Piet artistic coding

Esolang class teaching

Art installations

Publication of Piet-based puzzles

Future Roadmap

Better editors with no anti-aliasing

AI-assisted Piet image generation

Interpreter with animation timeline

Piet -> Python transpilation projects

More artistic coding exhibitions

When Not To Use

Production software

High-performance computing

Collaborative projects

Large-scale systems

Any task needing readability

Final Summary

Piet is a visual esoteric language where code is an image.

Instructions are encoded through color transitions.

Uses DP/CC for non-linear, artistic execution flow.

Ideal for esolang fans, artists, and creative coders.

Demonstrates computation visually and artistically.

Faq

Is Piet free?

Yes, all interpreters are open-source.

Do I need a special editor?

Any pixel editor works if anti-aliasing is off.

Why isn't my program running?

Probably invalid colors or DP blocked.

Is Piet practical?

Not really - it's artistic and experimental.

How large must a codel be?

Any size, but 10px+ makes debugging easier.

Code Sample Descriptions

1

Hello World in Piet

[Piet programs are images, not text - this would be a bitmap of color regions spelling out 'Hello World!']

A Piet 'Hello World!' program is an image composed of colored blocks. The code below is just a placeholder; actual execution requires an interpreter that processes the image.

Let’s Try →
2

Print 'Hi' in Piet

[Piet programs are images, not text - this image would contain color regions that output 'Hi']

A Piet program to output 'Hi'; represented as an image.

Let’s Try →
3

Simple Counter in Piet

[Piet programs are images, not text - this image would have regions representing the counting logic] 

A Piet program that counts from 1 to 5 and prints numbers.

Let’s Try →
4

Print Digits 0-9 in Piet

[Piet programs are images, not text - color blocks represent sequential digits output] 

A Piet program to print digits 0 through 9.

Let’s Try →
5

Simple Loop in Piet

[Piet programs are images, not text - image would contain loop with directional pointer changes] 

Demonstrates a looping construct using Piet's directional transitions.

Let’s Try →
6

Print Alphabet A-Z in Piet

[Piet programs are images, not text - each letter represented via color transitions] 

Prints uppercase letters A-Z using color-coded instructions.

Let’s Try →
7

Fibonacci Sequence in Piet

[Piet programs are images, not text - blocks represent arithmetic operations to produce Fibonacci numbers] 

Generates a short Fibonacci sequence as output.

Let’s Try →
8

Print 'Bye!' in Piet

[Piet programs are images, not text - image contains color regions encoding 'Bye!']

Outputs 'Bye!' as a demonstration of Piet program flow.

Let’s Try →
9

Simple Arithmetic in Piet

[Piet programs are images, not text - arithmetic simulated via color changes] 

Performs arithmetic operations and prints results.

Let’s Try →
10

Nested Loop Output in Piet

[Piet programs are images, not text - nested loops achieved through color pointer navigation] 

Demonstrates nested loops producing sequential output.

Let’s Try →

Frequently Asked Questions about Piet

What is Piet?

Piet is an esoteric programming language where programs are abstract pictures. Instead of text, Piet code uses colored blocks, and program execution depends on transitions between colors.

What are the primary use cases for Piet?

Graphical esoteric programming. Code-golf and artistic coding. Educational visualization of computation. Algorithmic art creation. Esolang experimentation

What are the strengths of Piet?

Visually appealing programs. Fun for artistic-expression coding. Good for teaching non-linear computation. Active esolang-community support. Unique alternative to text-based coding

What are the limitations of Piet?

Hard to debug without tools. Requires careful color selection. Not practical for production software. Limited IDE and debugging tools. Precision color encoding required

How can I practice Piet typing speed?

CodeSpeedTest offers 10+ real Piet code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.

Learn Other Programming Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypherGremlinPartiqlHaskellElixirFsharpView all languages →
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.