Does anyone have something to teach Kotlin as firs...
# random
e
Does anyone have something to teach Kotlin as first programming language to child?
o
With my own kids we were developing text adventure game. No UI, no complexity, just println and readln. We started with simple game loop with global variables for gold and hp in a single main function. I introduced randoms, ifs and whens, and then we went all the way to functions for decomposition, classes, etc etc. In the end it was pretty decent text adventure game with a lot of fun (and toilet jokes, kids!) 😄
e
Thanks
o
One nice thing about such approach is that kid can lead the game design (“Daddy, I want to add gold chests to dig!“) and expose their creativity through the program, and adult can help find a way of how to achieve it using what is already learned. It is very important to not rush into “proper way of doing things” too early, hack the things together as simple as possible. And introduce new stuff very gradually, and so that value of new stuff is very clear.
e
Do you have it open source?
o
No, sorry… That’s kids, it’s kinda sensitive 🙂
e
No issues! I will Google text adventure games first and think further. Thank you!
o
You will sure find a lot of complex stuff, like various MUDs 🙂 Keep it simple. The game loop is like this: 1. generate random description of the surroundings, like
"$distance km: You are in the dark forest"
2. present options, initially just “go forward”, in the form of menu, like
1. Go forward 0. Exit game
3.
readln
input and process it 4. execute selected action (for “go forward” it’s just
distance++
) 5. go to #1 That’s it for a start! Then, introduce random and if, two major building blocks for a start. Replace surroundings with “You are in ${place}“, where
place
is something like
Copy code
val place : String
val number = random(3)
if (number == 0) place = "the dark forest" else if (number == 1) place = "the smelly swamp" else place = "the shitty toilet"
Work with your and kid’s imagination to add more and more 🙂
e
Funny, thank you for the idea
a
So good of an idea. I like it
y
This isn't kotlin but I initially learnt programming using CodeCombat. Sadly a lot of its content is now premium, but its approach was to gamify coding by having you control a character that has to do certain things, and it would reward you with a currency for things like having no code warnings or doing extra missions in a level etc.