Write or Reflect postmortem

So, wow, this is a long one. The data files for WoR are at ~17k and ~19k. This is between their size, ~18.5k. But WoR was about more than “hey, seen the pattern yet?” to me.

I spoke a rough draft into my phone a few days ago, but between my always being a bit horrified at how the words might get mangled (or my own diary notes might not get proofread out) and the one-trick nature of WoR and how this veers from the entry itself, which was rather small, I had a minor case of complete why-bothers. Not as long as the one spanned from (checks my git repository) mid-February to, sadly, late March. I mean, there was nothing serious in the game itself, and reductionists could claim it was just me showing off something neat I learned many years ago.

So, you could say I stayed on-brand and reflected a good while before and after writing this postmortem, ha ha.

I’m disappointed I didn’t pace myself better, and most importantly, I didn’t look at the notes from Walking Into It, my other Python game, beyond saying “Okay, I’ll force people to use Python 3 to get rid of some implementation issues!” And of course I forgot about one thing I wanted to look into–accounting for if people didn’t have the colorama module and/or didn’t want to download it. It’s something that’s so tricky the first few times, and I realized I’d come to take it for granted. So I had some interesting puzzles posed for mid-comp changes! Another thing I should’ve caught was, people would double-click the python file instead of running it from the command line, so the ending was cut off. This happened in Walking Into It, too. (On the bright side, people didn’t miss much, because the ending was way too perfunctory!)

One thing that shows how behind I was? I have a batch file that sends me to various projects. I type GH (project) or NI (project) and it goes to my github or inform (in this case invalid) directory. I use abbreviations. (Yes, soft links are a possibility, but NI also opens Inform header files for a project e.g. NI AI TA opens Ailihphilia Tables.i7x. So it’s easier just to have the batch file!) I didn’t GH WOR to my write-or-reflect repo until a few days before. Which shows how helter-skelter things were. I did a ton in mid-February before shelving things.

But I got a lot of other projects done in the meantime! In fact, this is probably the most detached I’ve been from entering a comp since I’ve been in intfiction. Not that I feel it’s time to up and leave (the last year’s had some great discussions here,) just, I was doing a lot of exploring elsewhere that I’d put off, and maybe having an entry like WoR helped me not feel nailed down.

The first incarnation of WoR was called Wait or Think. I got the idea from a poll from Sobol on ifdb. I figured, haha, what if you had one action, and inaction? (Sobol, if you’re lurking on the boards, thanks!) Now, thinking isn’t much of an action, but between that and the Ascot’s yes/no choices, I had an idea. You wanted to think, but not too hard. But think about what?

Well, I also liked Mike Spivey’s two mathy games, Junior Arithmancer and A Beauty Cold and Austere. They showed a lot more than WoR did, but I remember him asking, what more could go in here? And I had ideas for really impractical side quests, one of them being deriving the Quadratic Formula, and another being the Cubic Formula, but I had no clue how! (Especially the Cubic Formula. Which has a neat story and some great YouTube videos, but for a game? No.) So putting a side quest into action would be big for me. I’d like to think this was a sort of side quest, by surprise! (More notes on the Quadratic Formula applying to this game at the end.)

The action, well, I wasn’t feeling original, and there was already a W, so … write. My repo notes show it was first remember, then ruminate, then … bam! Two syllables, more snappy. Reflect.

The first puzzle in Write or Reflect comes from a life experience many, many years ago. How many? You can track it on the Internet, and it would pinpoint my exact age, which is maybe another reason I didn’t go t hrough with things right away. All this was, of course, was well before I had an idea that terms like puzzle mechanics existed. I was just glad to have cool RPGs that didn’t take too long to load on my Apple IIe! And, I mean, in Ultima V, you could even save inside the dungeons! Usually I’d build my party up so that they were insanely good, and then finally I’d get around to actually solving the puzzles to rescue the kingdom or whatever. I liked to brute-force things.

