Git Product home page Git Product logo

learnbytetris's Introduction

Whenever I wanted to learn a new language, I seem to struggle with what to build. I thought back to when I first starting writing code and remember my first real ambitious attepmpt was to create a TETRIS clone in BASIC. I realized now that was an excellent way to start. TETRIS has well defined rules, requires minimal graphic capability, and presents enough problems to solve to ensure you capture a great deal of concepts in a language.

So this project will be a collection of the same ported TETRIS clone written in different languages across different platforms. There are a few constraints I will adhere to:

  1. terminal or lowest level of rendering only - I tried with an other language a while back using OpenGL and found I spent more time working out pipeline/rendering issues related to the OpenGL API instead of building the damn game. So, we're going low level rendering
  2. maintain general architecture of the game, unless the platform can't handle it - You get the game working once and you know what works, you stick with it. I'll be sticking with that as close as possible, but there will be exceptions, but there's really no need to write the game completely from scratch without thinking back to previous designs.
  3. minimal features - pieces should move/drop, be constrianed within the container. Score, level and next piece should be visible. Cleared rows should collapse. Game over is shown when you lose. As fun as it may be to add more to this (3D graphics, network play, sound..), keeping the scope small so I can complete and move to the next language is key.

Languages completed:

  • Javascript - written to run in NodeJS in the terminal and in a browser sharing the same code base.
  • C - Very familiar with C, but wanted to use this to learn how to implement more complex ideas in a purely procedural language.
  • C++ - Haven't seriously touched c++ in 20 years; I last used the C++98 standard and was thrown into the future by building with C++23.
  • Go - I finished this the fastest; was originally going to use goroutines for the function generators, but found using closures to be more effective (even if they are a little less performant). I also found a bug in my original design and will update previous ports to reflect this.
  • Rust - Had to make some minimal changes in the design, but probably for the better. Infact, I'd like to apply some ideas I gained in this interation back into the c++ implementation. And as I had hoped, it was much more approachable after working through c++ again.

Future Languages and platforms:

  • Zig - Zig is pretty awesome and has many features that improve upon my C implementation without going full blown C++.
  • Arduino - Years ago I created a PONG clone that runs on an Arduino Uno that actually generated a VGA video signal plus sound. I'd like to take what I learned from my C TETRIS implementation and improve upon my PONG code. I'd like to still output a VGA signal, but will likely create forks trying to implement SPI and/or i2c and connect to different outputs.
  • FORTRAN - Only because a friend dared me to.
  • Java - I haven't touched Java in a while and though it's similar enough to other languages I use, it's changes much since I last used it.

I plan on going back to fix random issues / missing features in the future (like, drop interval should increase as levels go up)

learnbytetris's People

Contributors

ni3po42 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.