I successfully used Tetris to teach a first course in programming. What I did was provide a module I called "Gridworld". This provided a simple way for the students to create an N * N grid of cells where the cell size was fixed. The only other thing that could be done with Gridworld was to fill or clear the cells. After presenting Gridworld, I then asked the students how we might make an animation of a single square moving down the screen. This was in the very first class!
So instead of talking about semi-colons, syntax, types and so on, we thought about timing, animation, and how to make the animation uniform regardless of the speed of the computer.
After that, the students were given a series of staged assignments, finally ending up with the complete game by the end of the term.
I wanted to share my attempt at implementing the classic tetris game. It works in the terminal and uses the ncurses-rs bindings for the UI part. For me, the coolest part about it is that the tetrominos and their rotations are encoded as 16-bit unsigned integers. For example, to represent a square, we want 51! Why 51? Because 51 decimal is `0b0000000000110011`. We can make 4x4 Vec from that, and we get:
Look up for tetrisconcept.net and theabsolute.plus discord ( https://discord.gg/6Gf2awJ ). Several people have made attempts to recreate sophisticated clones of Tetris, and the absolute plus leader board is written in rust.
Does representing tetrominos that way make hit detection or anything like that easier? My gut says the only thing they add is slightly smaller memory usage, but maybe i'm missing some sort of elegant bit trick.
In no way detracting from your awesome toy project, intrigued people might also want to check out vitetris. Very similar tetris in the terminal with ncruses, but also supports network play! https://github.com/vicgeralds/vitetris
But doesn't emacs come with this built in? It's practically pre-installed on most of the unix machines I've used. I've even played it at the Apple Store.
So instead of talking about semi-colons, syntax, types and so on, we thought about timing, animation, and how to make the animation uniform regardless of the speed of the computer.
After that, the students were given a series of staged assignments, finally ending up with the complete game by the end of the term.