Assignment 3
- ncampanelli0
- Sep 17, 2019
- 2 min read
I lost the code to my original project and I found out at 12am on the same day this is being posted, long story short I got stuck doing other things and when I finally got the time to fix up my code to make sure everything was exactly as I wanted it, I went to load it and it was gone. I learned a very good lesson, if you don’t make an account on repl.it, despite the fact that the word “saved” is typed out next to a link it gives you to load up your code at a later point in time, it deletes your project, go figure...
The major difference between the two was the original made use of the speaker (to play/stop the opening of Tetris), the second substitutes the use of the speaker in favor of displaying a looping true/false message on the microbit itself. Programmatically speaking the original made use of Object Oriented Programming (class, functions and main) whereas the new one was quickly written with linear logic (disclaimer: term might be incorrect, think a .bat file for an example of linear logic). Both programs basically work in the same manner using a Boolean (variable flag in my case) paired with logic (if statements) to determine what the program should be doing. The original was if flag == 1 then play the opening of the Tetris theme, if flag == 0 then stop (controlled by if while loops). Now the program displays a looping True (1) or False (0) depending on which mode the flag is in. There is also a pause to prevent the machine from rapidly changing flag’s state from 1 to 0 to 1 to 0… constantly if held down (this was the one change I had in mind before even finding out the code was gone). Before doing anything in writing the second code I checked to make sure that you can in fact save your code and access it on repl.it without being logged into an account. The proof is I was able to link the second code.
Comentários