Mindmap
ALGORITHM CHALLENGES
Inhalt der Mindmap
ALGORITHM CHALLENGES
Algorithm Challenge #3
- Aim
- Write an iterative algorithm for a combat system to defeat the dragon (e.g. by attacking it 3 times or answering 3 riddles correctly)
- Variables
- Map Location
- NPC
- Dragon Health
- End Game
- Inventory
- Sword
- Variables
- Write an iterative algorithm for a combat system to defeat the dragon (e.g. by attacking it 3 times or answering 3 riddles correctly)
- Input
- When player inputs 'attack' or 'attack dragon'
- Prompts the while algorithm to defeat/be defeated by the dragon to start
- When player inputs 'north', 'west', 'south', 'east', 'leave' or other known actions
- Allows player to move map locations when possible
- When player inputs 'attack' or 'attack dragon'
- Output
- If input is "attack dragon" or "attack"
- If map Location is 8
- If player has 'sword' in their inventory
- If dragon Health is more than 0
- "The dragon roars at the mighty wound. You feel as if their eyes are set on you. Poised and deadly."
- If dragon health is 0
- "The dragon drops dead to the ground. You won. You saved Lyrica!"
- If dragon Health is more than 0
- If player doesn't have sword in their inventory
- "You are bathed in dragon flames. You have died."
- If player has 'sword' in their inventory
- If map Location is not 8
- "The wind billows, as if laughing at you. What is there to attack?"
- If map Location is 8
- If input was any other known travelling action.
- "You turn to leave."
- If input is "attack dragon" or "attack"
- Processing Variable
- Map Location
- Evaluates whether the player is in the right map location to attack the dragon
- Inventory
- Evaluates whether the player has sword in their inventory
- Dragon Health
- Evaluates whether the dragon has been defeated or still needs to be attacked by player.
- Map Location
- Relevant Constructs
- Condition
- Can only attack the dragon if player has a sword
- Assignment
- Redeclares the dragon's Health (-1) for each of player's attacks
- Sequence
- Uses IF-ELSE-ELSEIF statements to provide the steps and pathways for the code (i.e. dragon's death if player's attack equals 3)
- Iteration
- Uses a while loop in order to attack the dragon until it dies.
- Condition
- Aim
Algorithm Challenge #1
- Aim
- Write an algorithm for a function that selects centre square at random and returns the starting position
- Variables
- Map Location
- Starting Location
- Map Description
- Randomised Integer
- Variables
- Write an algorithm for a function that selects centre square at random and returns the starting position
- Input
- When player input is 'start'
- The code is prompted to start, and the startLocation function runs
- When player input is 'start'
- Processing Variable
- Randomised Integer
- If it equals 5, 6, 9 or 10
- Code continues to output
- If it doesn't equal 5, 6, 9 or 10
- Code repeats until randomised integer equals the wanted values
- If it equals 5, 6, 9 or 10
- Randomised Integer
- Output
- Uses the describe Location function (assumed to be pre-existing) to describe the Map Location
- Relevant Constructs
- Assignment
- Sets player's location to the randomised integer (if it is 5,6, 9 or 10)
- Modularisation
- Uses an assumed pre-existing function called "describe Location' to simplify code when output aims to describe the map location
- Iteration
- The process of integer randomisation repeats until the integer equals 5,6, 9 or 10
- Condition
- Sequence only continues if the randomised integer values were 5,6, 9 or 10
- Assignment
- Aim
Algorithm Challenge #2
- Aim
- Write an algorithm processing player input and returns appropriate output message dependent on user location and player's inventory
- Parts of Challenge
- If backpack does or does not contain bread
- Variables
- health
- inventory
- map location
- bread
- Variables
- If player is or isn't in the location of bakery
- Variables
- map location
- NPC
- inventory
- bread
- Variables
- If backpack does or does not contain bread
- Parts of Challenge
- Write an algorithm processing player input and returns appropriate output message dependent on user location and player's inventory
- Input
- When player inputs 'eat bread'
- This input prompts the function to evaluate whether item (i.e. bread) can be removed or not
- When player inputs 'talk to baker'
- This input prompts the function to talk to the NPC (i.e. baker)
- When player inputs 'eat bread'
- Processing Variables
- Inventory
- Evaluates whether user has the item 'bread' in their inventory
- Map Location
- Evaluates whether user is in the 'bakery' location on the map
- Health
- Evaluates whether user's health bar is full (max. of 5), or otherwise
- Inventory
- Output
- If input was "talk to baker"
- If player is in Bakery Location
- "The baker gives you a loaf of bread."
- If player is not in Bakery Location
- "The baker is not here. You sigh."
- If player is in Bakery Location
- If input was "Eat bread"
- If player has bread in their inventory
- If player's health is less than 5
- "You feel revitalised, like you could fight the whole world."
- If player's health is equal to or more than 5
- "You feel full. You don't think you needed to eat that, but at least it was delicious."
- If player's health is less than 5
- If player does not have bread in their inventory
- "You are not carrying the bread."
- If player has bread in their inventory
- If input was "talk to baker"
- Relevant Constructs
- Condition
- An example of a condition in this algorithm is whether or not user has bread in their inventory in order to eat it.
- Selection
- Has different code pathways dependent on player's variables (i.e. if they are in the right location, etc.)
- Assignment
- Redeclares the value of health (+1) if player consumes bread and has health value less than 5
- Condition
- Aim
Informationen
- Beschreibung
- Year 11 Digital Technologies Mindmap am ALGORITHM CHALLENGES, erstellt von Khaifer Milan am 19/02/2021.
- Erstellt von
- Khaifer Milan
- Aufrufe
- 0
- Bewertung