Sure! Here's an example of a simple sword battle game implemented as a single HTML file with JavaScript:
Sword Battle Game
In this game, you control a player character represented by a filled rectangle, and you need to avoid colliding with an enemy character represented by another filled rectangle. In this case, the player can move left and right using the left and right arrow keys. If a collision occurs, an `alert` is shown and the game restarts.
Please note that this is a very basic example of a game, and you can certainly enhance it by adding more features, graphics, and gameplay mechanics.