matt w wrote:

Eleas, if the thing is that the player can go a certain distance point-to-point on the grid, won't it be enough to check whether the square of the difference in x coordinates plus the square of the difference in the y coordinates is less than or equal to the square of the maximum allowable distance? Then you could do it all in cheap integer arithmetic.

I'm sorry, I didn't see your previous post. And yeah, I considered that (fuel expended when traveling would still force me to compute the distance traveled though). I considered a table-based Newton-Raphson, a log-based

fast square root deal, some sort of octal representation to work it with bit shifts, partitioning the calculation over turns; lots of fun ideas.

Implementing them would probably have been fun as well, but pointless; the bottleneck wasn't there. It's a bad idea to optimize without measurement. Better to keep the routine simple, terse and expressive.

bikibird wrote:

Glad you have a solution that works for you. I haven't thought about those algorithms since I used to dabble with 6502 assembly language a very long time ago. Thanks for triggering the nostalgia

6502 always seemed like good clean fun. I'm doing 68k Asm through-and-through at the moment, and it's surprisingly coherent.

bikibird wrote:

I don't know Inform7 real well, but it seems to me that maybe instead of using a table to store this data, this is a job for a data graph, a.k.a relations. I'm not comfortable enough with Inform to figure out how to write that, but it seems like that relations might be a good fit for linking teleportation pads together?

It's a thought. zarf may correct me here, but IIRC, Inform 7 implements the many-to-many relation via tables under the hood.

bikibird wrote:

Been trying to improve my comp sci skills lately and have been studying a (very) little graph theory. There is a concept where the line (edge, link,relation, whatever you want to call it) has a weight value associated with it so that you can calculate the shortest distance between two nodes. For example consider cities linked by highways. What is the shortest path between two cities? That's different than fewest hops between cities. You have to take into account how long the roads are. Question: Does Inform7 have the ability to weight the relations between things? What would that code look like?

I'd love a link to that, because it sounds intriguing. As for I7 relations, they're strictly binary states. The usual idiom that I've seen for scalar relations is to use indirection: you implement with tables and phrases, add the required number of computed relations, and you'll have something that will act very much like what you want. The table itself will impose limitations on the design, however; you sacrifice the simplicity of just declaring a relation.