But it took a while, and I was hoping to make quicker jumps, like the upperclassmen seemed to. And the problem here helped me make a jump in how I thought of things and how I wanted to learn. I’d been told I needed to Learn About Proofs for so long. But it felt like an obligation. But here, seeing the how and the why made me want to learn more of this, to see how to develop that creativity and insight.

There was a math contest called the American Invitational Math exam. You only got invited if you scored 100 or above out of 150 on the previous exam, the American High School math exam, which game 5 for a right answer and 2 for no answer. On the AIME, you had 15 problems to try and complete in three and a half hours, and the answer was an integer from 0 to 999. No penalty for guessing. The later ones were pretty sticky, but the earlier ones, sometimes you could get quickly if you knew what you were doing, or you could grind through them. Apparently MIT asked for your AIME score, so knowing your limits and taking what was there could be a good strategical choice. You could do okay with the first bit if you just studied old contests regularly. The middle ones? Well, you needed some insight, or you’d spend a lot of time calculating one. It would be possible to grind out. So both paths were rewarded, but one more than the other. People who wanted to get, say, 14 or 15 had to see some of these shortcuts, and they needed a lot of experience and creativity.

I didn’t have this. Yet. But I did have the will to kind of run my head into the wall and knock off a few of the later problems, if I really tried hard enough. I forget which number this problem is now, but it was basically this: you flip a coin 10 times. How many of the possible sequences do not have two heads in a row?

With my math team training I had little trouble plowing through the first few cases, up to maybe seven or so. I noticed some shortcuts, for instance, that if you started with two heads, then no sequence would be valid, of course. And so forth. And of course you could just tack on tails at the end of every valid sequence, and you could get another one. This got me pretty far. I did a sort of branching, which got crowded on the paper. It wasn’t too bad–just hope you had all the solutions, then tacking on tails always worked, but tacking on heads didn’t. Long story short, I got the answer without figuring what was going on. And I’m curious–how many people used scratch paper? Or did you just use the parser? Perhaps help should go in the post-comp release!

To me it’s interesting that something I took for granted people would try if they got stuck isn’t so reflexive now, since people use pen and paper less. I figured not everyone would, but now I wonder if anyone did!

Grinding through was time well spent, given my skill level, although after the competition, somebody a year ahead of me pointed out the right way the cool kids do things.

I was completely amazed at their wisdom until I considered the problem for a while, and then I felt dumb for having missed it. (I’m still grateful for all they did for me!) But, to maximize my test score, it was not worth figuring out in the middle of the exam. And I think/hope this parallels the reader’s experience … they felt a sense of accomplishment figuring what was going on, and then they decided to care about the hows and whys later. Or not. I’m perfectly fine with someone saying “Oh, neat!” and moving on. WoR was in the back garden for a reason.

spoiler to the central puzzle

In retrospect, it seems clear what I had to do.
F(x) = F(x-1) + F(x-2), if F(x) is the number of valid sequences. We get the F(x-1) from sticking tails on any valid sequence. But where is F(x-2)?

Well, for that, we can see/guess that’s the number of valid sequences ending in heads. And we’d be right! F(x-2) + tails + heads. And since all sequences can end in anything but tails-tails, this covers things.

I went down a lot of paths before seeing how to work backwards. And no, I didn’t want everybody playing WoR to be curious about this sort of thing right away. I doubt many saw something like this. But I thought perhaps that there were different levels of interest, the lowest hopefully being “gee, that’s neat.” So that was the mathy stuff behind the first puzzle!

And I felt, given the potential number of Spring Thing entries, I wanted to keep things compact, even offer hints if you got to chapter 7 without figuring things, presumably with meta-commands recording your progress. I didn’t want WoR derailing someone who wanted to play a lot.

Programming stuff? Well, back in 2019, I figured the lists would really make Inform 7 grind, and I didn’t have Python confidence yet. I forget why I put it aside or what made me come back to it–probably stumbling on Sobol’s poll again. And then, with more Python chops, I realized classes made it easy.

