Release 2: <square name> command and decent graphics


One major bit of user-friendliness that I missed in Fivebyfivia was that it might be tough to move around or remember directions, even though there were 3 possibilities. ESS, SSE and SES, for example. It seemed easy enough to derive from the square you wanted to jump to.

But you know what is even easier? Letting the player just type the square in! Robin Johnson pointed this out, and I felt rather silly, though I feel slightly redeemed by being able to plan a jump to any square. For instance, if you are at c4, a5/e5/a3/e3/b2/d2 will all be squares you can jump to immediately. But I took Robin's suggestion as being able to jump anywhere, with proper checking.

Perhaps I just wanted the additional interesting project of vetting how many jumps were between each pair of squares. Writing that code-checking was fun. It turns out it mostly relies on the horizontal and vertical distance between two squares, except when you're at a corner square and need to go one diagonal.

I suppose I could use an algorithm to figure what squares go where, but that's nasty in Inform, so I just used a table.

table of distances to moves
lesser    greater    general    corner
0    0    0    --
0    1    3    --
0    2    2    --
0    3    3    --
0    4    2    --
1    1    2    4
1    2    1    --
1    3    2    --
1    4    3    --
2    2    4    --
2    3    3    --
2    4    2    --
3    3    2    --
3    4    3    --
4    4    4    --

I think you can see what's going on here. It's a bit brute-force, but it does the job. I didn't want to have to traverse knight-jump trees each time I calculated distance e.g.

now all rooms have dist-from-here of -1;
now location of player has dist-from-here of 0;
let dist-to-consider be 0;
while 1:
    let L be the list of rooms with dist-from-here of dist-to-consider;
    repeat with R running through L:
        repeat with D running through knighty directions:
            let R2 be the room D of R;
            if dist-from-here of D is not -1, next;
            if D is target-room, decide on dist-to-consider + 1; 
            now dist-from-here of D is dist-to-consider + 1;
    increment dist-to-consider;

I suppose it isn't too bad, but having to keep running through the code might give a performance hit. Or maybe I was just sick of coding this sort of thing in Inform when it was easier in Python.

Of course I needed to check that you couldn't disrupt the timed puzzles by typing C2 or whatever and getting there without wasting an official knight-move. But it seems to have made things simple. Also I wanted a piece of code to check if you typed an invalid square of the form (a-z)(0-9).

The major work was done during the comp. I'd hoped to try unusual small accessory programs in Python, and I had a few, but this was the one that took the most time. I had to hold off on this feature, since it was a feature and not a bug fix. I made a special branch. And of course I found no more bugs, so I ultimately didn't need the branch. Though it's in my repo. I added the UUID file (36 bytes of random characters from 0-9a-f) to the main branch.

Finally, I always get a small thrill whenever adding/changing this line:

The release number is 2.

And I hope, whatever programming language you use, the equivalent fun for you to change as well.

I wanted a quick turnaround, because I don't always get it for my projects, and I got it here. Well, at least until I procrastinated the last few bits. So that's a big plus.

After a feature like this, it feels like there's not much to add unless I find a really awful bug. I managed not only to run regression tests (everything passed!) but also managed to make new cover art. It's really cool what vector art there is out there for free.

Get Fivebyfivia Delenda Est

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.