NAIL v1.5

I changed it to convert each word into an array of integers, just when the program starts. This is the new version of the calcChk2:

def calcChk2(arr)
	s = 0
	arr.each do |v|
		s = $factor * s
		s &= 0x7fff
		s = s + v
		s &= 0x7fff
	end
	s -= 2000 if s < 1024
	s
end

This gets the time down to ~1.4s for 1.6M checksums. Very nice improvement.

EDIT: Further optimization of this code brought the time down to 1.1 s, i.e. 1.45M checksums calculated per second.That’ll do.

3 Likes

NAIL v1.5 is out.

  • If player starts a line with “*”, it is now treated as a comment.
  • Added support for constants MAX_INPUT_CHARS, MAX_INPUT_WORDS, MAX_TIMERS. Constant MAX_FLOATING_OBJECTS was already supported, but undocumented - now it’s documented too.
  • Bugfixes and optimizations.