Part 25: Projects
Every other part of the course teaches one idea per lesson. This part does the opposite: each project is a complete small program that puts many ideas to work at once — a calculator that explains its errors, a word counter, a guessing game, a to-do list kept in a file. They are not meant to be read after Part 24. Each one is a checkpoint for an earlier part, and uses nothing the course has not taught by then, so you can stop after that part and build something real.
What you will learn
- How the single ideas of the lessons combine into a program with a design: small functions with one job each, data described by types, and
Mainreading like a summary. - How to treat input as hostile: reading lines, parsing numbers, and telling the end of the input, a read error, a malformed number and an out-of-range one apart.
- How to model every way a program can fail as an error type, and when to stop, pass a failure on, or skip it and carry on.
- How to choose the right standard package for a job — collections, algorithms, time, randomness, entropy, files and JSON.
- How to run interactive programs, and which projects need a keyboard, a sound card or Windows.
Which part unlocks which project
The arrows point from the part you need to have finished to the projects you can build after it:
flowchart LR
p3["Part 3<br/>Control flow"] --> thanks["Thanks"]
p3 --> fizz["FizzBuzz"]
p4["Part 4<br/>Functions"] --> temp["Temperature"]
p5["Part 5<br/>Sequences"] --> prime["Prime"]
p9["Part 9<br/>Errors"] --> calc["Calculator"]
p16["Part 16<br/>Numbers"] --> circle["Circle"]
p16 --> quad["Quadratic"]
p17["Part 17<br/>Collections"] --> words["Word count"]
p17 --> inv["Inventory"]
p18["Part 18<br/>Algorithms"] --> stats["Statistics"]
p20["Part 20<br/>Utilities"] --> guess["Guess"]
p20 --> age["Age"]
p20 --> pass["Password"]
p20 --> launch["Launch"]
p21["Part 21<br/>Data formats"] --> notes["Notes"]
p24["Part 24<br/>Platform"] --> melody["Melody"]| After part | Project | What it practises |
|---|---|---|
| 3 Control flow | Thanks, FizzBuzz | Loops, match expressions, the order of an else if chain |
| 4 Functions | Temperature | Small functions, recursion, default arguments |
| 5 Sequences | Prime | An array of flags and the sieve of Eratosthenes |
| 9 Errors | Calculator | An error variant, fail, ?, match and catch in one program |
| 16 Numbers | Circle, Quadratic | Reading and checking numbers, infinity, NaN and floating-point accuracy |
| 17 Collections | Word count, Inventory | Hash and tree maps, a vector of structs, two kinds of failure |
| 18 Algorithms | Statistics | Sorting, folding and extremes, and the empty case |
| 20 Utilities | Guess, Age, Password, Launch | Randomness, entropy, calendar arithmetic, pauses and a game loop |
| 21 Data formats | Notes | JSON saved to a file atomically, and loaded back |
| 24 Platform | Melody | Calling a Windows function directly, chosen while compiling |
Circle and Quadratic are really about Part 14: Text — reading and parsing a line — but they also borrow IsFinite and the Math package from Part 16, so they unlock there.
Lessons
| Lesson | What you will learn | |
|---|---|---|
| 25.1 | Thanks | draw RUX as an ASCII banner and thank everyone who helps build it |
| 25.2 | FizzBuzz | the classic counting game |
| 25.3 | Temperature | a table of Celsius and Fahrenheit temperatures |
| 25.4 | Prime | every prime below 100, found with the sieve of Eratosthenes |
| 25.5 | Calculator | evaluate expressions and report every way they can go wrong |
| 25.6 | Circle | read a radius, check it, and print the circle's measurements |
| 25.7 | Quadratic | solve a quadratic equation, including linear and degenerate cases |
| 25.8 | Word count | count how often each word appears |
| 25.9 | Inventory | keep a stock list of items, with updates that can fail |
| 25.10 | Statistics | count, extremes, mean, variance and median, including empty and single-value input |
| 25.11 | Guess | a number guessing game with seven valid guesses from 1 to 100 |
| 25.12 | Age | an age in completed years, months and days, with month-end clamping |
| 25.13 | Password | a 16-character password drawn from system entropy with rejection sampling |
| 25.14 | Launch | a mission checklist, a bounded countdown and a launch |
| 25.15 | Notes | keep notes in a JSON file |
| 25.16 | Melody | play a tune through the Windows console speaker (Windows only) |
Before you start
Pick the project for the part you have just finished, rather than reading this part in order. Each project page lists exactly which lessons it leans on, links them where they are used, and ends with exercises that extend the program — those are the real work.
Each project is a package in the Examples repository's Projects/ folder:
cd Examples/Projects/FizzBuzz
rux run
Most projects print the same output on every run. A few are different:
| Project | What to expect |
|---|---|
| Circle, Quadratic, Guess, Launch | They wait for you to type. Answer the prompt and press Enter, or pipe the input in |
| Guess, Password | A different number or password on every run |
| Notes | Writes a file in the package's Bin/ folder, and deletes it again |
| Melody | Windows only, and plays sound through the console speaker |
After this part
This is the end of the course. From here, the best next step is a program of your own — take the project closest to what you want to build and change it until it is yours. The Rux Reference has the full rules behind every lesson, the API reference covers the standard packages, and the cheat sheet keeps the syntax on one page. When you want to share what you made, Part 22: Packages shows how to turn it into a package others can depend on.