In this article, the Hamming code is first built with seven coins and without a computer and tested practically. You will learn how test bits can detect errors in a transferred bit sequence and determine the faulty position. The procedure is then programmed in a Jupyter notebook with Python.
(more…).programs
Here you will find everything from code snippets to finished programs and games in Scratch, Python and Swift (Playgrounds).
-

Compressing Data with Smart (Part 2) – Converting Huffman Code in Python
In the first part, the example of KAFFEPAUSE was shown how the Huffman algorithm uses character frequency to create a binary tree and extract space-saving, unique codes from it. The basics are explained in detail in Teil 1 on ffritze.de.
In this second part, the Huffman algorithm is implemented in Python and gradually traced in a Jupyter Notebook. The focus is not only on the finished program. The individual data structures and processing steps are made visible so that the construction of the Huffman tree and the generation of the codes can be tried out directly.
(more…) -

The Travelling Salesman Problem – A challenge for Scratch-Tinker
Imagine that you are planning a trip through several cities and want to find the shortest route to visit each city exactly once. What at first sounds like a simple task is actually one of the most famous puzzles in computer science: the Travelling Salesman Problem.
But don't worry, you don't have to be a math genius to face this legendary challenge. On the contrary! We grab our colorful blocks in Scratch and show how to solve this complex problem in a playful and creative way.
In this article, we take on the Challenge and tinker together on a solution. Are you ready to show the traveler the most efficient way and dive deep into the world of algorithms? Then let's get started
(more…) -

Clones in Scratch – Many objects, one idea
In Scratch, clones are exact copies of a sprite that can behave independently. They make it possible to create many similar objects (e.g. Enemies, stars or particles) without creating your own sprites multiple times. Clones save time, simplify code, and make projects more powerful — ideal for games, animations, and interactive simulations that require the same elements in large numbers.
(more…) -

Gemeinsam kreativ – Kollaboratives Arbeiten mit Scratch
In this project we will draw a house with Scratch together, with different pens designing different elements. One pen will paint the house itself, while another pen will add the door. The stage plays a central role by setting the global variables x and y when clicking with the mouse. This information is then sent to the other sprites to work synchronized and cooperatively. Let's get creative together and create our own digital house!
(more…) -

K-means-clustering – development with Scratch
K-Means Clustering is a popular algorithm in the field of unsupervised learning, which is used to divide data into groups or clusters. This approach makes it possible to identify patterns in data without requiring prior labels. For an introduction to the topic and a fun board game to illustrate the concepts of unsupervised learning, you can find information on this page. There you will find materials that help you better understand the basics of K-Means Clustering and apply them in practice.
(more…) -

Q-Learning – Development with Scratch
In this article we outline the development of the QField with Scratch. We start by drawing the playing field and implementing the random movement of Scratch. In the next step, we introduce the Q table, which serves as the basis for reinforcing learning. Finally, we visualize Scratch's decisions through drawn arrows that represent his path on the playing field.
(more…) -

Reversi as an example of the Minimax algorithm (in Swift Playground)
Reversi, also known as Othello, is a strategic board game for two players played on an 8×8 board. The goal of the game is to have more stones of your color on the board than the opponent.
(more…) -

Abstract data types in school: Python implementations for download
In Lower Saxony, various abstract data types such as stack, queue, dynamic array and binary tree are treated in the school. The interfaces to this are explained in a handout (vgl. PDF-Datei).
(more…) -

Traverse graphs with Swift Playground
What is a graph?
A graph is a mathematical structure consisting of vertices (nodes) and edges that connect these vertices. Graphs can be used to represent relationships between objects, for example in social networks or traffic networks. They are a central concept in graph theory and are used in many areas of computer science and mathematics.
(more…)
