First of all, thank you for the very helpful course on Skillshare. I was pleasantly surprised by the recreation of this arcade classic to showcase various Rust topics.
You invited your audience to participate, so here my humble attempt.
Constants instead of in-code literals
You already used the constant values NUM_COLS and NUM_ROWS. To me, using constant values is another way to prevent subtle logical errors. Especially in ranges and when checking boundaries, consequent usage of constants may prevent failures when one of the major values changes.
Terminal teardown
I was unaware of the alternate screen, but I really like what it means for the game experience. However, the setup of the alternate screen has to be undone as well. This is done at the end of the main function. This calls for a dedicated struct, which can showcase the implementation of the Drop trait.
The two faces of the Invaders
The way you gave the invaders two different faces, to mimic the atmosphere of the original game, really brought a smile to my face. Boldly, I wanted to extend this idea, by having each row different faces for the invaders. To me, this combined good with the use of constants and also have a dependent iterator to determine the faces to use.
Nathan,
First of all, thank you for the very helpful course on Skillshare. I was pleasantly surprised by the recreation of this arcade classic to showcase various Rust topics.
You invited your audience to participate, so here my humble attempt.
Constants instead of in-code literals
You already used the constant values NUM_COLS and NUM_ROWS. To me, using constant values is another way to prevent subtle logical errors. Especially in ranges and when checking boundaries, consequent usage of constants may prevent failures when one of the major values changes.
Terminal teardown
I was unaware of the alternate screen, but I really like what it means for the game experience. However, the setup of the alternate screen has to be undone as well. This is done at the end of the main function. This calls for a dedicated struct, which can showcase the implementation of the Drop trait.
The two faces of the Invaders
The way you gave the invaders two different faces, to mimic the atmosphere of the original game, really brought a smile to my face. Boldly, I wanted to extend this idea, by having each row different faces for the invaders. To me, this combined good with the use of constants and also have a dependent iterator to determine the faces to use.
I am curious what you think of it.