filmov
tv
Writing a Tetris clone -- revisited with C++11

Показать описание
In this tool-assisted education video I demonstrate how to create a Tetris clone in C++, with the GCC toolchain ported for MS-DOS, i.e. DJGPP. You see me type every line. I use C++11 features (previously known as C++0x) such as lambda functions and automatic typing, rather extensively. Also standard C++ features like operator overloading and both function and class templates. I rather wanted to showcase an example of how to utilize them in practical programming challenges.
The AI (computer player) that I created uses Pierre Dellacherie's real time tetris algorithm, which I extended to account for multi-ply lookahead and realtime scanning for possible slides.
Background music:
-- Betrayal at Krondor bgm 31, played through ADLMIDI
-- B-Wing (NES) mixed together with the same song converted into MIDI and played through ADLMIDI (with OPL3 & reverb)
-- Troika (composer unknown, sequencer unknown), played through ADLMIDI.
I created the editor myself.
P.S. I had to re-encode and upload this video a total of 12 times before Youtube finally could decode it properly. Maybe my x264 is broken.
P.P.S. If you're wondering about my stating the loss at that game, wondering whether I should have just played slower, do note that right before my gameover the computer player also beat my score. I had 13636 points (30 lines), COM had 14282 points (29 lines). If I played slower, I would have lasted longer but the computer would have been far ahead in points. Also, I deliberately chose this style of play, aiming for the best balance of performance (I got to even show the "skill" bonus, while the computer got to show a long "combo" by chance), while still not exceeding the 15 minute Youtube length limit. This is a tool-assisted education video after all.
The whole video series:
The AI (computer player) that I created uses Pierre Dellacherie's real time tetris algorithm, which I extended to account for multi-ply lookahead and realtime scanning for possible slides.
Background music:
-- Betrayal at Krondor bgm 31, played through ADLMIDI
-- B-Wing (NES) mixed together with the same song converted into MIDI and played through ADLMIDI (with OPL3 & reverb)
-- Troika (composer unknown, sequencer unknown), played through ADLMIDI.
I created the editor myself.
P.S. I had to re-encode and upload this video a total of 12 times before Youtube finally could decode it properly. Maybe my x264 is broken.
P.P.S. If you're wondering about my stating the loss at that game, wondering whether I should have just played slower, do note that right before my gameover the computer player also beat my score. I had 13636 points (30 lines), COM had 14282 points (29 lines). If I played slower, I would have lasted longer but the computer would have been far ahead in points. Also, I deliberately chose this style of play, aiming for the best balance of performance (I got to even show the "skill" bonus, while the computer got to show a long "combo" by chance), while still not exceeding the 15 minute Youtube length limit. This is a tool-assisted education video after all.
The whole video series:
Комментарии