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.
[+] [-] herodotus|5 years ago|reply
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.
[+] [-] herodotus|5 years ago|reply
[+] [-] adder46|5 years ago|reply
``` [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]] ```
Notice how the 1s form a square?
As I'm still learning Rust, any suggestions regarding the architecture, overall design of the game, more idiomatic code, etc., are very welcome.
If you want to play or just see how it turned out, check out:
https://github.com/adder46/tetris.rs
[+] [-] PetitPrince|5 years ago|reply
[+] [-] whateveracct|5 years ago|reply
[+] [-] caterama|5 years ago|reply
[+] [-] taviso|5 years ago|reply
I guess rogue, adom, nethack would be popular answers; probably the entire infocom catalog?
They're not really my cup of tea, the game I've enjoyed the most is probably asciiportal.
[+] [-] tyingq|5 years ago|reply
[+] [-] anthk|5 years ago|reply
Most Infocom games, plus Adventure.
From IF archive (amateur games, but these are anything but amateur).
Curses.
Jigsaw.
Anchorhead.
Spider and Web.
On roguelikes:
Nethack/Slashem.
Dungeon Crawl SS.
Cataclysm DDA.
Game pack: BSD games.
4x strategy/tactics:
VMS-Empire.
Note that VMS-Empire has a Unix port since forever.
Weird strategy/sim:
Liberal Crime Squad.
[+] [-] Y_Y|5 years ago|reply
[+] [-] lucy_gatenby|5 years ago|reply
[+] [-] jonny383|5 years ago|reply
[+] [-] elkos|5 years ago|reply
[+] [-] gabrielsroka|5 years ago|reply
https://youtu.be/O0gAgQQHFcQ
[+] [-] eps|5 years ago|reply
The drop-and-slide of a square around 1:26 leaves behind some filled cells! I wonder if that's a bug or was it a part of the original gameplay.
[+] [-] nevezen|5 years ago|reply
[+] [-] mulcahey|5 years ago|reply
[+] [-] huhtenberg|5 years ago|reply
[+] [-] schwartzworld|5 years ago|reply