Code Kingdom A game you play with real Python
Learning to code has never been this fun
Wash ashore. Write code. Build a kingdom.
You wash ashore on a wild island with one villager. Write a few lines of Python and watch a kingdom grow: settlers chop trees, mine gold, build towns and hold the castle against raiders. Every unit runs the code you write.
- 243 quests
- 6 islands
- 4 languages
- Real Python
How it works
Three steps, again and again. That's how programmers work, too.
- 1
Write code
Tell a villager what to do in real Python: walk, chop, build, fight.
- 2
Press Run
Your code comes to life on the island. The editor lights up each line as it runs.
- 3
Fix and try again
Didn't work? Read the hint, change a line and run it again. Every quest is a little puzzle.
Real code
Real Python from the very first line
No blocks and no made-up language: what you learn here works everywhere Python does. The editor helps you as you type.
- Autocomplete and hints in your own language
- Every villager, warrior and monk runs its own script
- A commander script runs the whole village: hiring, jobs, messages
- Errors point to the line that caused them
The quests
An adventure across six islands
From your very first step to commanding an army: values, loops, decisions, lists, functions, classes and more. Each quest teaches one new idea.
- Earn up to three stars: win, be quick, keep your code short
- Guess what the code will do before you run it
- Hidden tests check that you really solved it
- A story that grows with your code: one villager washed ashore, then a whole kingdom
Game modes
Then put your code to the test
Raiders land every few minutes, bigger each wave. Will your scripts hold the castle?
- Raids that grow wave by wave, or an endless raid
- Battle a bot player: easy, medium or hard
- A peaceful island just for building
- Save your world and carry on later
The arena
Your village against theirs
Write the scripts for a whole village and send it into the arena. Both villages gather, build and train on their own on the same island: the better code wins.
- Battle anyone on the leaderboard with one click
- Change your code in the middle of a battle and run it again
- Class tournaments, a school leaderboard and a global one
- An easy bot to practise against first
Create
Make your own islands and quests
Paint an island, set up the enemy's base, write the story and the goals, then share it with your class or your friends.
- A map editor with hills, forests, gold and sheep
- A quest builder: goals, coins to collect, starting code
- Islands of quests that open one after another

The gallery
Share what you make
Islands of quests and maps made by players, looked at by a moderator before anyone else sees them. Play them, give them a star, keep a copy to change.
- Share an island or a map straight from My creations
- Every author has a page with their work and badges
- Moderated: nothing shows before a person has checked it

It remembers everything
Sign in on any computer and carry on where you stopped.
Saved online
Your code, quests, maps and saved worlds follow you to any computer.
Achievements
Badges for quests won, raids survived, towns built and bots beaten.
Four languages
English, Polish, Russian and Lithuanian, switched at any time. Python stays Python.
Ready to write your first line?
It only takes a minute to start. Your first quest is waiting.
Start playing