9 ms·
I can definitely see the point the author is trying to make, and I agree that it naturally lends itself to a functional model of how the game works. On the oth
by munchbunny 6y ago
I can definitely see the point the author is trying to make, and I agree that it naturally lends itself to a functional model of how the game works.
On the other hand, and this is speaking as someone who has played the game for an embarrassing number of hours all the way into endgame "megabase" territory: my mental abstraction of the game isn't really functional. It's directed graphs. Sure, the two views can be equivalent representations, but I find thinking about the game as a directed graph (and reasoning about throughputs in a graph representing a network) to be the perspective that gives actionable insights most readily.
- willis936 6y agoBecause factorio is much closer to a gui-based HDL layout tool than a programming language. It might be fun to program a simulated annealer to play factorio.
- buildbot 6y agoThat sounds like an awesome project for a graduate EE design class!
- mhh__ 6y agoOne of the HDL-to-Minecraft(Redstone) projects was done by undergraduates - from scratch even! These kinds of projects are one of the only things I get FOMO over studying physics - I really like the idea of getting a few months to (say) write a compiler as a group rather than piles of utterly inane lab work teaching me how to use equipment I already know how to use
- dexwiz 6y agoThe author is one of the main sources of Category Theory for Programmers material. Take that as you will.
- munchbunny 6y ago> The author is one of the main sources of Category Theory for Programmers material. Take that as you will. I'm having some trouble coming up with plausible inferences from that fact. Do you mean to imply that "when you have a hammer everything looks like a nail"?
- ksm1717 6y agoMaybe more like: “the best hammers can treat anything as a nail”
- steerablesafe 6y agoIncluding thumbs.
- AnHonestComment 6y agoThe realization at the end of your post is what the author is trying to get people to reach about software. The category theory for programmers crowd argue that categorical diagrams (annotated graphs) are the right way to reason about software to gain insights — and the rest is describing the equivalence between functions in a type theory and maps in a category. Your mental model of directed graphs is a functional model.
- munchbunny 6y agoYour mental model of directed graphs is a functional model. In the more general sense that may be true, but I was talking about Factorio specifically, where I'm using the graph representation to do the analysis. Or rather, just because a functional interpretation exists doesn't mean I actually reach for the toolkit filed in my memory in the box labeled "functional stuff". In practice I mostly reach for the boxes I've filed away under "linear algebra", "graph theory", and "circuit design", which aren't things I typically reach for when I'm actually doing functional programming.
- dexwiz 6y ago
- zygomega 6y agoI often think about functional programming as a directed graph consuming information.
- LesZedCB 6y agoi honestly don't know of another way to think about it. it's literally arrows
- dnautics 6y agoif you don't mind going impure, you could translate those functions into actors and (easily) test their resiliency against alien attack using a virtual machine like the BEAM.
- beaconstudios 6y agoit's essentially the same as Reactive Streams (http://reactivex.io/ http://reactivex.io/) - the best known instance being RxJS.
- m_mueller 6y agoIt also seems to me that the author is conveniently ignoring the mechanics that aren’t mapping well to FP. To me, belts and buffer chests are much easier to describe as a mutable data structure (FIFO queues). That’s also analogous to how real world applications typically look like: functional core / imperative shell (see also Gary Bernhard’s brilliant ’Boundaries’ talk). It’s a nice article to introduce FP but I get immediately suspicious about statements like ‘Engineering is FP’. FP is a tool, not a unified theory on how to model the world.
- lmm 6y agoFP is a unified theory on how to model the world: as functions, where equivalent inputs will always produce equivalent outputs. If there's something that makes outputs inequivalent, you should (under this theory) represent that with a corresponding input. It's not the only possible way to model the world, but it absolutely is a unified approach that you can apply to a whole system, and it tends to work better when you do - trying to apply "FP as a tool" within a fundamentally mutation-oriented system (for example) gets you a very limited subset of the benefits, IME.
- m_mueller 6y agoReal world is dirty. It needs logging, I/O, etc. Yes you can model those with monads in Haskell, but what happens much more frequently is that you’re in a team of Java/Python/Js/C++ programmers and you want to profit from some of the benefits of FP at least (testability, composeability). And that is where the perfect becomes the enemy of the better if you then just give up because you can’t get your single paradigm FP language. As a modeling tool however it is still very powerful, as are some aspects of OOP.
- lmm 6y agoIn my experience a codebase that crisscrosses back and forth between FP and mutation-based style ends up worse and buggier than one that commits fully to one or the other; it's not perfect being the enemy of better because it's not better.
- herodoturtle 6y ago> speaking as someone who has played the game for an embarrassing number of hours I enjoyed reading that line - made me chuckle :) Would you mind sharing what it is that keeps bringing you back to play? I'm a grey beard programmer, husband, father, and vanilla Linux kinda guy - and I've seen Factorio being mentioned on this forum quite a bit over the years. The chatter here today has once again piqued my interest to say the least. I was once an avid gamer in my youth, but these days I have little free time - so if I were to pick up a game, it would have to be the sort of experience that I can play for a few minutes here and there (and / or immerse myself in for several hours at a time when the opportunity arises). It would also need to run smoothly on Linux, and be relatively easy on computing resources. I tried Minecraft for a bit - and it ticked most of the above boxes - but I didn't much enjoy the interface and lack of "systems" if that makes sense. I love building things, but I also just enjoy sitting back and watching systems work. I prefer top-down planning / building games like the Sim City of old but that got boring pretty quickly. Anyhow I think I oughta just install Factorio and check it out - but I'm deeply curious what it is that keeps bringing you back for more.
- shakow 6y ago> I love building things > I tried Minecraft [...] but I didn't much enjoy the [...] lack of "systems" > I also just enjoy sitting back and watching systems work > I prefer top-down planning Yeah, you should love Factorio!
- munchbunny 6y ago> Anyhow I think I oughta just install Factorio and check it out - but I'm deeply curious what it is that keeps bringing you back for more. There's a demo version which gives you a pretty good idea of how Factorio feels. I forget whether the demo runs on Linux, but the full game is straightforward to run on Linux, by which I mean I forget whether you need an emulation layer. > Would you mind sharing what it is that keeps bringing you back to play? To be fair, I did reach the "I'm done with Factorio" point. I have one last hurrah of getting one last accomplishment in progress, and then I'm realistically done with the game. But to answer your question: it's because Factorio's systems are extremely deep, where the nature of the puzzles and the way you think about them keep evolving. And as you solve those problems you get the satisfaction of seeing those systems working. It's the same high I get from seeing my code work, but in video game form. > it would have to be the sort of experience that I can play for a few minutes here and there (and / or immerse myself in for several hours at a time when the opportunity arises). Factorio isn't the type of game you can play for a few minutes at a time. For me, Factorio relies on the same kind of flow state I use for other focused work. So I play it when I opportunistically have long blocks of time. Most of my hours put into Factorio were from earlier years of my life when I had fewer responsibilities and obligations.