Certified Racket AI Specialist · The Creative Side of AI
Hello, young creator! 👋 So far, we've taught computers to do math, make decisions, and organise data. Now we will teach them something truly magical: how to create new things.
Think about a painter who mixes colours to make a new shade, or a musician who combines notes to make a new song. AI can do this too! We call this Generative AI — AI that creates new content like stories, poems, pictures, and even music.
In this module, we will learn the basics of how AI creates things. We'll use Racket to build our own simple generators — programs that produce new text, new lists, and even new structures. You'll become an AI artist!
After this module, you will be able to:
Imagine you have a magical chef. Instead of following a recipe, this chef can invent new dishes. You give it some ingredients — rice, chicken, spices — and it creates a brand new meal that nobody has ever eaten before!
Generative AI works the same way. You give it examples (like words or pictures), and it learns the patterns. Then it uses those patterns to make something new.
Today, we'll build our own "magical chefs" using Racket. They won't be as smart as the ones in big companies, but they will create things that are new and fun!
Ingredients (data) → AI learns patterns → Creates new things
"cat", "dog", "bird" → "cog", "bat", "dird" (new invented words!)
Definition: Generative AI is a type of AI that creates new content — like text, images, music, or code — instead of just analysing or classifying.
Why important: Generative AI is used to create art, write stories, help with design, and even discover new medicines!
Simple explanation: It's like a robot that can paint a new picture instead of just telling you about an existing one.
Real-life: ChatGPT writes new stories. DALL-E creates new images.
School: Imagine a computer that can write a new essay for you on any topic.
Home: A smart speaker that can make up a new bedtime story.
Nigerian: An AI that creates new African-inspired fashion designs.
Illustration:
+-------------------+ +-------------------+
| Examples (data) | ---> | Generative AI | ---> New creation
+-------------------+ +-------------------+
cats, dogs "cog" (new animal)
jazz, blues new music style
Definition: Randomness is when something happens by chance, without a fixed order.
Why important: AI uses randomness to create variety. Without randomness, everything would be the same.
Simple explanation: It's like rolling a dice. You never know what number you'll get.
Real-life: A lottery draw uses randomness.
School: A teacher randomly picking a student to answer a question.
Home: Picking a random movie to watch.
Nigerian: Using a lucky draw at a carnival.
Illustration:
(define (roll-dice) (random 6)) (roll-dice) → 3 (roll-dice) → 5 (roll-dice) → 2
We can use random and list-ref to pick a random item from a list.
(define fruits '("apple" "banana" "orange" "mango"))
(define (pick-random lst) (list-ref lst (random (length lst))))
(pick-random fruits) → "banana"
This is the simplest generative technique!
We can combine random pieces to make new words.
(define starters '("b" "c" "d" "f" "g"))
(define middles '("a" "e" "i" "o" "u"))
(define endings '("t" "n" "p" "m"))
(define (new-word)
(string-append (pick-random starters) (pick-random middles) (pick-random endings)))
(new-word) → "bim"
(new-word) → "gan"
We just created a word generator!
We can use the same idea to create simple stories.
(define characters '("Ade" "Bola" "Chidi" "Dara"))
(define actions '("ran" "jumped" "sang" "danced"))
(define places '("market" "school" "beach" "village"))
(define (story)
(string-append (pick-random characters) " " (pick-random actions) " to the " (pick-random places)))
(story) → "Bola sang to the beach"
We can use a template to make stories more interesting.
(define templates
'("The ~a loved to ~a in the ~a"
"Every day, ~a would ~a at the ~a"
"~a went to the ~a to ~a"))
(define (better-story)
(format (pick-random templates)
(pick-random characters)
(pick-random actions)
(pick-random places)))
We can generate simple ASCII art using random choices.
(define shapes '(" * " " *** " "*****"))
(define (make-art)
(string-join (list (pick-random shapes) (pick-random shapes) (pick-random shapes)) "\n"))
(make-art)
→ *
***
*****
We can generate lists of random numbers or items.
(define (random-list n)
(if (= n 0)
'()
(cons (random 10) (random-list (- n 1)))))
(random-list 5) → '(3 7 1 8 4)
We can generate structs with random fields.
(struct person (name age))
(define (random-person)
(person (pick-random names) (+ 5 (random 15))))
(random-person) → (person "Ade" 12)
Generative AI works by learning patterns and mixing them. We can mix different categories.
(define animals '("lion" "tiger" "bear"))
(define colors '("red" "blue" "golden"))
(define (new-animal) (string-append (pick-random colors) " " (pick-random animals)))
(new-animal) → "red tiger"
We can generate new recipes by combining ingredients.
(define meats '("chicken" "beef" "fish"))
(define spices '("pepper" "ginger" "garlic"))
(define veggies '("onions" "tomatoes" "peppers"))
(define (recipe)
(string-append "Cook " (pick-random meats) " with " (pick-random spices) " and " (pick-random veggies)))
Let's build a program that generates a full story with a character, setting, and plot.
(define (full-story)
(string-append
"Once upon a time, " (pick-random characters)
" lived in " (pick-random places)
". One day, they " (pick-random actions)
" and found a " (pick-random animals)
". They became friends!"))
(full-story)
→ "Once upon a time, Chidi lived in school. One day, they danced and found a tiger. They became friends!"
You just built a Generative AI system!
How to build a generator:
Encourage creativity. Let students build generators for anything they like. Emphasise that generative AI starts with simple techniques. Use the "mix and match" concept. Show how big AI uses these same ideas on a massive scale.
Ask your child to generate stories for you. Use the generators to create fun family activities — like a new recipe for dinner or a new bedtime story. Celebrate the creativity!
The first generative AI programs in the 1960s could generate simple poetry. Today, they can write entire novels!
random for variety.Generator flow: Lists of pieces → Random pick → Combine → New creation Example: [Ade, Bola, Chidi] + [ran, sang] + [market, school] → "Chidi sang at school"
Tree of combinations:
Start
|
V
Choose character
|
V
Choose action
|
V
Choose place
|
V
Combine all → story!
| Technique | How it works | Example |
|---|---|---|
| Random pick | Pick random item | (pick-random names) |
| Combination | Mix multiple picks | (string-append name action place) |
| Template | Fill in blanks | "The ~a ~a in the ~a" |
You've unlocked the creative side of AI! You learned about generative AI, used randomness, combined pieces to create new things, and built story generators and more. These are the same techniques used by big AI companies, just on a smaller scale. You are now an AI creator!
| Term | Match |
|---|---|
| 1. Generative | A. creates new things |
| 2. Random | B. by chance |
| 3. Template | C. pattern with blanks |
Answers: 1-A, 2-B, 3-C
Scenario: You are building an AI that generates new superhero names. You have lists of adjectives (e.g., "mighty", "shadow") and nouns (e.g., "tiger", "dragon"). How would you build the generator?
Answer: Use random pick from adjectives and nouns, combine with string-append.
Each group builds a generator for a topic of their choice (e.g., new ice cream flavours, new sports names, new holiday destinations). Share and compare outputs.
Build a generator that creates new pet names by combining syllables.
Build a "magic spell" generator. Create lists of words that sound magical and combine them to create new spells with "powers".
Build a generator that creates new Nigerian dish descriptions. Use ingredients, cooking methods, and tasty words.
Build a generator that creates simple poems. Use rhyme patterns and random word selection.
Multiple choice answers: 1-A, 2-A, 3-A, 4-A, 5-A, 6-A, 7-A, 8-A, 9-A, 10-A, 11-A, 12-A, 13-A, 14-A, 15-A.
In Module Seven, we'll explore Machine Learning — how computers can learn from examples instead of being told exactly what to do. We'll build a simple learning system that improves over time. Get ready to teach your computer!
🎉 You've completed Module Six · You are now a Generative AI creator! 🎉