Settling on a microcontroller and a programming language Link to heading
I wish to spare the reader the gritty details of my week03 endeavours, so I will only provide a significantly shortened version of all that I have endured.
At first, as the starry-eyed student that I am, I wanted to take full advantage of the simulation framework of Wokwi. Thus, I first settled on using an ESP32 as my microcontroller and Rust as my programming language. However, I soon encountered various difficulties.
My first difficulty was the fact that the Rust projects uploaded on Wokwi primarily used deprecated versions of the libraries used for embedded development. After navigating a complex maze of dependencies I managed to reach a compatible set of versions, yet this meager acomplishment was overshadowed by the fact that the online Rust compiler would always timeout…
Then I noticed that the answer to my problem was right in front of me!…
I could simply install the Wokwi extension and compile everything locally!… Or at least, so I thought, the actual conclusion is that I had to give up on using Rust as that was too difficult to set up.
Giving up on Rust was a significant setback, yet I still had the ESP32… Just kidding, that didn’t work either on the website so I ended up using the boring combination of Arduino Uno and C.
Tetris Link to heading
Settling on a platform did not mean the end of my struggles, as even the C compiler online is riddled with bugs. Below, we find the error on which I spent the most time on during this week. What is missing from the image above is that the Tetromino class is defined right above this function. I am still unsure what prevents the online C compiler from actually realizing this too. I’ve attempted many possible solutions, but the one that I finally settled on was to simply circumvent this altogether and to make all functions that return a Tetromino methods on my class.
Below we can find an example of the small game that I have created. (https://wokwi.com/projects/409564014236741633)
Caveats and possible future improvements Link to heading
There are many ways in which the game could be improved, yet none will be put into practice due to general lack of time. I wish to at least list them here for the small dopamine boost provided by imagining the feature (not by actually implementing it):
- I could add an LCD screen displaying the score.
- I could speed up the tetromino’s as time passes.
- I could attempt to optimize the interaction with the game screen. (Only change necessary elements, add custom logic for clearing entire lines).
- Add background music. (For this I will need to create a custom coroutine).