About - avindra/snake GitHub Wiki

About

In a similar vein to the C++ tic-tac-toe project, this project expresses a game using a high-level programming language (namely TypeScript). So far, structured and functional programming techniques are used throughout.

It is meant for reference by anyone who is using JavaScript, or TypeScript. 2D Canvas is a blank canvas API upon which can you can lay the foundation for your software, using only a high level programming language, and optionally the coding of some geometric relation(s).

TypeScript

The development environment for snake can always be fairly small. In a parallel universe where I didn't encounter TypeScript, the implementation would use the <script type="module"> which is a robust way to load modern JS. All you would need to do is open the index.html page in such a project. I will create one for demonstration purposes later on.

Since things have to be small, TypeScript is certainly the biggest added cost, but it comes with benefits. Namely, these are:

  • ensure use of Canvas API is correct
  • LSP protocols can assist in text editors
  • ensure code safety

TBD

Linting should be added (eslint or tslint or deno lint), but I don't mind deferring until there is a sweet github action that lints for you.