CMC logo Cave Man Code

The Blocks tab is a workshop where you build a program by dragging shapes. Every shape writes a line of CMC for you on the right. It is the easiest way for the very youngest coders to feel the power of code, and it stays useful for planning bigger programs.

The palette (left side)

Blocks are grouped by job:

GroupBlocks
Talkingsay (oga), ask (blorp)
Boxesmake box (grunk), change box (=), change a spot
Choicesbinga (if) with a wonga area
Loopsbooga (repeat), zug (while), zoop each
Clumpsclump, give back (ork), call clump
Valuesnumber, text, box value, random
Pilesmake pile, plop into pile, yoink from pile
Drawingskrib circle, dot, line, box, blob, write, color, size, wipe

Two ways to add a block

  1. Click a palette block: it lands at the end of your stack.
  2. Drag a palette block: a ghost follows your mouse and a white line

shows exactly where it will land.

The slots

Blocks have little dark boxes called slots. Slots hold expressions (numbers, text, box names, math). You can fill a slot two ways:

sense, the slot tells you.

from the Values group turn into the right expression.

Value blocks never sit on their own -- they must live inside a slot. That is on purpose: it is the difference between saying a number and storing one.

Nesting

Drop a block inside another block's shaded area to put it in that block:

booga 3
    oga "bang"
    binga lap == 3
        oga "last one!"
    unga
unga

The white insertion line shows where it will go. You can drag blocks back out into the main stack the same way.

The wonga area

Every binga block has a wonga line. Drop blocks under it to say what happens otherwise. Leave it empty for a plain if.

Right-click menu

Menu itemWhat it does
Deleteremove the block (and everything inside it)
Copymake a duplicate right after it
Move up / Move downnudge it in its list

Dragging a block onto the palette (the left column) deletes it, like throwing it away.

Undo

Every change is remembered. Click Undo or press Ctrl+Z. You can undo dozens of steps, including deletions.

Running blocks

Press RUN while the Blocks tab is showing. First CMC checks every slot (a red warning in the status bar tells you which one), then it turns your blocks into CMC text and runs it. Errors still come with line numbers -- they point at the generated code.

Moving between blocks and text

reading and changing the text version.

Almost every example in the examples/ folder can become blocks. If a line uses something that has no block yet, CMC says so politely and leaves your blocks alone.

A first block program

Build this by hand:

  1. Drag booga in. Click its count slot, type 3.
  2. Drag oga inside the booga body. Type "bang!".
  3. Press RUN.

The code panel shows:

booga 3
    oga "bang!"
unga
bang!
bang!
bang!

Next: Keyboard shortcuts.