c0de
c0de ist eine kleine Programmiersprache in Minecraft. Programme entstehen aus bunten Blöcken, die in Reihen gelegt werden, eine Reihe pro Zeile, und Auslöser-Blöcke starten sie. Die Anleitung erklärt die Sprache Schritt für Schritt; die Handbücher beschreiben jeden Block, jeden Gegenstand und jede Funktion.
Anleitung
- Getting Started: c0de is a small programming language inside Minecraft. You write programs by placing blocks, and you run them with trigger blocks. This chapter shows you …
- The Language: This chapter explains the c0de language in short. Every part is a block you place on a sheet. The examples use the text notation from the first chapter.
- Running Programs: A program on a sheet does nothing by itself. Trigger blocks start it, feed it data and collect its results. A running program is called a process.
- Tools and Items: c0de comes with a few tools for writing and testing programs, and with items that carry data. This chapter explains what each one does and how to craft it.
- Libraries: c0de comes with ready-made functions. A few are built in and always there. The others are grouped in libraries, which you load with an INCLUDE line.
- Examples: Here are a few complete programs to build and try. They come from the test suite of the mod, so they are known to work. Build them on an empty sheet, or …
Reference
The handbooks of c0de: one page per block, item and function, each with a description, its recipe and an example. The guide explains how to write and run programs. With the mod Patchouli, every handbook is also a red book in the game (crafted from a book and the item named below).
Data
Book: crafted from a book and type base.
- Types: Type base, TYPE_BOOLEAN, TYPE_INTEGER, TYPE_FLOAT, TYPE_CHAR, TYPE_STRING, TYPE_ARRAY, TYPE_HASH, TYPE_STRUCT, TYPE_TIME, TYPE_ERROR
- Values and names: LABEL, LITERAL, VARIABLE, CONSTANT, TAG
Statements
Book: crafted from a book and structural base.
- Program structure: NOOP, COMMENT, PROGRAM, INCLUDE, EXIT
- Code blocks: BEGIN, END
- Functions: FUNCTION, PARAMETER, RESULT, RETURN, CALL
- Expressions: ASSIGN, OPERATOR
- Conditions: Structural base, IF, ELSE
- Loops: FOR, EACH, WHILE, REPEAT, BREAK
Tools
Book: crafted from a book and wrench.
- Editing tools: Wrench, Text marker, Hammer, Pliers, Boots, Debugging tool, c0de disk, Disk drive
- Items: Data item, Type items, Variable item, Constant item
- Help: Guide book
Triggers
Book: crafted from a book and trigger block.
- Starting programs: Trigger block, Timer block, Debug trigger block
- Running programs: PID block
Devices
Book: crafted from a book and display block.
- Screens: Display block, Laptop, Tablet
- Items: I/O block, Literal item
Functions
Book: crafted from a book and function block.
- Built-in functions: LEN, HAS_KEY, REMOVE, INSERT, CLEAR, SWAP, RAISE
- Input and output: PRINT, WRITE, INPUT, CLS, LOCATE, CSRLIN, POS, COLOR, INKEY
- c0de/math: ABS, SGN, SQR, EXP, LOG, SIN, COS, TAN, ATN, INT, FIX, ROUND, TO_FLOAT, DIV, RANDOM, RANDOMIZE
- c0de/strings: LEFT, RIGHT, MID, REPLACE, INSTR, UCASE, LCASE, SPACE, FILL, ASC, CHR, STR, FORMAT, VAL, HEX, OCT, TO_JSON, TO_YAML, FROM_JSON, FROM_YAML
- c0de/time: NOW, MILLISECOND, SECOND, MINUTE, HOUR, DAY, MONTH, YEAR, WEEKDAY, WEEK, TIMER, SLEEP
- c0de/minecraft: TICKS, BEEP, SOUND, SAY, GET_BLOCK, GET_INVENTORY, GET_LEVER, SET_LEVER, GET_BUTTON, PRESS_BUTTON, GET_PRESSURE_PLATE, GET_OPEN, SET_OPEN, MOVE_ITEMS, DELETE_ITEMS, PLACE_BLOCK, REMOVE_BLOCK, MINE_BLOCK, SPAWN_ITEM, SPAWN_ENTITY, FIND_ENTITIES, TELEPORT