💾 Archived View for jaeyoung.se › posts › 2023-04-29_snake_on_deno.gmi captured on 2023-05-24 at 17:51:03. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
date = 2023-04-29 tags = ["deno", "game"]
######################### # # # # # oo # # oOo # # SNAKE is DEAD. # # # # Press Enter to restart Score: 5 # # # @ # # # # # # # # # # # # # # # # # # # ######################### Press 'q' to quit
I was looking around for what I can do with Deno, and I got off to a tangent of the old text-based UI applications of the MS-DOS era. By nostalgia, I watched YouTube videos about the early PCs and the applications, and installed FreeDOS on QEMU and played with it a bit.
A Deno program cannot present the rich visual and interactivity of Web or native applications. But with the ANSI escape sequences, you can make the next best thing, a text-based UI application.
https://en.wikipedia.org/wiki/ANSI_escape_code
There are lengths of descriptions about ANSI escape codes on the Wikipedia page but the codes needed just to draw characters on the screen are only a few. The following videos were helpful to get me started:
ANSI Sequence video by Sebastien Filion
'I will teach you how to make games in your terminal' by Tom
And here is how to run a rudimentary Snake game on Deno:
% deno run https://jaeyoung.se/toys/snake.js