Moron Test Final Blog Post

The Moron test was a fun process to build. I really liked the tutorials because they were easy to understand and easy to follow. Quarantine really made this semester a drag, something I like the most about classes, especially Mikes, are the classroom environment and the people there. Anyway, on to the blog questions.

Describe the process for clearing and mapping icons to the DOM. What are the three steps and the core functions? Describe how the four methods used for this process work – createElementfirstElementChildremoveChild, and appendChild.

First, create a variable using a query selector that contains all the instances of the icon and the instruction. In the function there is a statement that checks if there is an element within the space. This is done by using .firstElementChild if there is one then we clear using removeChild and pass the first child as a reference. For the mapping function we take in the level as a parameter we then access that scenes icons using the level.

2. Describe how the spread operator is used to convert a node list of selected elements into an array. Describe why we needed this conversion and how the array was helpful for our first test in the game’s logic.

The spread operator uses many arguments and passes them one at a time. This allows us to turn the node list into an array that we can iterate through.

3. Describe how the scene[level].main(icon, indx) function is called within the check(icon, indx) function. How are we tracking the icon and index values? Why do we need to track and pass the icon and index values to the scene’s main function? What does the scene’s main function do with these values?

Within our “check(icon, indx)” function we use “scene[level].main(icon, indx);” in order to access scene-specific instructions. In order to access this we need level, the icon that was clicked, and the index of the icon. This is passed into main in the scenes.js file. Main takes these values and if there are scene-specific instructions they will take place.

4. Describe how the start and finish functions are called in moron.js. How does the program know if there is a start or finish function to run? Where is each start or finish function placed and why?

The start is used if we need to run a function when a scene starts. Main is all of the logic functions. Finish is used once all needed clicks are completed. Start and finish are null unless things need to be done after clicks.

Link to Directory with all the work

Join the Conversation

1 Comment

  1. Great job finishing up and getting in all the moron test tutorials. I’m hoping to finish work on additional scene specific logic and will post to the class email list.

    Also, still hoping to make some online Magic happen over the summer! I’ll reach out to you and other possible players to gauge interest.

Leave a comment

Your email address will not be published. Required fields are marked *