I also realized the binary choices didn’t make much sense. Or I couldn’t really shoehorn them into it any sort of story. So I copped out and went meta with something I’ve wanted to do, but haven’t: write for NaNoWriMo! It encourages just plain writing, but I also read a few essays on how once you’re confident you can write, you don’t need the high-pressure “just keep writing” gauntlet. This would eventually provide the basis for my second puzzle.

And I think that sort of learning occurs anywhere. With my weekly writing files, I eventually had more confidence that I would get a certain amount written per day without pushing myself, as I learned to focus. I’ve seen it other places, too. It’s sort of like the progression of getting to the athletic club the first two times, then actually seeing what machines work best, then realizing you don’t want to hit too many machines a day.

I’m not big on stories and narratives, of course, but I still want them to be there, so that there’s a chance that it appeals to, and connects with, people who are disposed to that sort of thing, whether it’s reading or writing. And over the years I had a lot to think about, if my writing surges really helped, or if thinking really was useful, and how I needed stretches of thinking and writing. But I also didn’t want to molder!

I’m not sure when the idea for the second book/puzzle came about. I don’t remember who showed me why and how the numbers worked the way they did! But I did think just writing one book seemed a bit too short. And I remember the alternate puzzle. And I really, really liked the idea that the first book was to show you could do it, and in the second, you were focused and could plan a bit more and wanted to avoid being too energetic. It made a story, of sorts, where you learned discipline.

So I had a small engineering challenge to figure how to put things together.

As it turns out, this code (well, I used a config file) worked great. For the programmer, if not the player. A theme in my games!

forbidden_strings of book 1 = ['rr']
forbidden_strings of book 2 = ['rrr', 'www']

strings_to_get of chapter x+1 = [ s + 'w' for s in chapter_x if s doesn't contain a forbidden_string ] + [ s + 'r' for s in chapter_x if s doesn't contain a forbidden_string ]

So I wanted to add a bumper feature, which I should’ve made more prominent. I’ve been burned before thinking, oh, I want to make sure I don’t insult the players intelligence. But then it might also be a way to save brain-drain for people who want to go through a lot of ST entries. I appreciate walkthroughs and provide them, and I think such an option was in that spirit. Plus I know that when I study a tough subject, it’s really cool to have levels of overview to choose between.

With this option, you’re pushed back if you reach a subsequence where all valid sequences are taken care of, e.g. in chapter 3, if you get WRW, then WR is rejected. Or if you get WWR and WWW, WW is rejected. Or with RWW and RWR, R is rejeced. Thus the player can brute-force through! About half of my programming during crunch time was dedicated to this. The other was due to fixing bugs in printing in-game stories. When I went on indefinite hiatus, I had most of this stuff hashed out. I still fluffed actually counting the number of story chunks in the file, so they matched up with the level number!

It seemed people should be able to figure the answers, and I wanted to include a proof, too, but I still wasn’t satisfied. A small victory for me that doesn’t appear in the game proper is how I managed to map, say, all the possible sequences for book one chapter n with the sequences for book 2 chapter n-1 in the walkthrough, if you want to look. I hadn’t thought of this before the comp. I suspect it may only interest a handful of people at most. But it’s there.

One thing that hurt me was a whole lot of navel gazing about, well, this isn’t very literally very, or it doesn’t have great style, or does it really tell the story I want to? I was thinking about this instead of making changes I could easily figure out. So, as so often happens, I just free-associated stories from my notes with little time remaining. Testing that you get a small storylet for every right answer shouldn’t have been hard, and in fact I did have some tests, but I forgot to include a debug switch in my batch files, so the debug-text I grepped for was missed. The thing was–I couldn’t check this with exact counts. The way I did things was to have a list in the config files that said, okay, first time you have 3 w’s in a row, tell this story.

And you may notice there are chunks of stories in the config files. What I did was to have, say, 4 stories of 3 parts each. Then I would put them into an array (1 1 1 2 2 2 3 3 3 4 4 4) and shuffle them randomly.

