Here's a playable sample game of Pac-Man implemented as a single HTML file using JavaScript:
This code creates a canvas element and renders a yellow Pac-Man character that can be controlled using the arrow keys. The Pac-Man moves continuously in the chosen direction (right, left, up, or down) and the canvas is cleared and redrawn every 25 milliseconds to create the illusion of animation.