I recently started programming in LÖVE, and I've been building little apps for preschool kids that I wanted to put out there:
Geometric construction using compass and straightedge: https://gist.github.com/akkartik/20a0c7 ... 8bc04b28b4
A little app for learning functional programming using shapes: https://gist.github.com/akkartik/f7ec2d ... 5a6a08f352
A gravity simulator: https://gist.github.com/akkartik/001dcd ... 408f99d742
I've been sharing them as raw lua rather than .love files to encourage kids to look inside them.
They're nothing too sophisticated, the goal is just to get kids used to the idea that they might _change_ overnight in response to ideas or questions or feature requests.
One mildly interesting idea is the way I draw buttons with their event handlers all in one place.
A couple of simple single-file apps
- Kartik Agaram
- Prole
- Posts: 34
- Joined: Fri Apr 01, 2022 4:46 am
Re: A couple of simple single-file apps
Where I come from, preschool typically means 3 & 4 year old kids. But these seem to be for older kids instead.Kartik Agaram wrote: ↑Wed Jun 01, 2022 7:40 pm I recently started programming in LÖVE, and I've been building little apps for preschool kids that I wanted to put out there:
And I did something similar in Wordie, where each created GUI object implements its own callbacks and the state loop just calls each defined .draw (etc) call. It really helped me think better about scope.
Side note, I noticed that most/all of your variables are global rather than local. Is that intentional?
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
- Kartik Agaram
- Prole
- Posts: 34
- Joined: Fri Apr 01, 2022 4:46 am
Re: A couple of simple single-file apps
I did see your post! But hadn't quite delved into the code.
I really am having 4-year olds try these out. Hence just shapes on the stack puzzle, for example. They didn't really understand what the swap button does, so I paused the stack puzzle experiment. But they do seem able to play around with the geometry app and the gravity simulator. We don't get into the theory, but it feels like it can't hurt to get a feel for how objects behave under gravity and so on.
Globals seem fine for small apps like these? They actually seem easier to read..
I really am having 4-year olds try these out. Hence just shapes on the stack puzzle, for example. They didn't really understand what the swap button does, so I paused the stack puzzle experiment. But they do seem able to play around with the geometry app and the gravity simulator. We don't get into the theory, but it feels like it can't hurt to get a feel for how objects behave under gravity and so on.
Globals seem fine for small apps like these? They actually seem easier to read..
Re: A couple of simple single-file apps
Neither did I, and I'm more than 10 times olderKartik Agaram wrote: ↑Fri Jun 03, 2022 10:06 pmThey didn't really understand what the swap button does, so I paused the stack puzzle experiment.
At first I thought that it would only swap a circle and a square if found in the sequence in that order (like a string rewriting system). As the problems progressed, I thought that the square stood for a variable, and the circle was supposed to be literal. At the end, I was completely confused. Only when I looked into the code and saw the operators did I understand that it was "operation by example" and it meant "swap". And even then, it wasn't immediately clear that it operated on the two elements from the left.
Maybe if using boxes with dashed lines for "variables", and arrows pointing to the new disposition, it might be easier to understand.
- Kartik Agaram
- Prole
- Posts: 34
- Joined: Fri Apr 01, 2022 4:46 am
Re: A couple of simple single-file apps
Thanks for that feedback! Most appreciated. Yeah, I need to go back to the drawing board.
Re: A couple of simple single-file apps
Very cool! I agree - it certainly wouldn't hurt to let young kids play around with this. I'm just a little surprised, but in a great way!Kartik Agaram wrote: ↑Fri Jun 03, 2022 10:06 pm I did see your post! But hadn't quite delved into the code.
I really am having 4-year olds try these out. Hence just shapes on the stack puzzle, for example. They didn't really understand what the swap button does, so I paused the stack puzzle experiment. But they do seem able to play around with the geometry app and the gravity simulator. We don't get into the theory, but it feels like it can't hurt to get a feel for how objects behave under gravity and so on.
Globals seem fine for small apps like these? They actually seem easier to read..
And yeah, I think globals are fine for this. It's just non-standard and slightly less performant - I expect - due to the increased lookup time for a global versus a local. But absolutely no one would notice/care without looking into the code.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests