How Monist is Monist Enough?
Have been getting to work on SNAKISMS over the last couple of days which has been fun. All the base code for the underlying Snake game is in there (including touch controls and a mobile-friendly aspect ratio) and so it’s time to do the good old object-oriented programming thing of extending the Snake class to create the variations. I’ve started with Monism. For the sake of implementation I’m going with what seems to be called “substance monism”:
Substance monism is the philosophical view that a variety of existing things can be explained in terms of a single reality or substance
To that end, I’m interpreting this as many that all elements of the game are “made of the same stuff”, and in this case I’m saying that “stuff” is the apple that the snake eats. Thus, this Monist version of Snake treats all visible elements on the screen as being apples. So you can eat the walls, the score, the instructions, your own body and get points for that.
But after implementing that version and being quite pleased with myself (it’s weirdly satisfying to eat the walls that normally kill you), I realised that I hadn’t actually captured the apple’s behaviour with the other elements. Notably, when you ate them they were just gone, but in Snake, or at least the way I’m thinking about it, the apple “comes back”, or at the very least a new apple appears when you eat an apple. So I had to go back through with quite a bit more effort to make it so anything you eat reappears in a random location on the screen (like the apple) to be potentially eaten again.
The most entertaining aspect of this is that if you eat the score, it still “works”, but ends up with its different digits distributed around the screen, ticking over, but kind of unintelligible.
Anyway, this requirement of the second step of making elements reappear is a classic example of how you really do end up having rethink things as you implement them. It was only while thinking about the code itself and playing with the initial Monist version that I realised that the behaviour of the other elements wasn’t the same as the apple. Truth in programming.
One down, nineteen to go.