The following is more of an About than Readme. Being written in python (using Flask), TBD soon.
.. would be if it got better over time on its own, but that needs a LOT of examples of games and decision feedback (which I don't have. And even if I did, wouldn't necessarily be able to implement by tomorrow.) It would also require modding the board server to continuously run games, etc, and storing histories of game states somewhere, which I don't know the most efficient way to do. (If someone could help me with that it would be awesome. Thanks!) This is analytically the optimal approach but the total number of states is larger than (humankind's best estimate of) the number of molecules in the universe, and may not be required for getting good enough solution to this problem (I hope).
So instead, I will attempt ..
.. and later try to parametrize things like hunger, etc, to tweak for performance, using genetic algos if possible. This approach is basically looking at the board state and using rules-of-thumb to make decisions. Additionally, the snake can be made more sophisticated by prioritizing different rules under different circumstances (ex - hungry when low on health). Technically it would make sense to use optimal graph search algorithms to traverse the state-space, but I don't have the expertise to optimize the computation so I won't do that. Instead the attempt will be to pre-empt the best behaviour as simply as possible, by trying to have the representation be sparse/coarse informationally (ints vs floats), but higher order conceptually (abstraction++).
.. ... Surviving, as long as possible. Be the snek! .... Wish I had enough expertize to give it an HTM brain .. but first things first.
- Get the state data from the json world. Take only useful info (that you'll use to make decisions).
- Implement constraints (short term) according to game rules. Like, don't walk into walls, or get eaten.
- Categorize contexts ([meta - make more]) and identify current context.
- Make decision based on current state and context.
- Pray for the best.
- Perhaps chuckle (at least nose exhale) at no.5 and think of ways to encode more meaning in less information. Simultaneouly consider how this game is a very good simplified case study for life and intelligence in general. Before moving to the next step, marvel at existence.
- if (i++ > large_num): {next} else: {GOTO 3}
- Parametrize contexts and optimize. (Did you store any data?)