Lab 4 - Pseudocoding and Problem-solving

Challenge

In this lab, we are getting familiar with pseudocoding to prepare for actual coding.

Problems

Nkem and I had some issues with understanding what the instructions were telling us to do. We felt that some of the directions used misleading/confusing words (ex. "high-level", "task" being used interchangeably with steps) or it wasn't clear enough what we were being asked to do (ex. author block). We hope we completed it correctly though.

Results

We have a pseudocode for baking a cake, a JavaScript pseudocode for Minesweeper, and a Lab 4 page.

Task 1

We made a pseudocode for baking a cake.

Baking a Cake
  1. Gather baking equipment:
    • Cake mold
    • Parchment paper
    • Mixer
    • Mixing bowls
    • Measuring cups and spoons
  2. Gather your ingredients together:
    • Cooking spray
    • 2 ⅔ cups of all-purpose flour
    • 1 cup of white sugar
    • 1 tablespoon of baking powder
    • 1 tablespoon of vanilla extract
    • Salt
    • 3 eggs
    • ¾ cups of milk
    • ¾ cups of vegetable oil
  3. Preheat oven to 350℉.
  4. Spray the cake mold and line it with parchment paper.
  5. Combine the flour, sugar, baking powder, vanilla extract, and salt in a bowl.
  6. To the same bowl, add the eggs, milk, and vegetable oil. Mix until smooth.
  7. Pour the batter into the cake mold.
  8. Put the mold into the oven.
  9. Bake the cake until a toothpick can be inserted into the center and come out without any residue. (Usually about 1 hour)
  10. Take out the cake and let it cool for 15-30 minutes.
  11. Consume.
(Recipe from https://www.allrecipes.com/recipe/277000/easy-vanilla-cake/)

Task 2 & 3

We made a pseudocode for Minesweeper.


// Summary. Lab 4 - Pseudocoding & Problem-solving

// Description. Minesweeper pseduocode
// @author Ashley Lu
// @since  2021.10.12

// print minesweeper board
    // randomly generate bomb locations with each new map
// accept player input (player will click on a block on the board)
// check if the selected block has a bomb or not
    // if there is a bomb, reset game
// clear out blocks based on input location
// calculate how many bombs are within each block’s 3x3 vicinity and print on designated block
// if the remaining blocks are all bomb spaces, then the player wins and the game is reset
			

Click to view images in a new tab! Image gallery code from w3schools.com.