The Magical Forest of Algora
Background
Deep within the enchanted Forest of Algora, two mystical creatures, the Lox and the Faelis, perform a sacred dance every millennium. This dance is not just for celebration but is a ritual to bring balance to the forest.
Objective
Your task is to simulate the dance between Lox and Faelis. Each creature has its own set of dance moves, and the combination of moves creates various magical effects in the forest. Your goal is to determine the state of the forest after the dance is complete.
Specifications
- Dance Moves and Effects:
- Each creature can perform one of three dance moves:
Twirl
, Leap
, or Spin
.
- The combination of moves from both creatures results in a magical effect:
- Twirl + Twirl = Fireflies light up the forest.
- Leap + Spin = Gentle rain starts falling.
- Spin + Leap = A rainbow appears in the sky.
- Other combinations create different effects that you can dream up.
- Dance Dynamics:
- Each effect will change the state of the forest.
- Some effects can be beneficial, while others can be detrimental.
- Dance Sequence:
- The dance consists of 5 sequences.
- You need to display the state of the forest after each sequence.
-
Creature Moves:
Moves for Lox (Creature 1)
Sequence 1 |
Sequence 2 |
Sequence 3 |
Sequence 4 |
Sequence 5 |
Twirl |
Leap |
Spin |
Twirl |
Leap |
Moves for Faelis (Creature 2)
Sequence 1 |
Sequence 2 |
Sequence 3 |
Sequence 4 |
Sequence 5 |
Spin |
Twirl |
Leap |
Leap |
Spin |
- Advanced Features (if time permits):
- Implement a system that allows users to add new dance moves and effects.
- Users can select the dance move for each sequence.
Constraints
- Use GitHub Copilot and write the simulation in any language you’d like.
- Focus on clear and concise code that handles the dance dynamics efficiently. Ask GitHub Copilot/Chat, “How can I make this code more readable and maintainable?”.
- Creating a visual representation for the dance and effects is optional but encouraged if you have time.
- Use a console application to render the output.
- Initialize the state of the forest.
- Each creature selects a dance move for each sequence.
- Determine the effect of the combined dance moves on the forest.
- Update the state of the forest after each sequence.
- Display the final state of the forest after the dance is complete.
Tips to Get Started
- If you’re using a GitHub Codespace, you’re ready to go!
- If running locally, ensure that you have your target language/framework installed.
- Create a folder for your code.
- JavaScript: Create a folder called
algora
and add a file named app.js
.
- Python: Create a folder called
algora
and add a file named app.py
.
- C#: Create a folder called
algora
and run dotnet new console
.
GitHub Copilot Tips
Use Copilot to improve efficiency
See if you can use Copilot to find out the complexity (BigO notation) of the code.
-
Open the GitHub Copilot Chat view in the sidebar if it’s not already open. Make sure your solution file is still open as well.
-
Ask Copilot Chat what the complexity of the code is.
-
Ask Copilot Chat to make the code more efficient.
-
Ask for the complexity again - is it better?
-
Highlight all of the code with Ctrl/Cmd+A.
-
Press Ctrl/Cmd+I to open the inline chat.
-
Type “/doc”
-
Ask Copilot Chat to document the function.
Use Copilot to simplify your code
-
Open GitHub Copilot Chat in the sidebar.
-
Type “/simplify” and press Enter. You can also add any text you want after the “/simplify” to give Copilot more instructions.
-
What did Copilot Chat suggest you do to make it simpler?
Got Errors?
Copilot Chat can help with that too! Just copy the error message and paste it into Chat. Often that’s all Copilot needs to resolve your issue.