How can I determine the version of an Angband savefile?

Solution 1:

Not for version 3.1.1 or newer. From the source code (savefile.c), typos left intact:

* The savefile deosn't contain the version number of that game that saved it;
* versioning is left at the individual block level.  The current code
* keeps a list of savefile blocks to save in savers[] below, along with
* their current versions.

You can't deduce the game version from the block versions, either: there hasn't been an incompatible change to the savefile format since this mechanism was adopted, so all blocks are still on version 1.

For versions 2.4.0 (or possibly earlier) to 3.1.0-beta, the first three bytes of the file identified the version number, in the order "major, minor, patch", although the source code for 3.0 hints that the order might have been "minor, major, patch" for the 2.5 series.

Probably the easiest method to identify the version is to open the save file in version 3.0.9: if the savefile is for a version older than 2.9 or for 3.1.0-beta, the game will show an error message mentioning the version, if it's for 3.1.1 or newer, the game won't recognize it as a valid save file, and if it's for 2.9.0 to 3.0.9, you'll be able to play it as-is.