Volume 2: Learn Python Basics with CodeCraft 3D Game

The CodeCraft world's 3D visualization is intuitive and fun. It uses the 3D structures to help students understand programming concepts, which could be abstract and boring to learn through traditional ways.

Contents

6 - Basic Data Types and Values
7 - String
8 - List
9 - Dictionary
10 - User Input
11 - Conditionals
12 - While Loop
13 - Module

After we have defined the functions block_m(x, y, z, m) and column_m(x, z, h, m), we can use them to build more structures in the 3D game world. Let's check out some examples.

Some examples from Volume 2

Lists
Iterate over a list: the white columns represent all of the values in a certain list.

List methods
Reverse a list: the purple columns mirror the white ones.

Sort a list: the pink columns are sorted in ascending order.

Built-in functions for lists
Find the maximum and minimum values of a number list, highlighted with red and green blocks.

Dictionary
Add a new key/value pair to materials dictionary to define air block:

{'box_black': 1, 'box_blue': 2,.... 'tnt': 88, 'air': 0}

Define function dig(x, y, z), which digs a few holes on a wall.

Module

for loop and randint() work together to generate blocks of random materials at random locations, or columns with random colors and random heights.

results matching ""

    No results matching ""