As we continued into day two of JavaScript, the days are getting longer and the nights shorter... Today, we mainly spent the day working on a series of projects to gain some more experience. Some of the projects included creating a Mad Libs game, a tic-tac-toe game, a reaction timer game (similar to this one), and a spinning 3D cube. As soon as we got to class, we began working at our own pace, attempting to write the JavaScript code from scratch. However, since we had a crash course on it yesterday, I ended up looking back at a lot of past code for references.
I began with the Mad Libs game, because it was a good way to review creating forms in JavaScript, which we'd learned yesterday. Surprisingly though, it took almost half the morning to complete the project, for while the concept was easy it took a lot of time to implement functions such as a "Play Again" button.
Sample JavaScript code for Mad Libs game. |
Mad Libs input screen |
Example story revealed! Along with a functional "Play Again" button. |
Next, I moved on to the "reaction timer" project. This one was even more complex than the Mad Libs, because it involved animations and getting time from the current time at different intervals (i.e. when the image appeared on the screen and when the user clicked). Once again, the concept seemed easy enough, but the actual execution was more convoluted than imagined. I wanted to add interesting features that would make the game more interactive, such as an error message when the user clicked before the image appeared, as well as a "Clear History" button that would clear the list of past reaction times; these additions made the program harder to code. While I didn't have the time to make the webpage look nice, I managed to make the functions work well doing exactly what I wanted.
JavaScript code from reaction timer. |
Reaction timer put to the test! |
Finally, after getting back to the dorms, I started on the tic-tac-toe program. This one was one of the hardest ones and the code got complicated very fast; in the end, I managed to work out the two-player gameplay process of putting down pieces, but I still need to code the program to determine after each step whether or not a player has won. Today was very frustrating at times, especially during many attempts to debug my programs, but it was a real experience on how "addictive" coding can get when you just don't want to stop until you've solved a problem or finished a project. By the end of the day, I felt good in what I managed to accomplish and vowed to continue working at what I've still yet to finish. Tomorrow we begin Python, which I've actually self-learned quite a bit of, so I'm looking forward to putting those skills to the test and progressing even further.
No comments:
Post a Comment