Home For Fiction – Blog

for thinking people


Programming

Book Title Generator: A JavaScript Program with a Creative Lesson

August 15, 2022

One morning, I was staring at the screen a bit bored, trying to find something productive to do. Browsing through the blog, I saw an old post on how to select a title for your novel. I immediately had a flash of inspiration: What I should make is a book title generator!

The truth is, I wasn’t super serious about it, it was mostly meant as something productive to pass the time with. I mean, as I explain in the post linked above, picking a title for your novel cannot be a random process. More still, it cannot be a spur-of-the-moment thing, either. Conversely, it has to be a result of deliberation. It involves patience.

So, how does a book title generator fit in all that?

Honestly, I didn’t trouble myself with it. I just began coding – as I said, for the fun of it. But I was thoroughly surprised with the result, as it revealed to me several important things about creativity, including in terms of coming up with book titles. The book title generator… generated ideas.

In this post I’ll offer you all the details of my thought process behind making this JavaScript book title generator. I’ll also offer you the code and the program to try for free. However, above all, I’ll talk about the important lessons on creativity this silly little program had to offer.

book title generator
Here’s how this silly book title generator looks like. The results can occasionally be incoherent, but I cherry-picked a good example.
(more…)

Structuring Language for Automatic Text

July 18, 2022

If you’ve used Planet Generator, you must’ve noticed how it offers, among other things, what I refer to as “civilizational data”. These also include trivia for the imaginary cultures of the program, in the style of “Arranging a visit to Orphne? Avoid Flöchixäwu — and its rather ferocious beasts”. Such phrases are examples of automatic text.

To be clear, these examples are not entirely automatic – in the sense, they’re not made out of thin air, perhaps using AI or at least combining texts from other sources. Rather, they’re based on syntactic patterns I’ve offered the program, together with sets of words to choose from.

But it’s precisely this simplicity that makes this strategy attractive. It’s trivial to use, and the possible combinations it can come up with is staggeringly high.

So, in this post, I’m offering you a look under the hood of Planet Generator, showing you how it generates its automatic text. It’s easy, educating (in terms of teaching us how language operates), and revealing.

automatic text
“Natives of Damon are considered potentially obstinate” – or that’s what the automatic text of Planet Generator tells me…
(more…)

My 48K Challenge: A Programming Lesson on Creativity

June 13, 2022

There are all sorts of asinine challenges in the ocean of mediocrity that is social media, and let me assure you, this isn’t one of them. My “48K challenge” is something I came up with when I noticed something disturbing on my “smart” phone: The size of the calculator app is 8MB. That of the alarm clock is 19MB. And my personal favorite, the messages app (just SMS, that is) is a whooping 204MB.

Are these people serious?

When I was a kid, you could pack an entire video game in 48KB. In other words, the space the calculator app requires is the equivalent of more than 165 video games for the ZX Spectrum – my first computer.

It goes without saying that technology has advanced a lot; the games of the 80s can’t be technically compared to those we have today. And yet, it feels programming has become sloppy.

I’m of course generalizing, but it feels as if the more the resources we have, the less the creativity and the greater our laziness. It all leads to resource hogs that take too much space and are often buggy. Because, hey, let’s all keep updating all the time.

And so, I gave myself what I termed the 48K challenge. I decided to make a retro-style video game in JavaScript, that had to be 48KB or less. The results were intriguing and revealing – and a little bit disappointing, but not in the way you imagine.

48k challenge
Here’s a screenshot from the result of my 48K challenge. The acuity of the image is deliberately low. I coded the program in 256×192 pixels (the native ZX Spectrum resolution) which I then quadrupled, to emulate the loss of acuity when projected on a TV, as we did in the 80s monitor.
(more…)