Of course, you can also call out to programs, and sometimes it is just easier to make a call to an awk or Python script to do the heavy lifting. But let’s stick with bash-isms for handling strings.
It’s a game of snake played in a BASH shell. It seems like a coding ... like how the user input is captured and what drives the update function and food generation. The rest of the details ...