An online list randomizer gave 2, 4, 3, 1, 1, 3, 3, 4, 1, 2, 4, 2 … this means you’d see the first bit of story 2, then the first of 4, then of 3, then of 1, hen the 2nd bit of 1, etc. I enjoyed writing this code, but I don’t know how many people saw it or felt it added, and it took a disproportionate amount of time to implement and test. I liked how it emphasized how random story threads come to me and it’s a struggle to order them. YMMV. As for the story content? I put in some thoughts related to joining my high school class’s Facebook page and friending old classmates, and also reading some posts in the group to see who had changed, or not. I remembered some worries I’d had and how I’d learned to work around them. I remembered stories I failed to write in high school and college. I realized I could write them better now. So I sort of tried. I used the deadline as an excuse to, uh, keep them general.

So there it is. For such a technical game I’m surprised at the emotion it took me to write it beyond the usual procrastination. But I think it was worth the bother, and people had that “oh, neat” moment if nothing else. I couldn’t really capture the thrill of making technical jumps to do better and learn more and not just be good at math contests in the entry proper. But I hope some of that rubbed off on people who played WoR.

spoiler for The Da Vinci Code

This is all something I found no way to bring up in the game proper, so I had to go for that cheap shot at Dan Brown in the walkthrough. Which – well, it is the final thing that always ticked me off, some self-important yo-yo in The Da Vinci Code solemnly proclaiming “THE FIBONACCI SERIES IS IMPORTANT IN NATURE” and me cringing when I know what the password is going to be before then and feeling absolutely no accomplishment at figuring it out and wondering why it took those idiots so long. So I hoped to do better than that, and for reasons beyond thumbing my nose at a book I really didn’t like.

A side note on figuring things out: I figured out what was going on in The Day of the Jackal, and it was genuinely rewarding! So I like a thriller, if I’m in the mood. Just … DVC was so appallingly ham-handed. After enjoying snark at its expense, I was left wanting to prove to myself I could do better.

A light went on as I looked at this problem again and again. And that’s hard to capture by saying so directly. But I think there’s another angle. The friend who showed me the better solution, a third person and I wound up writing solutions for all fifteen problems. I knew it was good and important and fun and worthwhile. Uncovering a photocopy from storage a few years ago brought back memories. But perhaps it was even better than I realized. And I think a lot of our best moments are like that. The Law of Expectations is in play, here: if you hype something up too much it can fall flat, or you can think “ugh, this is supposed to be great, but is this the best there is?” But thankfully there are a lot of moments that seem unexpected, and you think, hey, that was pretty neat. And after a while, you realize it wasn’t just pretty neat, and it was more than that. You didn’t need any huge excitement to make a big jump forward! And on re-checking, the jump does indeed seem big.

So these thoughts went through my head. And it’s not something where I shout across the rooftops or celebrate an anniversary, but I know I crossed a big bridge in the process. And if something reminds me of it, I pay a bit extra attention.

This all just seems nearly impossible to capture in straightforward fiction or a text adventure! And it seems insignificant in comparison to some issues discussed in other Spring Thing entries or to, say, the revelations someone from high school was much nicer/meaner than you thought they were, or you realize why your gut said (not) to trust someone. But I hope such an a-ha moment reminds you of your own revelations, minor or major, subjective or concrete.

Quadratic Formula stuff, under spoilers again

[spoilers](Also, the Quadratic Formula thing? You know how to solve x^2-1=0, x^2-4=0, x^2-7=0, etc. You also know how to solve x^2-2x+1, x^2-4x+4, x^2-6x+9, etc., or you can see the pattern I’m getting at. If you smush these together, you have the Quadratic Formula. But you can use it for a sort-of formula for the Fibonacci numbers. Let F(x) = the fibonacci sequence and assume F(x) = a^x where a is real. Then a^(x+2)-a^(x+1)-a^x=0, or a^2-a-1=0. So…a is -1+/-sqrt(5)/2, call the roots g and g’. Then f(x)=(g^x-g’^x)/sqrt(5). Odd but true!)