Programs are games, programming is a game
blog.charliemeyer.co
blog.charliemeyer.co
Mastering the art of zooming-in to the enough scope you can handle and make significant verificable progress it’s not a trivial task.
Sometimes makes want to migrate to whatever language that has the best tools for debugging and more stable local dev environments so I can get to enjoy fast loops of feedback and be motivated by feeling like the progress in a game experience like article points out.
Edit: Shameless plug: that’s actually what inspired me to create flowcus.bar to have constant feedback on the screen like in games.
Even better is developing a new project with vue.js and Vite, where changes in the code just show up in the browser. Often even without visible reload. Fells like magic.
I know it'll get faster as hardware marches on, but I often wish I could draw a boundary and say, "Look compiler, this program is months from being done. Let's say everything outside this boundary can be optimized and it won't change. But everything inside the boundary is quick-changing business logic that I'm actively debugging. Don't link or optimize across that boundary. Use wasm to enforce that if you need it."
In C++ I did that with Lua for a while, but the DevEx cost of FFI boundaries is pretty awful even when the performance cost is affordable. I dunno.
What makes you think this? Nothing else has gotten faster as hardware marches on. Almost all software is significantly slower than the equivalent (if it existed, of course) 20 years ago.
I still reflexively refresh the page after making changes after being burned by hot reloading systems one time too many. Hot reloading systems are great when you have only static content, but usually fall apart once front end state is introduced. It would be incredible for the JS ecosystem to get a hot reloading strategy that “just worked”.
Thanks!
After I learned to program I noticed that feeling of "game" sense can be developed for programming as well. When I am debugging something or looking at some code, I just "feel" stuff about the code, like the feeling of being reading through a function that is obviously doing that X thing. You just know without reading it whole. And you know where and how it is used without seeing it before hand. This is really enchanced for code that is written in a style that you are used to.
I believe all skills develop such an extra sense and the satisfaction from using it is really high. I think a lot of people refer to this as intuition but to me particularly it feels like something that is part of the sensations of my body.
Hate to be that guy, but, citation?
This strikes me as the casual reframing through the eyes of an imagined arch-misogynist that has become so commonplace when reflecting on the past (which was a very different time than the present, but which enabled the present [despite the also-popular idea that we've come to our present place in spite of the past]).
Happy to be shown to be incorrect.
It can be useful but it can also be unhelpful. If you are looking for x and it turns out the answer is y you might get knifed in the back, er, or miss the non obvious error in your code.
You have to calculate the probability of them hitting, also account for misses, and explore your reaction to each possibility in this tree, it sounds easy but only comes after 1000 hours or so of play..
In the code example, with that level of exp you would also foresee the possibility of failure and account for that. The more times you get knifed, the less often it happens.
I promise I am being completely serious: This is a point in the mis-judged sci-fi story about being an attack helicopter - https://en.wikipedia.org/wiki/I_Sexually_Identify_as_an_Atta...
> My gender networks have been reassigned to make me a better AH-70 Apache Mystic pilot. ... Look at a diagram of an attack helicopter’s airframe and components. Tell me how much of it you grasp at once. Now look at a person near you, their clothes, their hair, their makeup and expression, the way they meet or avoid your eyes. Tell me which was richer with information about danger and capability. Tell me which was easier to access and interpret. The gender networks are old and well-connected. They work.
There was supposedly a study where scientists saw that when monkeys used tools, their brains treated the tools as extended body parts. If you get good enough at something, your brain wraps around it and it becomes as obvious to you as your own gender and social status.
- Portal 2: simple, physical world logic puzzles with excellent script and graphics.
- Stephen’s Sausage Roll: incredibly hard physical world logic puzzles with awful graphics but it’s part of the style and I love it.
- The Case of the Golden Idol: interactive mystery fiction logic puzzles with even worse graphics that, again, are part of the charm.
- Python 3: text based open world logic puzzles with no graphics whatsoever and some of the most fun I’ve ever had on a computer.
(Edit: for clarity this is a humorous anecdote in that the last “game” on my list is a fully fledged programming language, in line with the original article’s thesis that programming can be viewed as being an excellent computer game. I genuinely had my steam deck for all of a few hours before I was using it write primes.py ;)
it's fun to imagine the shape and color of your datastructures and how the abstract monsters of the voidspace munch on them! and mypy helps you find the right arcane incantations, so you can be pretty sure that what you imagined will actually rip through that messy real world just the way you envisioned it!
well, of course it would be unfair of me if I wouldn't mention that there are serious hazards too, as gradual typing is a gateway drug to many abilities some consider to be unnatural. (you too might wake up drenched in sweat thinking about ... what if we all are just monoids in the category of endofunctors!?)
More or less the spiritual successor, or love letter, to SWAT 4.
Played a significant amount of game myself in early access, and the developers have outdone themselves with mechanics, polish, and AI[2] on the 1.0 release a few days ago.
Particularly in a genre where the trend is to off-load any meaningful cooperation in game to other human players (Tarkov, GTFO, etc).
Your last one sounds particularly interesting, but I'm having trouble finding it because as you can imagine "python 3" isn't a particularly useful search term.
Can you provide a link? I'd really like to learn more.
https://www.python.org/downloads/
Keep in mind that you don't have to play the first two games, you can dive into 3 right away! Even though some nostalgics still swear by the second one...
The tz level was very frustrating and the Arrow DLC really didn't help things. ; )
Edit:
Smh I genuinely thought there was a game named Python 3. I’m familiar with the language. Just sleepy.
If you write an SQL query and it works or a Rust program and it produces the correct answer, you feel competent and empowered.
That's your reward for playing the game.
There isn't an environment where I feel truly competent in.
My programs are small kingdoms where I understand how they work: they are written in Java, C or Python or Javascript.
Every codebase or system has its own mental model which is slightly different to every other, so feeling competence across a large variety of things is pretty hard.
There's a point when computing stuff no longer feels a game but just hard work.
(Anything to do with Kubernetes, OIDC, IAM policies)
But I remember when I was a kid, the computer was always the most fascinating thing to play around with in the house.
Besides the part about defining and achieving goals within some constraint, there is also the exploratory aspect of programming and computer software in general. What's in there? Could be anything. Also, what can you do with a certain subsystem, how does it behave, can you make it do something new.
Programming is like making your own toys.
Building stuff is way worse with a lot of ambiguity, cloudy goal and having to choose one thing among others equally unsatisfying ones.
It has a lot of freedom but almost always I use the ultimate form of freedom and just stop doing in favor of something that's more fun for me.
I know most programmers are not like me, but I'm here for the puzzle and the power of being capable ... and money of course.
I've been fortunate enough in my career to reach a point where I can sell myself as a "freelance firefighter" and now my gigs consist mostly of exploration of dumpster fires or legacy projects reboots - which I find incredibly fun. The simple sounding puzzle tasks such as "can you get this ancient project to compile on a modern compiler" are such a refreshment compared to feature planning, OKR sync and other endless, directionless and unmeasurable work.
I come up with a new feature to add and the challenge of extending my implementation to support it often feels quite similar to solving a challenging new level in a videogame.
I guess a meta point one could make is that I need to make sure I steer the implementation in directions that keep the game fun, so that (this being a side project) I'll continue to play in the future.
Within this definition, in theory, programming is not a game. In practice, it often is.
Gardening is playing if you do it just for fun and not for food to live off. Playing soccer is no game for you, if it's your profession.
I am developing a clojure framework for making 2d games and it is the most fun I've had coding so far!
Check it out: https://github.com/damn/gdl
I am developing an action RPG with it (pausable): https://github.com/damn/Cyber-Dungeon-Quest
I only took a quick look at the API docs and thought it was - sorry
and it looks like play-cljc .. as the name implies, is cross-platform
Programming is a two-team alternating-play game, between Murphy et. al. on one side (the environment) and the program, as coached by Alyssa P. Hacker et. al. on the other side (the programmers), on the other side.
Sometimes the programmers have the initiative, and the environment must provide a value of product type (from which the programmers have already decided a choice [a sum] of elements to keep).
Sometimes the environment has the initiative, so it may choose a play from a sum type, and if the programmers wanted to play a winning strategy, they must have provided a product of responses, so that no matter which summand the environment plays, the program has a suitable response.
When no further moves are possible, the game ends.
At this point, if the program has successfully produced quod erat faciendum, the programmers win. Otherwise (in some cases something else has been produced, in others the game has deadlocked) the environment wins.
To run with the metaphor further, you could call it a kind of instrumental play, which is the type of play where it is actually socially rude to have consistent low performance. https://www.academia.edu/34821396/Instrumental_Play
I agree, modding is fun, but its unfortunately a surefire way to stop me from playing the game. Once you get a look at the code you have to deal with, tactics the game devs pull, etc, just not worth doin anymore.
I find tool dev to be more fun, and more rewarding
One other comment said a game was overcoming deliberately placed restrictions and that definitely what this is. Why can't I just dump packets onto the network at link speeds rather than trying to transmit at a constant rate? Fuck the specs, burst now!
I have half-joked that GUIs are an unsolved problem. Someone called me out and said that so many GUI frameworks exist. I now think I am not joking. GUIs are an unsolved problem.
A program is a set of rules for converting input into output.
A program doesn’t need input or output though right?… it’s just a series of logical instructions that are executed
Except if you count static parameter to not be an input, then you have a static output which is basically a constant. Compiler may in fact try to transform it into a constant and if you don’t do anything with it, well, it’ll probably be marked as unused and not even embedded in your binary.
Is the email an output, or a side-effect?
But you're discussing semantics here while it's obvious side effects mean different things in different contexts so the conversation won't get very productive.
Thats a difference between the theory and practice. In practice you always have to consider physics. There are always inputs and outputs.
You've got an algorithm, a finite sequence of unambiguous instructions that, given some initial conditions, will produce some end state that is interpreted as either correct or incorrect.
You've got a function, which is some mapping of elements from a domain to elements of a codomain such that the mapping is unique for each element of the domain.
Then you've got a "program." This one doesn't come from mathematics, so I guess that means it doesn't get a rigorous, clear, agree-upon definition. So what does the writer himself mean? He wrote an earlier post linked to from this post that provides his definition: https://blog.charliemeyer.co/code-doesnt-happen-to-you/.
My definition is a sequence of instructions provided to a machine allowing the machine to do work partially or fully autonomously once it has been started. If we limit ourselves to the kind of machine the people of 2023 commonly called programmers typically program, we've got electronic boolean state machines that receive fixed-length sequences of bits either as operands to a boolean circuit or instructions telling the state machine which boolean circuit to execute in this cycle. The instructions and operands are either persistently stored as firmware, fetched from NVRAM in the case of a bootloader, or fetched from volatile memory in the case of most other programs. These were in turned put there by some higher-level management program that read them from sources such as durable storage or buffers that may be written to by hardware that receives messages from external sources such as network interfaces, capacitative touch devices, or keyboards.
Not all instructions accept operands and thus not all programs require operands. Trivially, the null program executes a sequence of NOPs.
So does every program need inputs? Well, every program is a state machine. A state machine has an initial state and an end state and these usually get referred to as inputs and outputs when discussing state machines. Even the null program is a state machine. It remains in the same state at each cycle no matter the current state, such that the final state is always the same as the initial state. The null program is also a function. It even has a special name: the identity function. Like all functions, the identity function has an input and an output and these are always the same. Another trivial program is the constant function, which produces the same output no matter the input. Consider a program to factory reset or wipe a device. The initial state of the device is still an input, but the final state at program completion will not depend upon this input.
What every program does not need is inputs provided at startup in the argv and envp arrays or provided interactively at runtime by other programs or human users.
The mixup here seems to be readers limiting themselves to considering input only in the sense of hardware devices that get labeled as IO devices when discussing the basic taxonomy of computer organization and design, but these are one of those "the categories are made for man" things. The execution unit on a processor just receives bits from the buses connecting the processor to a memory module. It doesn't know or care where they came from and whether they were already there or not before a particular program started.
They control a png file, and like move it around a directory structure? Sounds cool!
Anything can be a game, even just dragging around a png from folder to folder.
Input -> input1 -> input2 -> (our solution) -> output2 -> output1 -> output
The hard part is not the (out solution), it's about finding out what's input1, input2, outpu2, outpu1 there before getting the (maybe already made) our solution.
tool: a device or implement, especially one held in the hand, used to carry out a particular function.