Sure, here's a basic implementation of the snake game using JavaScript and enclosed in script tags in a single HTML file. The game will be playable as a finished game on a smartphone, using pictograms to represent the snake and obstacles.
In this implementation, the snake starts at the top-left corner and the player can control its movement using the arrow keys on their smartphone. The goal is to eat the red obstacle represented by a red square, which will increase the snake's size. The game ends if the snake collides with itself or the walls. When the game ends, an alert is displayed, and the game can be reset by calling the `resetGame()` function.