Ilya Kurdyukov's version (New: 22 July 2021)
Here
you can find Ilya's snake implementation and here are my comments on
them. Note that I haven't actually tested it (since he originally
made it); I'm merely writing about his features and changes.
- Renaming variables: I simply chose what fit well
and didn't consume too many bytes against the contest entry though I
felt CANNIBAL particularly relevant for snakes even though
technically the snake doesn't eat itself.
- Invocation differences: Whereas in his game
you have to run it like: ./prog WAIT=100
in mine you
have to do: WAIT=100 ./prog
.
- Disallowing turning in the opposite direction:
I can kind of see the appeal to this but my entry was also inspired
by the old video game Surround which could do this. Also for
cannibalism it added for some interesting game effects. I show some
of these in the file crazy.log. But other than that I actually
prefer it being able to go backwards even if it's unrealistic (going
through walls is also unrealistic but this was also a feature of
Surround and it's why I implemented it).
- My game you can pause: I don't know if his
allows this but it was very useful for me. I also have the snake
head be <, > ^ and v so you can see which direction you are
going and this is especially useful when you've paused the game.
- Different characters: Using unicode would be
ideal for the size of vertical versus horizontal but the way I did
it was simpler and less code (well, maybe). I quite like how it turned out though
but I can see the appeal of his way too. I personally prefer the
snake head as I have it however. Personally I'm also not big on
emojis; although I use them at times they often annoy me.
- Number of 'bugs' on the screen: I actually
thought of this and I think I even mentioned it in the HACKING (a
file I gave many other ideas to improve the game) file but due to
size restrictions in the contest I did not implement it.
- His has a snake safety feature: He describes
it like: if you encounter an obstacle this option gives you a
delay to change direction before losing. I personally
don't think I'd ever use that but it's an interesting idea. I did
however think (and I'm almost certain it's in the HACKING file) of
having a save option so you can resume the game after it ends (so
you can start where you left off). This however would
have complicated things much more so the closest there is is that
you can specify the starting size.
- His expiry option differs from my evasion
option: Mine is a constant value: if you specify 500
movements then it's every 500 movements full stop; his is randomly
selected in the range of EXPIRY/2 to EXPIRY.
- ANSI sequences versus curses: My game uses
libcurses and I like it that way; this has the added bonus of
allowing the drawing mode since the function to get input can be set
to block or not. There are probably other bonuses. It's also of
course more portable. He has code that allows you to use curses
though.
- The segments spawn as in classic games: I don't
know what this might be; it's too long since I played the
original.
- The random colour for winning message: I think
that would probably annoy me but that's a personal thing. Different
games have different winning scenes and some games never end.
Depending on if you run into the wall (and they're not passable) or
yourself (and cannibalism isn't enabled) or you won a different
message is shown as well as the status/score bar. That bar is
updated every movement as the snake's head coordinates are also
printed. You can change that but that's the default and changing
requires changing the code. This format string is used more than
once.
That's all I can think of at this time without actually playing
it but I do thank him for his comments (which I hope to put here
eventually) and also for testing etc..