Thanks Larry! I will look into the anode.
Just to wrap this up, in case it helps someone else, the problem was in fact the gas valve. I enjoyed my first hot shower in four days last night.
The part cost me $140. It was easy to install, (other than having to jury-rig my pipe wrench, which was a little too small to fit the square body of the valve).
Not having much plumbing experience, I learned some tough lessons this week. Notably, that closing the valve on the inlet pipe was not sufficient to prevent a minor flood. I took the old gas valve off the previous night, leaving the hole open into the tank, so I could take it over to the supply store for comparison. Then we got up in the morning, using faucets, etc., which I didn’t realize would place water in the pipes connecting to the heater outlet. The water, of course, ran freely down and refilled the heater tank, up to the point where it happily ran out through the valve hole.
Luckily, in an act born of mostly paranoia, I had stuffed a towel in that hole after removal. This caught some of the water and slowed the leak, but some gallons still escaped, hit the concrete, and worked their way under the carpet in the finished part of the basement. I am dumping salt in great quantities to try to pull the water up through the carpet.
So mostly a happy ending, with some cleanup still to do.