├── .devcontainer
└── devcontainer.json
├── .github
└── copilot-instructions.md
├── .gitignore
├── .vscode
└── mcp.json
├── AGENTS.md
├── Adventures
├── Agent
│ ├── 1-Beginner
│ │ ├── The-Clockwork-Town-of-Tempora-Agent.md
│ │ ├── The-Command-Center-of-Stellaris-Agent.md
│ │ └── The-Magical-Forest-of-Algora-Agent.md
│ ├── 2-Intermediate
│ │ ├── The-Celestial-Alignment-of-Lumoria-Agent.md
│ │ ├── The-Legendary-Duel-of-Stonevale-Agent.md
│ │ └── The-Scrolls-of-Eldoria-Agent.md
│ ├── 3-Advanced
│ │ ├── The-Gridlock-Arena-of-Mythos-Agent.md
│ │ └── The-Knowledge-Cartographer-Agent-MCP.md
│ └── Warmup-Adventure-Agent.md
└── Ask
│ ├── 1-Beginner
│ ├── The-Clockwork-Town-of-Tempora-Ask.md
│ ├── The-Magical-Forest-of-Algora-Ask.md
│ └── it-IT
│ │ ├── The-Clockwork-Town-of-Tempora-Ask.md
│ │ └── The-Magical-Forest-of-Algora-Ask.md
│ ├── 2-Intermediate
│ ├── The-Celestial-Alignment-of-Lumoria-Ask.md
│ ├── The-Legendary-Duel-of-Stonevale-Ask.md
│ ├── The-Scrolls-of-Eldoria-Ask.md
│ └── it-IT
│ │ ├── The-Celestial-Alignment-of-Lumoria-Ask.md
│ │ ├── The-Legendary-Duel-of-Stonevale-Ask.md
│ │ └── The-Scrolls-of-Eldoria-Ask.md
│ ├── 3-Advanced
│ ├── The-Gridlock-Arena-of-Mythos-Ask.md
│ └── it-IT
│ │ └── The-Gridlock-Arena-of-Mythos-Ask.md
│ ├── Warmup-Adventure-Ask.it-IT.md
│ └── Warmup-Adventure-Ask.md
├── CODE_OF_CONDUCT.md
├── Data
└── scrolls.txt
├── Images
├── Coupon
│ ├── dashboard-message.png
│ ├── get-access.png
│ ├── redeem-coupon-form.png
│ ├── redeem.png
│ ├── select-preferences.png
│ └── success.png
├── agent-mode-tips.jpg
├── algora-forest.jpg
├── algora-forest.png
├── choose-own-adventure.jpg
├── choose-own-adventure.png
├── code-button.png
├── copilot-adventures-banner-castle.png
├── copilot-adventures-banner-dragon.png
├── copilot-adventures-banner-robot.png
├── copilot-adventures.jpg
├── copilot-adventures.png
├── copilot-tips.jpg
├── copilot-tips.png
├── copilot-video.png
├── echo-castle-treasure.jpg
├── echo-castle-treasure.png
├── echo-castle.jpg
├── echo-castle.png
├── eldoria.jpg
├── eldoria.png
├── inline-chat.png
├── knowledge-cartographer.jpg
├── learn-more.jpg
├── learn-more.png
├── lumoria.jpg
├── lumoria.png
├── mythos-arena-full.jpg
├── mythos-arena-full.png
├── mythos-arena.png
├── mythos-board-example.png
├── robot-adventures.jpg
├── robot-adventures.png
├── starborn.jpg
├── starborn.png
├── stellaris.jpg
├── stonevale.jpg
├── stonevale.png
├── tempora-clocks.jpg
├── tempora-clocks.png
├── warm-up.jpg
└── warm-up.png
├── LICENSE
├── README.it-IT.md
├── README.md
├── SECURITY.md
├── SUPPORT.md
├── Solutions
├── CSharp
│ ├── .gitignore
│ ├── CopilotAdventures.csproj
│ ├── CopilotAdventures.sln
│ ├── GridlockArenaTests.cs
│ ├── Program.cs
│ ├── README-Gridlock-Arena.md
│ ├── README.md
│ ├── The-Celestial-Alignment-of-Lumoria.cs
│ ├── The-Chamber-of-Echoes.cs
│ ├── The-Clockwork-Town-of-Tempora.cs
│ ├── The-Gridlock-Arena-of-Mythos.cs
│ ├── The-Legendary-Duel-of-Stonevale.cs
│ ├── The-Magical-Forest-of-Algora.cs
│ └── The-Scrolls-Of-Eldoria.cs
├── JavaScript
│ ├── The-Celestial-Alignment-of-Lumoria.js
│ ├── The-Chamber-of-Echoes.js
│ ├── The-Clockwork-Town-of-Tempora.js
│ ├── The-Gridlock-Arena-of-Mythos
│ │ ├── README.md
│ │ ├── The-Gridlock-Arena-of-Mythos.js
│ │ ├── The-Gridlock-Arena-of-Mythos.test.js
│ │ ├── demo-gridlock-arena.js
│ │ └── package.json
│ ├── The-Knowledge-Cartographer-Agent-MCP
│ │ ├── README.md
│ │ ├── The-Knowledge-Cartographer-Agent-MCP.js
│ │ └── akashic-archives
│ │ │ ├── indexes
│ │ │ ├── artificial-intelligence-index.json
│ │ │ └── quantum-computing-index.json
│ │ │ └── topics
│ │ │ ├── artificial-intelligence
│ │ │ ├── entities.json
│ │ │ ├── relationships.json
│ │ │ └── sources.json
│ │ │ └── quantum-computing
│ │ │ ├── entities.json
│ │ │ ├── relationships.json
│ │ │ └── sources.json
│ ├── The-Legendary-Duel-of-Stonevale.js
│ ├── The-Magical-Forest-of-Algora.js
│ └── The-Scrolls-of-Eldoria.js
└── Python
│ ├── README-Gridlock-Arena.md
│ ├── The-Celestial-Alignment-of-Lumoria.py
│ ├── The-Chamber-Of-Echos.py
│ ├── The-Clockwork-Town-of-Tempora.py
│ ├── The-Gridlock-Arena-of-Mythos.py
│ ├── The-Legendary-Duel-of-Stonevale.py
│ ├── The-Magical-Forest-of-Algora.py
│ ├── The-Scrolls-Of-Eldoria.py
│ ├── gridlock_arena_module.py
│ └── test_gridlock_arena.py
└── _config.yml
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "CopilotAdventures",
3 |
4 | "image": "mcr.microsoft.com/devcontainers/dotnet:8.0-noble",
5 |
6 | "features": {
7 | "ghcr.io/devcontainers/features/common-utils:latest": {},
8 | "ghcr.io/devcontainers/features/dotnet:latest": {
9 | "version": "9.0"
10 | },
11 | "ghcr.io/devcontainers/features/docker-in-docker:latest": {},
12 | "ghcr.io/devcontainers/features/node:latest": {},
13 | "ghcr.io/devcontainers/features/python:latest": {}
14 | },
15 |
16 | "overrideFeatureInstallOrder": [
17 | "ghcr.io/devcontainers/features/common-utils"
18 | ],
19 |
20 | // Configure tool-specific properties.
21 | "customizations": {
22 | "vscode": {
23 | "extensions": [
24 | "github.copilot",
25 | "gitHub.copilot-chat",
26 | "gitHub.vscode-pull-request-github",
27 | "ms-dotnettools.csdevkit",
28 | "ms-python.python"
29 | ]
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/.github/copilot-instructions.md:
--------------------------------------------------------------------------------
1 | # GitHub Copilot Instructions for CopilotAdventures
2 |
3 | ## Project Overview
4 |
5 | CopilotAdventures is an educational repository containing adventure-themed coding challenges designed to teach developers GitHub Copilot's different interaction modes (Agent, Ask, and Edit). The core concept is fantasy-themed programming puzzles that demonstrate specific Copilot capabilities.
6 |
7 | ## Architecture & Data Flow
8 |
9 | ### Adventure Organization
10 | - `Adventures/Agent/` - Autonomous AI agent mode challenges (multi-file, project creation)
11 | - `Adventures/Ask/` - Interactive chat mode challenges (step-by-step collaboration)
12 | - Difficulty hierarchy: `1-Beginner/`, `2-Intermediate/`, `3-Advanced/`
13 | - Parallel adventure variants: each has both `-Agent.md` and `-Ask.md` versions
14 |
15 | ### Solutions Architecture
16 | **C# Centralized Runner Pattern:**
17 | - `Solutions/CSharp/Program.cs` - Main entry point with switch-case adventure selector
18 | - Each adventure = separate class with mandatory `Run()` method
19 | - Adventure classes follow PascalCase naming (e.g., `Tempora`, `Algora`)
20 | - Console arguments or user input selects which adventure to execute
21 |
22 | **JavaScript/Python Standalone Pattern:**
23 | - Individual self-contained files per adventure
24 | - Direct execution: `node filename.js` or `python filename.py`
25 | - No shared runner - each file is completely independent
26 |
27 | ### Data Dependencies
28 | - `Data/scrolls.txt` - Shared data for Eldoria adventure (contains secrets in `{*...*}` format)
29 | - `Images/` - 1456x832 landscape artwork for each adventure location
30 | - Adventure-specific assets in themed subdirectories
31 |
32 | ## Development Workflows
33 |
34 | ### Running Solutions
35 | **C# Solutions:**
36 | ```bash
37 | cd Solutions/CSharp
38 | dotnet run [adventure-name] # e.g., dotnet run tempora
39 | ```
40 |
41 | **JavaScript/Python Solutions:**
42 | ```bash
43 | cd Solutions/JavaScript
44 | node The-Clockwork-Town-of-Tempora.js
45 |
46 | cd Solutions/Python
47 | python The-Clockwork-Town-of-Tempora.py
48 | ```
49 |
50 | ### Adding New C# Adventures
51 | 1. Create adventure class with `Run()` method
52 | 2. Add case to `Program.cs` switch statement
53 | 3. Use fantasy-themed class names matching adventure locations
54 |
55 | ### MCP Architecture (Advanced Adventures)
56 | Knowledge Cartographer adventure demonstrates proper MCP integration:
57 | - **MCP tools handle external operations** (web scraping via FireCrawl, file system via File System MCP)
58 | - **Applications read MCP results** from structured files (`entities.json`, `relationships.json`, `sources.json`)
59 | - **Clean separation**: MCP → Files → Application (not direct MCP → Application)
60 | - See `Solutions/JavaScript/README-Knowledge-Cartographer.md` for reference architecture
61 |
62 | ## Adventure Development Patterns
63 |
64 | ### Standard Adventure Structure
65 | 1. **Hero image** (`width: 830px`) - landscape 1456x832 format
66 | 2. **Background story** - fantasy context and world-building
67 | 3. **Objective** - clear task definition with learning outcomes
68 | 4. **Prerequisites** - VS Code setup, Copilot mode selection
69 | 5. **Specifications** - technical requirements with sample data
70 | 6. **High-level Tasks** - solution approach breakdown
71 | 7. **Mode-specific guidance** - Agent vs Ask prompting patterns
72 |
73 | ### Code Organization Requirements
74 | - **Single-file solutions**: Complete adventure in one executable file
75 | - **Console-based**: All I/O through console for simplicity
76 | - **Educational comments**: Show Copilot interaction patterns and prompts used
77 | - **Fantasy variable naming**: Align with adventure themes (clockTimes, grandClockTime, scrollSecrets)
78 | - **Self-contained**: No external dependencies beyond standard libraries
79 |
80 | ### Naming Conventions
81 | - Adventure files: `The-[Name]-of-[Location]-[Mode].md`
82 | - Solution files: `The-[Name]-of-[Location].[ext]`
83 | - C# classes: PascalCase matching adventure names
84 | - Adventure themes use fantasy locations (Tempora, Algora, Lumoria, etc.)
85 |
86 | ## Key Integration Patterns
87 |
88 | ### GitHub Copilot Mode Specialization
89 | - **Agent Mode**: High-level task delegation, autonomous problem-solving, multi-file coordination
90 | - Prompt: "Create a complete [adventure] system that [comprehensive requirements]"
91 | - Agent breaks down, implements, tests, and iterates independently
92 | - **Ask Mode**: Step-by-step collaboration, learning-focused interaction
93 | - Prompt: "Help me understand how to [specific concept] for [adventure context]"
94 | - Interactive guidance with explanation and code examples
95 |
96 | ### Common Algorithm Patterns
97 | - **Time synchronization** (Tempora): Parse time strings, calculate minute differences
98 | - **Sequence prediction** (Chamber of Echoes): Pattern recognition in number arrays
99 | - **Data filtering** (Eldoria): Extract secrets from noise using regex `{*...*}` patterns
100 | - **Grid simulation** (Mythos): 2D array manipulation for game mechanics
101 | - **Rock-paper-scissors logic** (Stonevale): Conditional game rule implementation
102 |
103 | ### Data Processing Examples
104 | ```javascript
105 | // Tempora pattern: time difference calculation
106 | const timeDifference = (clockTime, grandClockTime) => {
107 | const [clockHour, clockMinute] = clockTime.split(":").map(Number);
108 | return (clockHour - grandClockHour) * 60 + (clockMinute - grandClockMinute);
109 | };
110 |
111 | // Eldoria pattern: secret extraction from Data/scrolls.txt
112 | const extractSecrets = (text) => text.match(/{\\*(.+?)\\*}/g)?.map(match =>
113 | match.replace(/{\\*|\\*}/g, '')) || [];
114 | ```
115 |
116 | ## Contributing Guidelines
117 |
118 | ### New Adventure Requirements
119 | - Follow the established markdown template structure
120 | - Include landscape image (1456x832 pixels)
121 | - Provide solution in at least one language in `Solutions/`
122 | - Adventure should demonstrate specific Copilot features or techniques
123 | - Include both Agent and Ask mode variants
124 |
125 | ### Code Style
126 | - Prioritize readability and educational value over optimization
127 | - Include extensive comments showing Copilot interaction
128 | - Use descriptive variable names that align with adventure themes
129 | - For C#: Add new adventures to the `Program.cs` switch statement
130 |
131 | ## Common Adventure Patterns
132 |
133 | ### Algorithm Types
134 | - **Sequence prediction** (Tempora, Chamber of Echoes)
135 | - **Pattern matching** (Algora, Stonevale)
136 | - **Data parsing/filtering** (Eldoria scrolls)
137 | - **Game mechanics simulation** (Mythos grid, celestial alignment)
138 |
139 | ### Data Structures
140 | - Most adventures use arrays/lists as primary data structures
141 | - Time-based adventures work with time parsing and arithmetic
142 | - Grid-based adventures use 2D arrays or coordinate systems
143 | - String processing adventures focus on parsing and pattern extraction
144 |
145 | When creating new content, maintain the whimsical fantasy theme while ensuring technical challenges are appropriate for the target difficulty level.
146 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | bin
3 | obj
4 | .vs/
5 | .claude
6 | CLAUDE.md
7 |
8 | # Python
9 | __pycache__/
10 | *.py[cod]
11 | *$py.class
12 | *.so
13 | .Python
14 | build/
15 | develop-eggs/
16 | dist/
17 | downloads/
18 | eggs/
19 | .eggs/
20 | lib/
21 | lib64/
22 | parts/
23 | sdist/
24 | var/
25 | wheels/
26 | *.egg-info/
27 | .installed.cfg
28 | *.egg
29 | MANIFEST
30 |
31 | # Virtual environments
32 | .env
33 | .venv
34 | env/
35 | venv/
36 | ENV/
37 | env.bak/
38 | venv.bak/
39 |
40 | # PyCharm
41 | .idea/
42 |
43 | # VS Code Python
44 | .vscode/settings.json
45 | .vscode/launch.json
46 | .vscode/extensions.json
47 |
--------------------------------------------------------------------------------
/.vscode/mcp.json:
--------------------------------------------------------------------------------
1 | {
2 | "servers": {
3 | "firecrawl": {
4 | "command": "npx",
5 | "args": [
6 | "-y",
7 | "firecrawl-mcp"
8 | ],
9 | "env": {
10 | "FIRECRAWL_API_KEY": "${input:fireCrawlApiKey}"
11 | }
12 | },
13 | "filesystem": {
14 | "command": "npx",
15 | "args": [
16 | "-y",
17 | "@modelcontextprotocol/server-filesystem",
18 | "${workspaceFolder}"
19 | ]
20 | }
21 | },
22 | "inputs": [
23 | {
24 | "type": "promptString",
25 | "id": "fireCrawlApiKey",
26 | "description": "Firecrawl API Key",
27 | "password": true
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/AGENTS.md:
--------------------------------------------------------------------------------
1 | # AGENTS.md - CopilotAdventures Development Guide
2 |
3 | ## Project Structure
4 |
5 | CopilotAdventures is an educational repository featuring fantasy-themed coding challenges designed to teach GitHub Copilot's different interaction modes. The repository is organized as follows:
6 |
7 | ### Directory Structure
8 | ```
9 | CopilotAdventures/
10 | ├── Adventures/
11 | │ ├── Agent/ # Autonomous AI agent mode challenges
12 | │ └── Ask/ # Interactive chat mode challenges
13 | ├── Solutions/
14 | │ ├── CSharp/ # C# solutions with centralized runner
15 | │ ├── JavaScript/ # Standalone JavaScript solutions
16 | │ └── Python/ # Standalone Python solutions
17 | ├── Data/
18 | │ └── scrolls.txt # Shared data for Eldoria adventure
19 | ├── Images/ # Adventure artwork (1456x832 landscape)
20 | └── .github/
21 | └── copilot-instructions.md # GitHub Copilot development guidelines
22 | ```
23 |
24 | ### Adventure Organization
25 | - **Agent Mode** (`Adventures/Agent/`): Multi-file, autonomous project creation challenges
26 | - **Ask Mode** (`Adventures/Ask/`): Step-by-step collaborative learning challenges
27 | - **Difficulty Levels**: `1-Beginner/`, `2-Intermediate/`, `3-Advanced/`
28 | - **Parallel Variants**: Each adventure has both `-Agent.md` and `-Ask.md` versions
29 |
30 | ### Solutions Architecture
31 | **C# Centralized Pattern**: Single `Program.cs` with switch-case adventure selector
32 | **JavaScript/Python Standalone Pattern**: Individual executable files per adventure
33 |
34 | ## Coding Conventions
35 |
36 | ### File Naming Standards
37 | - **Adventure Files**: `The-[Name]-of-[Location]-[Mode].md`
38 | - **Solution Files**: `The-[Name]-of-[Location].[ext]`
39 | - **C# Classes**: PascalCase matching adventure names (e.g., `Tempora`, `Algora`)
40 | - **Fantasy Themes**: Use mystical locations (Tempora, Algora, Lumoria, Eldoria)
41 |
42 | ### Code Style Guidelines
43 | - **Single-File Solutions**: Complete adventure in one executable file
44 | - **Console-Based I/O**: All interaction through console for simplicity
45 | - **Educational Comments**: Include Copilot interaction patterns and prompts used
46 | - **Fantasy Variable Naming**: Align with adventure themes (`clockTimes`, `scrollSecrets`)
47 | - **Self-Contained**: Minimize external dependencies beyond standard libraries
48 | - **Readability First**: Prioritize educational value over optimization
49 |
50 | ### Language-Specific Standards
51 |
52 | #### C# Conventions
53 | - Use PascalCase for class names and public methods
54 | - Add new adventures to `Program.cs` switch statement
55 | - Implement mandatory `Run()` method for each adventure class
56 | - Use `dotnet run [adventure-name]` for execution
57 |
58 | #### JavaScript/Python Conventions
59 | - Use camelCase for variables and functions
60 | - Direct execution: `node filename.js` or `python filename.py`
61 | - Include educational comments showing Copilot prompts
62 | - Handle console input/output consistently
63 |
64 | ### Adventure Content Standards
65 | - **Hero Images**: Landscape format 1456x832 pixels
66 | - **Structure**: Background story → Objective → Prerequisites → Specifications → Tasks
67 | - **Educational Focus**: Demonstrate specific Copilot capabilities
68 | - **Fantasy Theming**: Maintain whimsical, adventure-based context
69 | - **Learning Outcomes**: Clear skill development goals
70 |
71 | ## Testing Protocols
72 |
73 | ### Solution Validation
74 | 1. **Functionality Testing**: Verify each solution runs without errors
75 | 2. **Educational Value**: Confirm adventure teaches intended Copilot skills
76 | 3. **Cross-Platform**: Test solutions on multiple environments
77 | 4. **Documentation**: Ensure clear instructions and expected outputs
78 |
79 | ### Testing Commands
80 | ```bash
81 | # C# Solutions
82 | cd Solutions/CSharp
83 | dotnet build
84 | dotnet run [adventure-name]
85 |
86 | # JavaScript Solutions
87 | cd Solutions/JavaScript
88 | node The-[Adventure-Name].js
89 |
90 | # Python Solutions
91 | cd Solutions/Python
92 | python The-[Adventure-Name].py
93 | ```
94 |
95 | ### Quality Checklist
96 | - [ ] Solution executes successfully
97 | - [ ] Console output matches expected format
98 | - [ ] Educational comments are clear and helpful
99 | - [ ] Fantasy theme is consistent
100 | - [ ] Copilot interaction patterns are demonstrated
101 | - [ ] No external dependencies beyond standard libraries
102 |
103 | ## Pull Request Guidelines
104 |
105 | ### PR Title Format
106 | Use: `New Copilot Adventure: [Your Adventure Name]` for new adventures
107 |
108 | ### PR Content Requirements
109 | - **Difficulty Level**: Specify beginner, intermediate, or advanced
110 | - **Adventure Template**: Follow existing markdown structure in Adventures folder
111 | - **Hero Image**: Include landscape artwork (1456x832 pixels) using Microsoft Copilot Image Creator
112 | - **Solution Code**: Provide complete solution in single file within appropriate Solutions language folder
113 | - **Educational Value**: Demonstrate specific GitHub Copilot features or interaction modes
114 |
115 | ### PR Description Template
116 | ```markdown
117 | ## Adventure Details
118 | - **Name**: [Adventure Name]
119 | - **Difficulty**: [Beginner/Intermediate/Advanced]
120 | - **Copilot Mode**: [Agent/Ask/Both]
121 | - **Language**: [C#/JavaScript/Python]
122 |
123 | ## Learning Objectives
124 | - [ ] Demonstrate [specific Copilot feature]
125 | - [ ] Teach [programming concept]
126 | - [ ] Practice [development skill]
127 |
128 | ## Files Included
129 | - [ ] Adventure markdown file(s)
130 | - [ ] Hero image (1456x832 landscape)
131 | - [ ] Complete solution code
132 | - [ ] Updated Program.cs (if C#)
133 |
134 | ## Testing Completed
135 | - [ ] Solution builds and runs successfully
136 | - [ ] Educational content is clear and engaging
137 | - [ ] Fantasy theme is consistent
138 | - [ ] Copilot interaction patterns are evident
139 | ```
140 |
141 | ### Review Criteria
142 | 1. **Educational Value**: Does the adventure effectively teach Copilot usage?
143 | 2. **Code Quality**: Is the solution clean, well-commented, and functional?
144 | 3. **Template Compliance**: Does it follow the established adventure structure?
145 | 4. **Fantasy Theme**: Is the adventure content engaging and thematically consistent?
146 | 5. **Technical Requirements**: Are all files properly formatted and executable?
147 |
148 | ### Contribution Workflow
149 | 1. Fork the repository
150 | 2. Create adventure content following templates
151 | 3. Test solution thoroughly
152 | 4. Submit PR with complete documentation
153 | 5. Address review feedback
154 | 6. Merge after approval
155 |
156 | ## GitHub Copilot Integration
157 |
158 | ### Mode-Specific Development
159 | - **Agent Mode**: Use for autonomous project creation and multi-file coordination
160 | - **Ask Mode**: Use for step-by-step learning and explanation-driven development
161 | - **Edit Mode**: Use for iterative improvements and multi-file modifications
162 |
163 | ### Best Practices
164 | - Include actual Copilot prompts used in solution comments
165 | - Demonstrate progressive enhancement with Copilot assistance
166 | - Show how different modes complement each other
167 | - Provide clear examples of effective Copilot interaction patterns
168 |
169 | ## Common Adventure Patterns
170 |
171 | ### Algorithm Categories
172 | - **Time Synchronization**: Parse time strings, calculate differences
173 | - **Sequence Prediction**: Pattern recognition in arrays
174 | - **Data Filtering**: Extract information using regex patterns
175 | - **Grid Simulation**: 2D array manipulation for game mechanics
176 | - **Logic Implementation**: Conditional rule systems
177 |
178 | ### Data Processing Examples
179 | - Eldoria scrolls: Extract secrets using `{*...*}` pattern
180 | - Tempora clocks: Time arithmetic and synchronization
181 | - Mythos grids: 2D coordinate systems and pathfinding
182 | - Chamber echoes: Number sequence pattern recognition
183 |
184 | This documentation ensures consistent, high-quality contributions that enhance the educational value of CopilotAdventures while maintaining its engaging fantasy theme.
--------------------------------------------------------------------------------
/Adventures/Agent/1-Beginner/The-Clockwork-Town-of-Tempora-Agent.md:
--------------------------------------------------------------------------------
1 | ## The Clockwork Town of Tempora - Agent Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the mechanical town of Tempora, everything operates on clockwork and precise timing. At the heart of the town is the Grand Clock Tower, responsible for keeping time for all the town's activities. However, over the years, some smaller clocks in the town have started to drift away from the accurate time.
10 |
11 | ### Objective
12 |
13 | Your task is to create a system that checks all the clocks in the town and synchronizes them with the Grand Clock Tower. You'll be given a list of times from various clocks around the town, and you must determine how many minutes each clock is ahead or behind the Grand Clock Tower's time.
14 |
15 | **In this adventure, you'll learn to use GitHub Copilot Agent Mode** - an autonomous AI assistant that can understand complex tasks and break them down into multiple steps, creating entire applications from scratch!
16 |
17 | ### Prerequisites
18 |
19 | Before starting this adventure, you'll need to perform the following steps:
20 |
21 | 1. **Install VS Code** - Download from [VS Code](https://code.visualstudio.com/).
22 | 2. **Set up GitHub Copilot in VS Code** - Follow the instructions at [Set up GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/setup).
23 |
24 | ### Learning Outcomes
25 |
26 | By completing this adventure with Agent Mode, you'll learn:
27 |
28 | - ✅ How to give high-level instructions to an AI agent
29 | - ✅ How Agent Mode breaks down complex tasks autonomously
30 | - ✅ How to iterate and refine solutions with an AI pair programmer
31 | - ✅ The power of autonomous coding assistance for complete projects
32 | - ✅ Best practices for prompting Agent Mode effectively
33 |
34 | ### Setting Up Agent Mode
35 |
36 | 1. **Open VS Code** and ensure you're signed in to GitHub.
37 | 3. **Open the Chat view** by selecting the chat icon in the top bar.
38 | 4. **Select "Agent" mode** from the dropdown at the bottom of the Chat panel.
39 |
40 | ### Specifications
41 |
42 | Now let's define the requirements for the clock synchronization system so that you can start using Agent Mode effectively!
43 |
44 | 1. **Clock Data:**
45 | - The clock times are provided in a 24-hour format.
46 | - The Grand Clock Tower is at 15:00.
47 | - Clock times around town:
48 | - Clock 1: 14:45
49 | - Clock 2: 15:05
50 | - Clock 3: 15:00
51 | - Clock 4: 14:40
52 |
53 | 2. **Time Analysis and Output:**
54 | - You need to determine how many minutes each clock is ahead or behind the Grand Clock Tower.
55 | - The result should be an array of integers representing the time difference in minutes. Positive values indicate the clock is ahead, and negative values indicate it's behind.
56 |
57 | ### Using Agent Mode to Solve the Adventure
58 |
59 | #### Step 1: Give Agent Mode a High-Level Task
60 |
61 | In the Chat panel with "Agent" mode selected, provide a comprehensive prompt like:
62 |
63 | ```
64 | Create a complete clock synchronization system for the town of Tempora. The system should:
65 |
66 | 1. Create a console application in JavaScript (or your preferred language)
67 | 2. Define the Grand Clock Tower time as 15:00
68 | 3. Store clock times for 4 clocks around town: 14:45, 15:05, 15:00, 14:40
69 | 4. Calculate how many minutes each clock is ahead or behind the Grand Clock Tower
70 | 5. Display the results clearly, showing positive values for clocks ahead and negative for clocks behind
71 | 6. Include proper error handling and clear documentation
72 | 7. Make the code readable and maintainable
73 |
74 | Please create the project structure, write the code, and test it.
75 | ```
76 |
77 | #### Step 2: Watch Agent Mode Work
78 |
79 | Agent Mode will autonomously:
80 | - 🔍 **Analyze** your workspace and determine what files to create
81 | - 📁 **Create** the necessary project structure
82 | - 💻 **Write** the complete application code
83 | - 🧪 **Test** the application by running it
84 | - 🔧 **Fix** any issues that arise automatically
85 |
86 | You'll see each step in the UI, showing every tool invocation.
87 |
88 | #### Step 3: Interact and Refine
89 |
90 | As Agent Mode works, you can:
91 | - **Approve or modify** proposed changes
92 | - **Ask for improvements**: "Can you add visual clock representations?"
93 | - **Request explanations**: "Explain how the time calculation works"
94 | - **Add features**: "Add the ability to input custom clock times"
95 |
96 | #### Step 4: Explore Advanced Features
97 |
98 | Once your basic system works, try asking Agent Mode to:
99 |
100 | ```
101 | Enhance the clock system with these features:
102 | 1. Add a visual ASCII representation of each clock
103 | 2. Create unit tests for the time calculation logic
104 | 3. Add error handling for invalid time formats
105 | 4. Generate documentation explaining the system
106 | ```
107 |
108 | ### Expected Output Example
109 |
110 | When your Agent Mode implementation is complete, running the application should produce output similar to the following. AI is non-deterministic, so your results may vary slightly, but the structure should be similar.
111 |
112 | ```
113 | 🕐 Tempora Clock Synchronization System 🕐
114 | Grand Clock Tower Time: 15:00
115 |
116 | Clock Analysis Results:
117 | Clock 1 (14:45): -15 minutes (behind)
118 | Clock 2 (15:05): +5 minutes (ahead)
119 | Clock 3 (15:00): 0 minutes (synchronized)
120 | Clock 4 (14:40): -20 minutes (behind)
121 |
122 | Summary: 3 clocks need adjustment
123 |
124 | 🏛️ Enhanced Tempora Clock Analysis 🏛️
125 |
126 | 🗼 Grand Clock Tower:
127 | ⏰ 15:00
128 | 12
129 | 9 | 3
130 | 6
131 | (3:00)
132 |
133 | 🏘️ Town Clocks:
134 | --- Clock 1 ---
135 | ⏰ 14:45
136 | 12
137 | 9 | 3
138 | 6
139 | (2:45)
140 | ⏰ 15 min BEHIND
141 | ```
142 |
143 | **Verification Checklist:**
144 | - ✅ Correctly calculates time differences: [-15, +5, 0, -20]
145 | - ✅ Identifies 3 clocks needing adjustment
146 | - ✅ Includes ASCII clock visualizations
147 | - ✅ Shows clockwork/steampunk themed output
148 | - ✅ Handles time format validation
149 | - ✅ Provides clear status for each clock
150 |
151 | ### Agent Mode Tips
152 |
153 |
154 |
155 |
156 |
157 | #### Effective Prompting Strategies
158 |
159 | 1. **Be Comprehensive**: Give Agent Mode the full context and all requirements upfront
160 | 2. **Specify Preferences**: Mention your preferred programming language, frameworks, or patterns
161 | 3. **Set Clear Goals**: Define what "done" looks like for your project
162 | 4. **Ask for Best Practices**: Request clean, maintainable, and well-documented code
163 |
164 | #### Leverage Agent Mode's Autonomy
165 |
166 | 1. **Let it work**: Allow Agent Mode to complete multi-step tasks without interruption
167 | 2. **Review and approve**: Check the proposed changes before they're applied
168 | 3. **Iterate naturally**: Ask for improvements or modifications as needed
169 | 4. **Learn from the process**: Observe how Agent Mode structures and solves problems
170 |
171 |
172 | ### Important Agent Mode Considerations
173 |
174 | **Tool Confirmation & Limits:**
175 | - Agent Mode requires your confirmation before invoking tools or running commands
176 | - Maximum of 128 tools can be used per request
177 | - You can interrupt or pause requests at any time
178 | - Always review suggested edits before accepting
179 |
180 | ### Troubleshooting Agent Mode
181 |
182 | If Agent Mode isn't working as expected:
183 |
184 | **Common Issues & Solutions:**
185 |
186 | 🔧 **Agent not creating files**
187 | - Check your workspace permissions
188 | - Ensure you're in a valid project directory
189 | - Approve file creation when prompted
190 |
191 | 🔧 **Incomplete implementation**
192 | - Your prompt may need more detail - be more comprehensive
193 | - Add specific success criteria and requirements
194 | - Include examples of expected behavior
195 |
196 | 🔧 **Tool confirmation needed**
197 | - Agent Mode requires your approval for tool usage
198 | - Click "Allow" when prompted for file operations
199 | - Review what tools will be used before approving
200 |
201 | 🔧 **Agent stops mid-task**
202 | - May have hit the 128 tool limit per request
203 | - Break complex tasks into smaller chunks
204 | - Continue with a follow-up prompt
205 |
206 | **Setup Verification:**
207 | 1. **Check VS Code version**: Ensure you're using a recent version of VS Code
208 | 2. **Verify settings**: Confirm `chat.agent.enabled` is checked
209 | 3. **Check mode selection**: Make sure "Agent" is selected in the Chat dropdown
210 | 4. **Sign in**: Ensure you're signed in to GitHub with Copilot access
211 | 5. **Tool Permissions**: Approve tool usage when prompted
212 |
213 | **Pro Tips:**
214 | - Start with smaller tasks to get familiar with Agent Mode
215 | - Be very specific about what "done" looks like
216 | - Include testing and validation requirements in your prompts
217 |
218 | ### What's Next?
219 |
220 | After trying out Agent Mode with this adventure:
221 |
222 | 1. Try the **Intermediate adventures** using Agent Mode for more complex scenarios
223 | 2. Experiment with **custom tools and extensions** that integrate with Agent Mode
224 | 3. Use Agent Mode for **real projects** - it excels at creating complete applications
225 | 4. Share your experience and **provide feedback** to help improve Agent Mode
226 |
227 | Remember: Agent Mode is your autonomous coding partner. Give it clear goals, let it work, and iterate together to build amazing software!
--------------------------------------------------------------------------------
/Adventures/Agent/1-Beginner/The-Magical-Forest-of-Algora-Agent.md:
--------------------------------------------------------------------------------
1 | ## The Magical Forest of Algora - Agent Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | Deep within the enchanted Forest of Algora, two mystical creatures called 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. Each creature has its own set of dance moves, and the combination of moves creates various magical effects in the forest.
10 |
11 | ### Objective
12 |
13 | Your task is to create a system that simulates the sacred dance between Lox and Faelis creatures. You'll need to determine the magical effects of their combined dance moves and track the state of the forest after each sequence of the dance.
14 |
15 | **In this adventure, you'll learn to use GitHub Copilot Agent Mode** - an autonomous AI assistant that can understand complex tasks and break them down into multiple steps, creating entire applications from scratch!
16 |
17 | ### Prerequisites
18 |
19 | Before starting this adventure, you'll need to perform the following steps:
20 |
21 | 1. **Install VS Code** - Download from [VS Code](https://code.visualstudio.com/).
22 | 2. **Set up GitHub Copilot in VS Code** - Follow the instructions at [Set up GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/setup).
23 |
24 | ### Learning Outcomes
25 |
26 | By completing this adventure with Agent Mode, you'll learn:
27 |
28 | - ✅ How to give high-level instructions to an AI agent
29 | - ✅ How Agent Mode breaks down complex tasks autonomously
30 | - ✅ How to iterate and refine solutions with an AI pair programmer
31 | - ✅ The power of autonomous coding assistance for complete projects
32 | - ✅ Best practices for prompting Agent Mode effectively
33 |
34 | ### Setting Up Agent Mode
35 |
36 | 1. **Open VS Code** and ensure you're signed in to GitHub.
37 | 2. **Open the Chat view** by selecting the chat icon in the top bar.
38 | 3. **Select "Agent" mode** from the dropdown at the bottom of the Chat panel.
39 |
40 | ### Specifications
41 |
42 | Now let's define the requirements for the magical dance simulation so that you can start using Agent Mode effectively!
43 |
44 | 1. **Dance Mechanics:**
45 | - Each creature can perform one of three dance moves: `Twirl`, `Leap`, or `Spin`
46 | - The dance consists of 5 sequences
47 | - Display the state of the forest after each sequence
48 |
49 | 2. **Magical Effects from Move Combinations:**
50 | - Twirl + Twirl = Fireflies light up the forest
51 | - Leap + Spin = Gentle rain starts falling
52 | - Spin + Leap = A rainbow appears in the sky
53 | - Other combinations create different magical effects
54 |
55 | 3. **Predefined Move Sequences:**
56 | - **Lox moves**: Twirl, Leap, Spin, Twirl, Leap
57 | - **Faelis moves**: Spin, Twirl, Leap, Leap, Spin
58 |
59 | ### Using Agent Mode to Solve the Adventure
60 |
61 | #### Step 1: Give Agent Mode a High-Level Task
62 |
63 | In the Chat panel with "Agent" mode selected, provide a comprehensive prompt like:
64 |
65 | ```
66 | Create a complete magical dance simulation system for the Forest of Algora. The system should:
67 |
68 | 1. Create a console application in JavaScript (or your preferred language)
69 | 2. Define two mystical creatures: Lox and Faelis with their predefined dance moves
70 | 3. Lox dance sequence: [Twirl, Leap, Spin, Twirl, Leap]
71 | 4. Faelis dance sequence: [Spin, Twirl, Leap, Leap, Spin]
72 | 5. Implement magical effects for dance move combinations:
73 | - Twirl + Twirl = Fireflies light up the forest
74 | - Leap + Spin = Gentle rain starts falling
75 | - Spin + Leap = A rainbow appears in the sky
76 | - Create additional magical effects for other combinations
77 | 6. Simulate the 5-sequence dance and display the forest state after each sequence
78 | 7. Include proper error handling and clear documentation
79 | 8. Make the code readable and maintainable with a beautiful console interface
80 |
81 | Please create the project structure, write the code, and test it.
82 | ```
83 |
84 | #### Step 2: Watch Agent Mode Work
85 |
86 | Agent Mode will autonomously:
87 | - 🔍 **Analyze** your workspace and determine what files to create
88 | - 📁 **Create** the necessary project structure
89 | - 💻 **Write** the complete application code
90 | - 🧪 **Test** the application by running it
91 | - 🔧 **Fix** any issues that arise automatically
92 |
93 | You'll see each step in the UI, showing every tool invocation.
94 |
95 | #### Step 3: Interact and Refine
96 |
97 | As Agent Mode works, you can:
98 | - **Approve or modify** proposed changes
99 | - **Ask for improvements**: "Can you add visual ASCII art for the forest?"
100 | - **Request explanations**: "Explain how the magical effects system works"
101 | - **Add features**: "Add the ability to create custom dance sequences"
102 |
103 | #### Step 4: Explore Advanced Features
104 |
105 | Once your basic system works, try asking Agent Mode to:
106 |
107 | ```
108 | Enhance the magical dance system with these features:
109 | 1. Add beautiful ASCII art representations of the forest states
110 | 2. Create a system for users to define custom dance moves and effects
111 | 3. Add sound effects descriptions for each magical effect
112 | 4. Generate documentation explaining the magical dance mechanics
113 | 5. Create unit tests for the dance simulation logic
114 | ```
115 |
116 | ### Expected Output Example
117 |
118 | When your Agent Mode implementation is complete, running the application should produce output similar to the following. AI is non-deterministic, so your results may vary slightly, but the structure should be similar.
119 |
120 | ```
121 | 🌲 Welcome to the Magical Forest of Algora! 🌲
122 |
123 | 🦋 Lox and Faelis begin their sacred millennium dance...
124 |
125 | === Sequence 1 ===
126 | Lox performs: Twirl
127 | Faelis performs: Spin
128 | Combined effect: Mystical energy swirls through the trees
129 |
130 | Forest State: ✨ Enchanted glow
131 |
132 | === Sequence 2 ===
133 | Lox performs: Leap
134 | Faelis performs: Twirl
135 | Combined effect: Magical harmony resonates through the woodland
136 |
137 | Forest State: ✨🎵 Enchanted glow, harmonious melodies
138 |
139 | === Sequence 3 ===
140 | Lox performs: Spin
141 | Faelis performs: Leap
142 | Combined effect: 🌈 A magnificent rainbow appears in the sky!
143 |
144 | Forest State: ✨🎵🌧️🌈 Enchanted glow, harmonious melodies, rainbow, gentle rain
145 |
146 | Forest Visualization:
147 | 💧 💧 💧
148 | 🌈
149 |
150 | 🌲 🌳 🌲
151 | 🌿 🍄 🍄 🌿
152 | 🌱 ✨🦋✨ 🌱
153 |
154 | 🌟 The millennium dance is complete! The Forest of Algora is in perfect harmony! 🌟
155 |
156 | 🎭 Final Dance Statistics:
157 | Total sequences performed: 5
158 | Magical effects triggered: 5
159 | Forest transformations: 5
160 | ```
161 |
162 | **Verification Checklist:**
163 | - ✅ Simulates 5 sequences with Lox and Faelis moves
164 | - ✅ Tracks cumulative forest state changes
165 | - ✅ Includes ASCII art forest visualizations
166 | - ✅ Shows magical effects for each dance combination
167 | - ✅ Provides final statistics and completion message
168 | - ✅ Handles move validation and error cases
169 |
170 | ### Agent Mode Tips
171 |
172 |
173 |
174 |
175 |
176 | #### Effective Prompting Strategies
177 |
178 | 1. **Be Comprehensive**: Give Agent Mode the full context and all requirements upfront
179 | 2. **Specify Preferences**: Mention your preferred programming language, frameworks, or patterns
180 | 3. **Set Clear Goals**: Define what "done" looks like for your project
181 | 4. **Ask for Best Practices**: Request clean, maintainable, and well-documented code
182 |
183 | #### Leverage Agent Mode's Autonomy
184 |
185 | 1. **Let it work**: Allow Agent Mode to complete multi-step tasks without interruption
186 | 2. **Review and approve**: Check the proposed changes before they're applied
187 | 3. **Iterate naturally**: Ask for improvements or modifications as needed
188 | 4. **Learn from the process**: Observe how Agent Mode structures and solves problems
189 |
190 |
191 | ### Important Agent Mode Considerations
192 |
193 | **Tool Confirmation & Limits:**
194 | - Agent Mode requires your confirmation before invoking tools or running commands
195 | - Maximum of 128 tools can be used per request
196 | - You can interrupt or pause requests at any time
197 | - Always review suggested edits before accepting
198 |
199 | ### Troubleshooting Agent Mode
200 |
201 | If Agent Mode isn't working as expected:
202 |
203 | **Common Issues & Solutions:**
204 |
205 | 🔧 **Agent not creating files**
206 | - Check your workspace permissions
207 | - Ensure you're in a valid project directory
208 | - Approve file creation when prompted
209 |
210 | 🔧 **Incomplete implementation**
211 | - Your prompt may need more detail - be more comprehensive
212 | - Add specific success criteria and requirements
213 | - Include examples of expected behavior
214 |
215 | 🔧 **Tool confirmation needed**
216 | - Agent Mode requires your approval for tool usage
217 | - Click "Allow" when prompted for file operations
218 | - Review what tools will be used before approving
219 |
220 | 🔧 **Agent stops mid-task**
221 | - May have hit the 128 tool limit per request
222 | - Break complex tasks into smaller chunks
223 | - Continue with a follow-up prompt
224 |
225 | **Setup Verification:**
226 | 1. **Check VS Code version**: Ensure you're using a recent version of VS Code
227 | 2. **Verify settings**: Confirm `chat.agent.enabled` is checked
228 | 3. **Check mode selection**: Make sure "Agent" is selected in the Chat dropdown
229 | 4. **Sign in**: Ensure you're signed in to GitHub with Copilot access
230 | 5. **Tool Permissions**: Approve tool usage when prompted
231 |
232 | **Pro Tips:**
233 | - Start with smaller tasks to get familiar with Agent Mode
234 | - Be very specific about what "done" looks like
235 | - Include testing and validation requirements in your prompts
236 |
237 | ### What's Next?
238 |
239 | After trying out Agent Mode with this adventure:
240 |
241 | 1. Try the **Intermediate adventures** using Agent Mode for more complex scenarios
242 | 2. Experiment with **custom tools and extensions** that integrate with Agent Mode
243 | 3. Use Agent Mode for **real projects** - it excels at creating complete applications
244 | 4. Share your experience and **provide feedback** to help improve Agent Mode
245 |
246 | Remember: Agent Mode is your autonomous coding partner. Give it clear goals, let it work, and iterate together to build amazing software!
--------------------------------------------------------------------------------
/Adventures/Agent/2-Intermediate/The-Legendary-Duel-of-Stonevale-Agent.md:
--------------------------------------------------------------------------------
1 | ## The Legendary Duel of Stonevale - Agent Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the mystical realm of Stonevale, two warriors, Rok and Papyra, are chosen for a duel that determines the fate of their tribes for the next century. The arena, known as Scissoria, is where each move carries weight and consequences. This legendary duel follows ancient rules where different winning moves earn different points, making strategy crucial for victory.
10 |
11 | ### Objective
12 |
13 | Your task is to create a system that simulates the legendary duel between Rok and Papyra. You'll need to implement the scoring system, track each warrior's moves over multiple rounds, and determine the winner of this fate-determining battle.
14 |
15 | **In this adventure, you'll learn to use GitHub Copilot Agent Mode** - an autonomous AI assistant that can understand complex tasks and break them down into multiple steps, creating entire applications from scratch!
16 |
17 | ### Prerequisites
18 |
19 | Before starting this adventure, you'll need to perform the following steps:
20 |
21 | 1. **Install VS Code** - Download from [VS Code](https://code.visualstudio.com/).
22 | 2. **Set up GitHub Copilot in VS Code** - Follow the instructions at [Set up GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/setup).
23 |
24 | ### Learning Outcomes
25 |
26 | By completing this adventure with Agent Mode, you'll learn:
27 |
28 | - ✅ How to give high-level instructions to an AI agent
29 | - ✅ How Agent Mode breaks down complex tasks autonomously
30 | - ✅ How to iterate and refine solutions with an AI pair programmer
31 | - ✅ The power of autonomous coding assistance for complete projects
32 | - ✅ Best practices for prompting Agent Mode effectively
33 |
34 | ### Setting Up Agent Mode
35 |
36 | 1. **Open VS Code** and ensure you're signed in to GitHub.
37 | 2. **Open the Chat view** by selecting the chat icon in the top bar.
38 | 3. **Select "Agent" mode** from the dropdown at the bottom of the Chat panel.
39 |
40 | ### Specifications
41 |
42 | Now let's define the requirements for the legendary duel simulation so that you can start using Agent Mode effectively!
43 |
44 | 1. **Duel Mechanics:**
45 | - Each warrior can make: rock, paper, or scissors
46 | - Standard rules: Rock crushes scissors, paper covers rock, scissors cut paper
47 | - Duration: 5 rounds total
48 | - Draws: When both choose the same move, no points are awarded
49 |
50 | 2. **Scoring System:**
51 | - Rock win = 1 point
52 | - Paper win = 2 points
53 | - Scissors win = 3 points
54 |
55 | 3. **Predefined Warrior Moves:**
56 | - **Rok moves**: scissors, paper, scissors, rock, rock
57 | - **Papyra moves**: rock, rock, paper, scissors, paper
58 |
59 | ### Using Agent Mode to Solve the Adventure
60 |
61 | #### Step 1: Give Agent Mode a High-Level Task
62 |
63 | In the Chat panel with "Agent" mode selected, provide a comprehensive prompt like:
64 |
65 | ```
66 | Create a complete legendary duel simulation system for the warriors of Stonevale. The system should:
67 |
68 | 1. Create a console application in JavaScript (or your preferred language)
69 | 2. Define two warriors: Rok and Papyra with their predefined move sequences
70 | 3. Rok moves: [scissors, paper, scissors, rock, rock]
71 | 4. Papyra moves: [rock, rock, paper, scissors, paper]
72 | 5. Implement the duel logic with scoring system:
73 | - Rock win = 1 point, Paper win = 2 points, Scissors win = 3 points
74 | - Standard rock-paper-scissors rules apply
75 | 6. Simulate all 5 rounds of the duel
76 | 7. Track scores and determine the winner
77 | 8. Include beautiful console output with medieval/fantasy theme
78 | 9. Add proper error handling and documentation
79 | 10. Make the code readable and maintainable
80 |
81 | Please create the project structure, write the code, and test it.
82 | ```
83 |
84 | #### Step 2: Watch Agent Mode Work
85 |
86 | Agent Mode will autonomously:
87 | - 🔍 **Analyze** your workspace and determine what files to create
88 | - 📁 **Create** the necessary project structure
89 | - 💻 **Write** the complete application code
90 | - 🧪 **Test** the application by running it
91 | - 🔧 **Fix** any issues that arise automatically
92 |
93 | You'll see each step in the UI, showing every tool invocation.
94 |
95 | #### Step 3: Interact and Refine
96 |
97 | As Agent Mode works, you can:
98 | - **Approve or modify** proposed changes
99 | - **Ask for improvements**: "Can you add ASCII art for the warriors and their moves?"
100 | - **Request explanations**: "Explain how the scoring system rewards different moves"
101 | - **Add features**: "Add the ability for players to input their own moves interactively"
102 |
103 | #### Step 4: Explore Advanced Features
104 |
105 | Once your basic system works, try asking Agent Mode to:
106 |
107 | ```
108 | Enhance the legendary duel system with these features:
109 | 1. Add beautiful ASCII art representations of Rok and Papyra
110 | 2. Create visual representations of rock, paper, and scissors moves
111 | 3. Add a tournament system with multiple duels
112 | 4. Include a hint system suggesting optimal moves
113 | 5. Generate detailed battle reports and statistics
114 | 6. Create unit tests for the duel logic
115 | 7. Add sound effect descriptions for each move and outcome
116 | ```
117 |
118 | ### Expected Output
119 |
120 | When your Agent Mode implementation is complete, running the application should produce output similar to the following. AI is non-deterministic, so your results may vary slightly, but the structure should be similar.
121 |
122 | ```
123 | ⚔️ Welcome to the Legendary Duel of Stonevale! ⚔️
124 |
125 | 🏛️ In the ancient arena of Scissoria, two warriors face destiny...
126 |
127 | 🛡️ Rok the Stone Warrior vs 📜 Papyra the Swift
128 |
129 | === Round 1 ===
130 | ⚔️ Rok chooses: Scissors ✂️
131 | 🛡️ Papyra chooses: Rock 🪨
132 | 🏆 Papyra wins! Rock crushes scissors (+1 point)
133 |
134 | Current Scores: Rok: 0 | Papyra: 1
135 |
136 | === Round 2 ===
137 | ⚔️ Rok chooses: Paper 📜
138 | 🛡️ Papyra chooses: Rock 🪨
139 | 🏆 Rok wins! Paper covers rock (+2 points)
140 |
141 | Current Scores: Rok: 2 | Papyra: 1
142 |
143 | === Round 3 ===
144 | ⚔️ Rok chooses: Scissors ✂️
145 | 🛡️ Papyra chooses: Paper 📜
146 | 🏆 Rok wins! Scissors cut paper (+3 points)
147 |
148 | Current Scores: Rok: 5 | Papyra: 1
149 |
150 | === Round 4 ===
151 | ⚔️ Rok chooses: Rock 🪨
152 | 🛡️ Papyra chooses: Scissors ✂️
153 | 🏆 Rok wins! Rock crushes scissors (+1 point)
154 |
155 | Current Scores: Rok: 6 | Papyra: 1
156 |
157 | === Round 5 ===
158 | ⚔️ Rok chooses: Rock 🪨
159 | 🛡️ Papyra chooses: Paper 📜
160 | 🏆 Papyra wins! Paper covers rock (+2 points)
161 |
162 | Final Scores: Rok: 6 | Papyra: 3
163 |
164 | 👑 ROK THE STONE WARRIOR WINS THE LEGENDARY DUEL! 👑
165 |
166 | 🏛️ Rok's tribe shall prosper for the next century in Stonevale! 🏛️
167 | ```
168 |
169 | ### Agent Mode Tips
170 |
171 |
172 |
173 |
174 |
175 | #### Effective Prompting Strategies
176 |
177 | 1. **Be Comprehensive**: Give Agent Mode the full context and all requirements upfront
178 | 2. **Specify Preferences**: Mention your preferred programming language, frameworks, or patterns
179 | 3. **Set Clear Goals**: Define what "done" looks like for your project
180 | 4. **Ask for Best Practices**: Request clean, maintainable, and well-documented code
181 |
182 | #### Leverage Agent Mode's Autonomy
183 |
184 | 1. **Let it work**: Allow Agent Mode to complete multi-step tasks without interruption
185 | 2. **Review and approve**: Check the proposed changes before they're applied
186 | 3. **Iterate naturally**: Ask for improvements or modifications as needed
187 | 4. **Learn from the process**: Observe how Agent Mode structures and solves problems
188 |
189 |
190 | ### Important Agent Mode Considerations
191 |
192 | **Tool Confirmation & Limits:**
193 | - Agent Mode requires your confirmation before invoking tools or running commands
194 | - Maximum of 128 tools can be used per request
195 | - You can interrupt or pause requests at any time
196 | - Always review suggested edits before accepting
197 |
198 | ### Troubleshooting
199 |
200 | If Agent Mode isn't working:
201 |
202 | 1. **Check VS Code version**: Ensure you're using a recent version of VS Code
203 | 2. **Verify settings**: Confirm `chat.agent.enabled` is checked
204 | 3. **Check mode selection**: Make sure "Agent" is selected in the Chat dropdown
205 | 4. **Sign in**: Ensure you're signed in to GitHub with Copilot access
206 | 5. **Tool Permissions**: Approve tool usage when prompted
207 |
208 | ### What's Next?
209 |
210 | After trying out Agent Mode with this adventure:
211 |
212 | 1. Try the **Advanced adventures** using Agent Mode for more complex scenarios
213 | 2. Experiment with **custom tools and extensions** that integrate with Agent Mode
214 | 3. Use Agent Mode for **real projects** - it excels at creating complete applications
215 | 4. Share your experience and **provide feedback** to help improve Agent Mode
216 |
217 | Remember: Agent Mode is your autonomous coding partner. Give it clear goals, let it work, and iterate together to build amazing software!
--------------------------------------------------------------------------------
/Adventures/Agent/2-Intermediate/The-Scrolls-of-Eldoria-Agent.md:
--------------------------------------------------------------------------------
1 | ## The Scrolls of Eldoria - Agent Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the enchanted land of Eldoria, ancient scrolls containing the secrets of the universe were scattered and protected by the Elders using powerful spells. These spells concealed the secrets within the scrolls, adding layers of misleading information to deter prying eyes. Over time, these scrolls were digitized and stored in the Great Eldorian Library, accessible only through the Eldorian Web of Knowledge.
10 |
11 | ### Objective
12 |
13 | Your task is to create a system that retrieves a digitized scroll from the Eldorian Web of Knowledge and deciphers it by filtering out the Elders' misleading information. As a young sorcerer's apprentice, you must extract the true secrets hidden within the scroll using pattern recognition and reveal the ancient wisdom.
14 |
15 | **In this adventure, you'll learn to use GitHub Copilot Agent Mode** - an autonomous AI assistant that can understand complex tasks and break them down into multiple steps, creating entire applications from scratch!
16 |
17 | ### Prerequisites
18 |
19 | Before starting this adventure, you'll need to perform the following steps:
20 |
21 | 1. **Install VS Code** - Download from [VS Code](https://code.visualstudio.com/).
22 | 2. **Set up GitHub Copilot in VS Code** - Follow the instructions at [Set up GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/setup).
23 |
24 | ### Learning Outcomes
25 |
26 | By completing this adventure with Agent Mode, you'll learn:
27 |
28 | - ✅ How to give high-level instructions to an AI agent
29 | - ✅ How Agent Mode breaks down complex tasks autonomously
30 | - ✅ How to iterate and refine solutions with an AI pair programmer
31 | - ✅ The power of autonomous coding assistance for complete projects
32 | - ✅ Best practices for prompting Agent Mode effectively
33 |
34 | ### Setting Up Agent Mode
35 |
36 | 1. **Open VS Code** and ensure you're signed in to GitHub.
37 | 2. **Open the Chat view** by selecting the chat icon in the top bar.
38 | 3. **Select "Agent" mode** from the dropdown at the bottom of the Chat panel.
39 |
40 | ### Specifications
41 |
42 | Now let's define the requirements for the scroll deciphering system so that you can start using Agent Mode effectively!
43 |
44 | 1. **Data Retrieval:**
45 | - Make HTTP call to: `https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt`
46 | - Content is in text format containing mixed information
47 |
48 | 2. **Deciphering Requirements:**
49 | - True secrets follow pattern: surrounded by `{*` and `*}` symbols
50 | - Extract all true secrets from the scroll
51 | - Filter out all misleading information
52 |
53 | 3. **Output Requirements:**
54 | - Display extracted secrets in structured manner
55 | - Beautiful console interface with mystical theme
56 | - Clear separation between secrets
57 |
58 | ### Using Agent Mode to Solve the Adventure
59 |
60 | #### Step 1: Give Agent Mode a High-Level Task
61 |
62 | In the Chat panel with "Agent" mode selected, provide a comprehensive prompt like:
63 |
64 | ```
65 | Create a complete scroll deciphering system for the ancient scrolls of Eldoria. The system should:
66 |
67 | 1. Create a console application in JavaScript (or your preferred language)
68 | 2. Make an HTTP request to retrieve the digitized scroll from:
69 | https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt
70 | 3. Parse the scroll content to extract true secrets using regular expressions
71 | 4. True secrets are enclosed in {* and *} pattern markers
72 | 5. Filter out all misleading information added by the Elders
73 | 6. Display the extracted secrets in a beautiful, mystical-themed console interface
74 | 7. Include proper error handling for network requests
75 | 8. Add comprehensive documentation explaining the deciphering process
76 | 9. Make the code readable and maintainable
77 |
78 | Please create the project structure, write the code, and test it.
79 | ```
80 |
81 | #### Step 2: Watch Agent Mode Work
82 |
83 | Agent Mode will autonomously:
84 | - 🔍 **Analyze** your workspace and determine what files to create
85 | - 📁 **Create** the necessary project structure
86 | - 💻 **Write** the complete application code
87 | - 🧪 **Test** the application by running it
88 | - 🔧 **Fix** any issues that arise automatically
89 |
90 | You'll see each step in the UI, showing every tool invocation.
91 |
92 | #### Step 3: Interact and Refine
93 |
94 | As Agent Mode works, you can:
95 | - **Approve or modify** proposed changes
96 | - **Ask for improvements**: "Can you add a mystical animation for revealing secrets?"
97 | - **Request explanations**: "Explain how the regular expression pattern matching works"
98 | - **Add features**: "Add the ability to save deciphered secrets to a file"
99 |
100 | #### Step 4: Explore Advanced Features
101 |
102 | Once your basic system works, try asking Agent Mode to:
103 |
104 | ```
105 | Enhance the scroll deciphering system with these features:
106 | 1. Add support for multiple scroll sources and different secret patterns
107 | 2. Create a web interface for the scroll deciphering tool
108 | 3. Implement secret categorization and analysis
109 | 4. Add encryption/decryption capabilities for protecting discovered secrets
110 | 5. Generate detailed reports about the deciphering process
111 | 6. Create unit tests for the text processing logic
112 | 7. Add progress indicators for network requests and processing
113 | ```
114 |
115 | ### Expected Output
116 |
117 | When your Agent Mode implementation is complete, running the application should produce output similar to the following. AI is non-deterministic, so your results may vary slightly, but the structure should be similar.
118 |
119 | ```
120 | 📜 Welcome to the Great Eldorian Library! 📜
121 |
122 | 🔮 Accessing the Eldorian Web of Knowledge...
123 | ✨ Scroll retrieved successfully from the ancient archives
124 |
125 | 🧙♂️ Beginning deciphering process...
126 | 🔍 Filtering out the Elders' misleading information...
127 |
128 | ═══════════════════════════════════════
129 | ✨ ANCIENT SECRETS OF ELDORIA REVEALED ✨
130 | ═══════════════════════════════════════
131 |
132 | 🌟 Secret 1: The key to unlocking magical potential lies in understanding the harmony between elements.
133 |
134 | 🌟 Secret 2: Time flows differently in the realm of pure thought and meditation.
135 |
136 | 🌟 Secret 3: The greatest power comes from the unity of knowledge and wisdom.
137 |
138 | 🌟 Secret 4: Ancient runes hold the power to bridge realms when properly channeled.
139 |
140 | ═══════════════════════════════════════
141 | 📚 Total Secrets Discovered: 4
142 | 🔮 The wisdom of Eldoria is now yours!
143 | ═══════════════════════════════════════
144 |
145 | 🎓 Your apprenticeship advances! You have successfully deciphered the ancient scrolls.
146 | ```
147 |
148 | ### Agent Mode Tips
149 |
150 |
151 |
152 |
153 |
154 | #### Effective Prompting Strategies
155 |
156 | 1. **Be Comprehensive**: Give Agent Mode the full context and all requirements upfront
157 | 2. **Specify Preferences**: Mention your preferred programming language, frameworks, or patterns
158 | 3. **Set Clear Goals**: Define what "done" looks like for your project
159 | 4. **Ask for Best Practices**: Request clean, maintainable, and well-documented code
160 |
161 | #### Leverage Agent Mode's Autonomy
162 |
163 | 1. **Let it work**: Allow Agent Mode to complete multi-step tasks without interruption
164 | 2. **Review and approve**: Check the proposed changes before they're applied
165 | 3. **Iterate naturally**: Ask for improvements or modifications as needed
166 | 4. **Learn from the process**: Observe how Agent Mode structures and solves problems
167 |
168 |
169 | ### Important Agent Mode Considerations
170 |
171 | **Tool Confirmation & Limits:**
172 | - Agent Mode requires your confirmation before invoking tools or running commands
173 | - Maximum of 128 tools can be used per request
174 | - You can interrupt or pause requests at any time
175 | - Always review suggested edits before accepting
176 |
177 | ### Troubleshooting
178 |
179 | If Agent Mode isn't working:
180 |
181 | 1. **Check VS Code version**: Ensure you're using a recent version of VS Code
182 | 2. **Verify settings**: Confirm `chat.agent.enabled` is checked
183 | 3. **Check mode selection**: Make sure "Agent" is selected in the Chat dropdown
184 | 4. **Sign in**: Ensure you're signed in to GitHub with Copilot access
185 | 5. **Tool Permissions**: Approve tool usage when prompted
186 |
187 | ### What's Next?
188 |
189 | After trying out Agent Mode with this adventure:
190 |
191 | 1. Try the **Advanced adventures** using Agent Mode for more complex scenarios
192 | 2. Experiment with **custom tools and extensions** that integrate with Agent Mode
193 | 3. Use Agent Mode for **real projects** - it excels at creating complete applications
194 | 4. Share your experience and **provide feedback** to help improve Agent Mode
195 |
196 | Remember: Agent Mode is your autonomous coding partner. Give it clear goals, let it work, and iterate together to build amazing software!
--------------------------------------------------------------------------------
/Adventures/Ask/1-Beginner/The-Clockwork-Town-of-Tempora-Ask.md:
--------------------------------------------------------------------------------
1 | ## The Clockwork Town of Tempora: Ask Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the mechanical town of Tempora, everything operates on clockwork and precise timing. At the heart of the town is the Grand Clock Tower, responsible for keeping time for all the town's activities. However, over the years, some smaller clocks in the town have started to drift away from the accurate time.
10 |
11 | ### Objective
12 |
13 | Your task is to create a system that checks all the clocks in the town and synchronizes them with the Grand Clock Tower. You'll be given a list of times from various clocks around the town, and you must determine how many minutes each clock is ahead or behind the Grand Clock Tower's time.
14 |
15 | ### Specifications
16 |
17 | 1. **Clock Data:**
18 | - The clock times are provided in a 24-hour format.
19 | - The Grand Clock Tower is at 15:00.
20 | - Clock times around town:
21 | - Clock 1: 14:45
22 | - Clock 2: 15:05
23 | - Clock 3: 15:00
24 | - Clock 4: 14:40
25 |
26 | 2. **Time Analysis and Output:**
27 | - You need to determine how many minutes each clock is ahead or behind the Grand Clock Tower.
28 | - The result should be an array of integers representing the time difference in minutes. Positive values indicate the clock is ahead, and negative values indicate it's behind.
29 |
30 | ### Constraints
31 |
32 | - Use GitHub Copilot and write the simulation in any language you'd like.
33 | - Focus on clear and concise code. Ask GitHub Copilot/Chat, "How can I make this code more readable and maintainable?".
34 | - Creating a visual representation for the clocks is optional but encouraged if you have time.
35 |
36 | ### Summary of High-Level Tasks to Perform
37 |
38 | 1. Use a console application to render the output.
39 | 1. Parse the time data for each clock and the Grand Clock Tower.
40 | 1. Calculate the difference in minutes between each clock and the Grand Clock Tower.
41 | 1. Output the list of time differences.
42 |
43 | ### Tips to Get Started
44 |
45 | 1. If you're using a GitHub Codespace, you're ready to go!
46 | 1. If running locally, ensure that you have your target language/framework installed.
47 | - [Node.js](https://nodejs.org)
48 | - [Python](https://www.python.org/downloads/)
49 | - [.NET](https://dot.net)
50 | 1. Create a folder for your code.
51 | - JavaScript: Create a folder called `tempora` and add a file named `app.js`.
52 | - Python: Create a folder called `tempora` and add a file named `app.py`.
53 | - C#: Create a folder called `tempora` and run `dotnet new console`.
54 |
55 | ### GitHub Copilot Tips
56 |
57 |
58 |
59 |
60 |
61 | #### Use Copilot to improve efficiency
62 |
63 | See if you can use Copilot to find out the complexity (BigO notation) of the code.
64 |
65 | 1. Open [GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) in the sidebar if it's not already open. Make sure your solution file is still open as well.
66 |
67 | 1. Ask GitHub Copilot what the complexity of the code is.
68 |
69 | 1. Ask GitHub Copilot to make the code more efficient.
70 |
71 | 1. Ask for the complexity again - is it better?
72 |
73 | #### Use Copilot to generate code comments
74 |
75 | 1. Highlight all of the code with Ctrl/Cmd+A.
76 |
77 | 1. Press Ctrl/Cmd+I to open the inline chat.
78 |
79 | 1. Type "/doc"
80 |
81 | 1. Ask GitHub Copilot to document the function.
82 |
83 | #### Use Copilot to simplify your code
84 |
85 | 1. Open GitHub Copilot in the sidebar.
86 |
87 | 1. Type "/simplify" and press Enter. You can also add any text you want after the "/simplify" to give Copilot more instructions.
88 |
89 | 1. What did GitHub Copilot suggest you do to make it simpler?
90 |
91 | #### Got Errors?
92 |
93 | GitHub Copilot can help with that too! Just copy the error message and paste it into the chat. Often that's all Copilot needs to resolve your issue.
--------------------------------------------------------------------------------
/Adventures/Ask/1-Beginner/The-Magical-Forest-of-Algora-Ask.md:
--------------------------------------------------------------------------------
1 | ## The Magical Forest of Algora: Ask Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | 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.
10 |
11 | ### Objective
12 |
13 | 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.
14 |
15 | ### Specifications
16 |
17 | 1. **Dance Moves and Effects:**
18 | - Each creature can perform one of three dance moves: `Twirl`, `Leap`, or `Spin`.
19 | - The combination of moves from both creatures results in a magical effect:
20 | - Twirl + Twirl = Fireflies light up the forest.
21 | - Leap + Spin = Gentle rain starts falling.
22 | - Spin + Leap = A rainbow appears in the sky.
23 | - Other combinations create different effects that you can dream up.
24 |
25 | 2. **Dance Dynamics:**
26 | - Each effect will change the state of the forest.
27 | - Some effects can be beneficial, while others can be detrimental.
28 |
29 | 3. **Dance Sequence:**
30 | - The dance consists of 5 sequences.
31 | - You need to display the state of the forest after each sequence.
32 |
33 | 4. **Creature Moves:**
34 |
35 | **Moves for Lox (Creature 1)**
36 |
37 | | Sequence 1 | Sequence 2 | Sequence 3 | Sequence 4 | Sequence 5 |
38 | |------------|------------|------------|------------|------------|
39 | | Twirl | Leap | Spin | Twirl | Leap |
40 |
41 | **Moves for Faelis (Creature 2)**
42 |
43 | | Sequence 1 | Sequence 2 | Sequence 3 | Sequence 4 | Sequence 5 |
44 | |------------|------------|------------|------------|------------|
45 | | Spin | Twirl | Leap | Leap | Spin |
46 |
47 | 5. **Advanced Features (if time permits):**
48 | - Implement a system that allows users to add new dance moves and effects.
49 | - Users can select the dance move for each sequence.
50 |
51 | ### Constraints
52 |
53 | - Use GitHub Copilot and write the simulation in any language you'd like.
54 | - 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?".
55 | - Creating a visual representation for the dance and effects is optional but encouraged if you have time.
56 |
57 | ### Summary of High-Level Tasks to Perform
58 |
59 | 1. Use a console application to render the output.
60 | 1. Initialize the state of the forest.
61 | 1. Each creature selects a dance move for each sequence.
62 | 1. Determine the effect of the combined dance moves on the forest.
63 | 1. Update the state of the forest after each sequence.
64 | 1. Display the final state of the forest after the dance is complete.
65 |
66 | ### Tips to Get Started
67 |
68 | 1. If you're using a GitHub Codespace, you're ready to go!
69 | 1. If running locally, ensure that you have your target language/framework installed.
70 | - [Node.js](https://nodejs.org)
71 | - [Python](https://www.python.org/downloads/)
72 | - [.NET](https://dot.net)
73 | 1. Create a folder for your code.
74 | - JavaScript: Create a folder called `algora` and add a file named `app.js`.
75 | - Python: Create a folder called `algora` and add a file named `app.py`.
76 | - C#: Create a folder called `algora` and run `dotnet new console`.
77 |
78 | ### GitHub Copilot Tips
79 |
80 |
81 |
82 |
83 |
84 | #### Use Copilot to improve efficiency
85 |
86 | See if you can use Copilot to find out the complexity (BigO notation) of the code.
87 |
88 | 1. Open [GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) in the sidebar if it's not already open. Make sure your solution file is still open as well.
89 |
90 | 1. Ask GitHub Copilot what the complexity of the code is.
91 |
92 | 1. Ask GitHub Copilot to make the code more efficient.
93 |
94 | 1. Ask for the complexity again - is it better?
95 |
96 | #### Use Copilot to generate code comments
97 |
98 | 1. Highlight all of the code with Ctrl/Cmd+A.
99 |
100 | 1. Press Ctrl/Cmd+I to open the inline chat.
101 |
102 | 1. Type "/doc"
103 |
104 | 1. Ask GitHub Copilot to document the function.
105 |
106 | #### Use Copilot to simplify your code
107 |
108 | 1. Open GitHub Copilot in the sidebar.
109 |
110 | 1. Type "/simplify" and press Enter. You can also add any text you want after the "/simplify" to give Copilot more instructions.
111 |
112 | 1. What did GitHub Copilot suggest you do to make it simpler?
113 |
114 | #### Got Errors?
115 |
116 | GitHub Copilot can help with that too! Just copy the error message and paste it into the chat. Often that's all Copilot needs to resolve your issue.
--------------------------------------------------------------------------------
/Adventures/Ask/1-Beginner/it-IT/The-Clockwork-Town-of-Tempora-Ask.md:
--------------------------------------------------------------------------------
1 | ## La Città Meccanica di Tempora: Avventura Modalità Ask
2 |
3 |
4 |
5 |
6 |
7 | ### Contesto
8 |
9 | Nella città meccanica di Tempora, tutto funziona a orologeria e con un timing preciso. Al centro della città si trova la Grande Torre dell'Orologio, responsabile della gestione del tempo per tutte le attività della città. Tuttavia, nel corso degli anni, alcuni orologi più piccoli in città hanno iniziato a deviare dal tempo esatto.
10 |
11 | ### Obiettivo
12 |
13 | Il tuo compito è creare un sistema che controlla tutti gli orologi della città e li sincronizza con la Grande Torre dell'Orologio. Ti verrà fornito un elenco di orari da vari orologi in giro per la città, e devi determinare quanti minuti ogni orologio è avanti o indietro rispetto all'orario della Grande Torre dell'Orologio.
14 |
15 | ### Specifiche
16 |
17 | 1. **Dati dell'Orologio:**
18 | - Gli orari degli orologi sono forniti in formato 24 ore.
19 | - La Grande Torre dell'Orologio è alle 15:00.
20 | - Orari degli orologi in città:
21 | - Orologio 1: 14:45
22 | - Orologio 2: 15:05
23 | - Orologio 3: 15:00
24 | - Orologio 4: 14:40
25 |
26 | 2. **Analisi del Tempo e Output:**
27 | - Devi determinare quanti minuti ogni orologio è avanti o indietro rispetto alla Grande Torre dell'Orologio.
28 | - Il risultato dovrebbe essere un array di interi che rappresentano la differenza di tempo in minuti. I valori positivi indicano che l'orologio è avanti, e i valori negativi indicano che è indietro.
29 |
30 | ### Vincoli
31 |
32 | - Usa GitHub Copilot e scrivi la simulazione in qualsiasi linguaggio tu preferisca.
33 | - Concentrati su un codice chiaro e conciso. Chiedi a GitHub Copilot/Chat, "Come posso rendere questo codice più leggibile e manutenibile?".
34 | - Creare una rappresentazione visiva per gli orologi è opzionale ma incoraggiato se hai tempo.
35 |
36 | ### Riassunto delle Attività di Alto Livello da Eseguire
37 | 1. Usa un'applicazione console per visualizzare l'output.
38 | 1. Analizza i dati temporali per ogni orologio e la Grande Torre dell'Orologio.
39 | 1. Calcola la differenza in minuti tra ogni orologio e la Grande Torre dell'Orologio.
40 | 1. Mostra la lista delle differenze di tempo.
41 |
42 | ### Suggerimenti per Iniziare
43 |
44 | 1. Se stai usando un GitHub Codespace, sei pronto per iniziare!
45 | 1. Se stai lavorando localmente, assicurati di avere installato il tuo linguaggio/framework di destinazione.
46 | - [Node.js](https://nodejs.org)
47 | - [Python](https://www.python.org/downloads/)
48 | - [.NET](https://dot.net)
49 | 1. Crea una cartella per il tuo codice.
50 | - JavaScript: Crea una cartella chiamata `tempora` e aggiungi un file chiamato `app.js`.
51 | - Python: Crea una cartella chiamata `tempora` e aggiungi un file chiamato `app.py`.
52 | - C#: Crea una cartella chiamata `tempora` e esegui `dotnet new console`.
53 |
54 | ### Suggerimenti per GitHub Copilot
55 |
56 |
57 |
58 |
59 |
60 | #### Usa Copilot per migliorare l'efficienza
61 |
62 | Vedi se puoi usare Copilot per scoprire la complessità (notazione BigO) del codice.
63 |
64 | 1. Apri la [vista Chat di GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) nella barra laterale se non è già aperta. Assicurati che il tuo file di soluzione sia ancora aperto.
65 |
66 | 1. Chiedi a GitHub Copilot qual è la complessità del codice.
67 |
68 | 1. Chiedi a GitHub Copilot di rendere il codice più efficiente.
69 |
70 | 1. Chiedi di nuovo la complessità - è migliorata?
71 |
72 | #### Usa Copilot per generare commenti al codice
73 |
74 | 1. Evidenzia tutto il codice con Ctrl/Cmd+A.
75 |
76 | 1. Premi Ctrl/Cmd+I per aprire la chat inline.
77 |
78 | 1. Digita "/doc"
79 | 1. Chiedi a GitHub Copilot di documentare la funzione.
80 |
81 | #### Usa Copilot per semplificare il tuo codice
82 |
83 | 1. Apri la Chat di GitHub Copilot nella barra laterale.
84 |
85 | 1. Digita "/simplify" e premi Enter. Puoi anche aggiungere qualsiasi testo desideri dopo "/simplify" per dare più istruzioni a Copilot.
86 |
87 | 1. Cosa ha suggerito GitHub Copilot per semplificare il codice?
88 |
89 | #### Hai Errori?
90 |
91 | Anche la Chat di Copilot può aiutarti! Basta copiare il messaggio di errore e incollarlo in Chat. Spesso è tutto ciò di cui Copilot ha bisogno per risolvere il tuo problema.
--------------------------------------------------------------------------------
/Adventures/Ask/1-Beginner/it-IT/The-Magical-Forest-of-Algora-Ask.md:
--------------------------------------------------------------------------------
1 | ## La Foresta Magica di Algora: Avventura Modalità Ask
2 |
3 |
4 |
5 |
6 |
7 | ### Contesto
8 |
9 | Nel profondo dell'incantata Foresta di Algora, due creature mistiche, il Lox e il Faelis, eseguono una danza sacra ogni millennio. Questa danza non è solo una celebrazione, ma è un rituale per riportare l'equilibrio nella foresta.
10 |
11 | ### Obiettivo
12 |
13 | Il tuo compito è simulare la danza tra Lox e Faelis. Ogni creatura ha il suo insieme di mosse di danza, e la combinazione di mosse crea vari effetti magici nella foresta. Il tuo obiettivo è determinare lo stato della foresta dopo che la danza è completa.
14 |
15 | ### Specifiche
16 |
17 | 1. **Mosse di Danza ed Effetti:**
18 | - Ogni creatura può eseguire una delle tre mosse di danza: `Giro`, `Salto`, o `Ruota`.
19 | - La combinazione di mosse da entrambe le creature risulta in un effetto magico:
20 | - Giro + Giro = Le lucciole illuminano la foresta.
21 | - Salto + Ruota = Inizia a cadere una pioggia leggera.
22 | - Ruota + Salto = Un arcobaleno appare nel cielo.
23 | - Altre combinazioni creano diversi effetti che puoi immaginare.
24 |
25 | 2. **Dinamiche della Danza:**
26 | - Ogni effetto cambierà lo stato della foresta.
27 | - Alcuni effetti possono essere benefici, mentre altri possono essere dannosi.
28 |
29 | 3. **Sequenza di Danza:**
30 | - La danza consiste in 5 sequenze.
31 | - Devi mostrare lo stato della foresta dopo ogni sequenza.
32 |
33 | 4. **Mosse delle Creature:**
34 |
35 | **Mosse per Lox (Creatura 1)**
36 |
37 | | Sequenza 1 | Sequenza 2 | Sequenza 3 | Sequenza 4 | Sequenza 5 |
38 | |------------|------------|------------|------------|------------|
39 | | Giro | Salto | Ruota | Giro | Salto |
40 |
41 | **Mosse per Faelis (Creatura 2)**
42 | | Sequenza 1 | Sequenza 2 | Sequenza 3 | Sequenza 4 | Sequenza 5 |
43 | |------------|------------|------------|------------|------------|
44 | | Ruota | Giro | Salto | Salto | Ruota |
45 |
46 | 5. **Funzionalità Avanzate (se il tempo lo permette):**
47 | - Implementa un sistema che permette agli utenti di aggiungere nuove mosse di danza ed effetti.
48 | - Gli utenti possono selezionare la mossa di danza per ogni sequenza.
49 |
50 | ### Vincoli
51 |
52 | - Usa GitHub Copilot e scrivi la simulazione in qualsiasi linguaggio tu preferisca.
53 | - Concentrati su un codice chiaro e conciso che gestisca le dinamiche della danza in modo efficiente. Chiedi a GitHub Copilot/Chat, "Come posso rendere questo codice più leggibile e manutenibile?".
54 | - Creare una rappresentazione visiva per la danza e gli effetti è opzionale ma incoraggiato se hai tempo.
55 |
56 | ### Riassunto delle Attività di Alto Livello da Eseguire
57 |
58 | 1. Usa un'applicazione console per visualizzare l'output.
59 | 1. Inizializza lo stato della foresta.
60 | 1. Ogni creatura seleziona una mossa di danza per ogni sequenza.
61 | 1. Determina l'effetto delle mosse di danza combinate sulla foresta.
62 | 1. Aggiorna lo stato della foresta dopo ogni sequenza.
63 | 1. Mostra lo stato finale della foresta dopo che la danza è completa.
64 |
65 | ### Suggerimenti per Iniziare
66 |
67 | 1. Se stai usando un GitHub Codespace, sei pronto per andare!
68 | 1. Se stai eseguendo localmente, assicurati di avere installato il tuo linguaggio/framework di destinazione.
69 | - [Node.js](https://nodejs.org)
70 | - [Python](https://www.python.org/downloads/)
71 | - [.NET](https://dot.net)
72 | 1. Crea una cartella per il tuo codice.
73 | - JavaScript: Crea una cartella chiamata `algora` e aggiungi un file chiamato `app.js`.
74 | - Python: Crea una cartella chiamata `algora` e aggiungi un file chiamato `app.py`.
75 | - C#: Crea una cartella chiamata `algora` e esegui `dotnet new console`.
76 |
77 | ### Suggerimenti di GitHub Copilot
78 |
79 |
80 |
81 |
82 |
83 | #### Usa Copilot per migliorare l'efficienza
84 | Vedi se puoi usare Copilot per scoprire la complessità (notazione BigO) del codice.
85 |
86 | 1. Apri la [vista Chat di GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) nella barra laterale se non è già aperta. Assicurati che il tuo file di soluzione sia ancora aperto.
87 |
88 | 1. Chiedi a GitHub Copilot qual è la complessità del codice.
89 |
90 | 1. Chiedi a GitHub Copilot di rendere il codice più efficiente.
91 |
92 | 1. Chiedi di nuovo la complessità - è migliorata?
93 |
94 | #### Usa Copilot per generare commenti al codice
95 |
96 | 1. Evidenzia tutto il codice con Ctrl/Cmd+A.
97 |
98 | 1. Premi Ctrl/Cmd+I per aprire la chat inline.
99 |
100 | 1. Digita "/doc"
101 |
102 | 1. Chiedi a GitHub Copilot di documentare la funzione.
103 |
104 | #### Usa Copilot per semplificare il tuo codice
105 |
106 | 1. Apri la Chat di GitHub Copilot nella barra laterale.
107 |
108 | 1. Digita "/simplify" e premi Enter. Puoi anche aggiungere qualsiasi testo vuoi dopo il "/simplify" per dare più istruzioni a Copilot.
109 |
110 | 1. Cosa ha suggerito GitHub Copilot per renderlo più semplice?
111 |
112 | #### Hai Errori?
113 |
114 | Anche la Chat di Copilot può aiutare con quello! Basta copiare il messaggio di errore e incollarlo in Chat. Spesso è tutto ciò di cui Copilot ha bisogno per risolvere il tuo problema.
--------------------------------------------------------------------------------
/Adventures/Ask/2-Intermediate/The-Celestial-Alignment-of-Lumoria-Ask.md:
--------------------------------------------------------------------------------
1 | ## The Celestial Alignment of Lumoria: Ask Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the vast expanse of the Galaxia Nebulae, a rare phenomenon is about to occur in the Lumoria star system. The planets, revolving around the Lumorian Sun, are aligning in a celestial dance that happens only once every few millennia. This alignment has a unique effect on how the light from the Lumorian Sun reaches each planet.
10 |
11 | ### Objective
12 |
13 | Your task is to calculate the intensity of light each planet receives during this alignment. Given the distances of the planets from the Lumorian Sun and their relative positions, determine which planets might experience a decrease in light intensity due to other planets casting shadows on them.
14 |
15 | ### Specifications
16 |
17 | 1. **Planetary Data:**
18 |
19 | | Planet Name | Distance (AU) | Size (km) |
20 | |-------------|---------------|----------|
21 | | Mercuria | 0.4 | 4879 |
22 | | Earthia | 1 | 12742 |
23 | | Marsia | 1.5 | 6779 |
24 | | Venusia | 0.7 | 12104 |
25 |
26 | The planets aren't sorted by their distance from the Lumorian Sun so you'll need to handle that.
27 |
28 | 2. **Light Dynamics:**
29 | - If a smaller planet is behind a larger planet (relative to the Lumorian Sun), it will be in the shadow and will receive no light (`None`).
30 | - If a larger planet is behind a smaller planet (relative to the Lumorian Sun), it will have `Partial` light.
31 | - If a planet is in the shadow of multiple planets, it will be marked as `None (Multiple Shadows)`.
32 | - If two planets are of similar size and are near each other in alignment, they might partially eclipse each other, but for simplicity, you can consider them both to receive full light.
33 |
34 | 3. **Output:**
35 | - Your system should output a list of planets and the light intensity they receive: `Full`, `Partial`, `None`, or `None (Multiple Shadows)`.
36 |
37 | ### Constraints
38 |
39 | - Use GitHub Copilot and write the simulation in any language you'd like.
40 | - Focus on clear and concise code that handles planet checks efficiently. Ask GitHub Copilot/Chat, "How can I make this code more readable and maintainable?".
41 | - Creating a visual SVG representation for the planets is optional but encouraged if you have time.
42 |
43 | ### Summary of High-Level Tasks to Perform
44 |
45 | 1. Use a console application to render the output.
46 | 1. Sort the list of planets based on their distance from the Lumorian Sun.
47 | 1. Traverse the sorted list of planets.
48 | 1. For each planet, check the planets that are closer to the Lumorian Sun to see if they cast a shadow on other planets.
49 | 1. Output the light intensity each planet receives.
50 |
51 | ### Tips to Get Started
52 |
53 | 1. If you're using a GitHub Codespace, you're ready to go!
54 | 1. If running locally, ensure that you have your target language/framework installed.
55 | - [Node.js](https://nodejs.org)
56 | - [Python](https://www.python.org/downloads/)
57 | - [.NET](https://dot.net)
58 | 1. Create a folder for your code.
59 | - JavaScript: Create a folder called `lumoria` and add a file named `app.js`.
60 | - Python: Create a folder called `lumoria` and add a file named `app.py`.
61 | - C#: Create a folder called `lumoria` and run `dotnet new console`.
62 |
63 | ### GitHub Copilot Tips
64 |
65 |
66 |
67 |
68 |
69 | First, you're going to need to get the planets into a data structure that you can work with.
70 |
71 | 1. Copy the Markdown table shown earlier.
72 | 1. Open [GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) and enter the following text. Substitute your language of choice for "JavaScript".
73 |
74 | ```text
75 | turn this markdown list into a JavaScript array of objects
76 | ```
77 |
78 | 1. Paste the Markdown table under your comment and press ENTER
79 | 1. Insert the generated planets array into your code.
80 |
81 | ```js
82 | // light intensity array
83 |
84 | // traverse the sorted array
85 |
86 | // create an object to track the count of Larger and Smaller planets that are closer to the sun than the current planet
87 |
88 | // for all the planets that come before this planet in the planets array, increment Larger if they are larger than the current planet or Smaller if they are smaller than the current planet
89 |
90 | // if count.larger === 0 and count.smaller === 0 push planet name and "Full" to lightIntensity
91 |
92 | // if count.smaller > 0 and count.larger === 0 push planet name and "Partial" to lightIntensity
93 |
94 | // if count.larger === 1 push planet name and "None" to lightIntensity
95 |
96 | // if count.larger > 1 push planet name and "None (Multiple Shadows)" to lightIntensity
97 |
98 | // print the lightIntensity array
99 | ```
100 |
101 | #### Use Copilot to improve efficiency
102 |
103 | See if you can use Copilot to find out the complexity (BigO notation) of the code.
104 |
105 | 1. Open [GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) in the sidebar if it's not already open. Make sure your solution file is still open as well.
106 |
107 | 1. Ask GitHub Copilot what the complexity of the code is.
108 |
109 | 1. Ask GitHub Copilot to make the code more efficient.
110 |
111 | 1. Ask for the complexity again - is it better?
112 |
113 | #### Use Copilot to generate code comments
114 |
115 | 1. Highlight all of the code with Ctrl/Cmd+A.
116 |
117 | 1. Press Ctrl/Cmd+I to open the inline chat.
118 |
119 | 1. Type "/doc"
120 |
121 | 1. Ask GitHub Copilot to document the function.
122 |
123 | #### Use Copilot to simplify your code
124 |
125 | 1. Open GitHub Copilot in the sidebar.
126 |
127 | 1. Type "/simplify" and press Enter. You can also add any text you want after the "/simplify" to give Copilot more instructions.
128 |
129 | 1. What did GitHub Copilot suggest you do to make it simpler?
130 |
131 | #### Got Errors?
132 |
133 | GitHub Copilot can help with that too! Just copy the error message and paste it into the chat. Often that's all Copilot needs to resolve your issue.
--------------------------------------------------------------------------------
/Adventures/Ask/2-Intermediate/The-Legendary-Duel-of-Stonevale-Ask.md:
--------------------------------------------------------------------------------
1 | ## The Legendary Duel of Stonevale: Ask Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the mystical realm of Stonevale, two warriors, Rok and Papyra, are chosen for a duel that determines the fate of their tribes for the next century. The arena, known as Scissoria, is where each move carries weight and consequences.
10 |
11 | ### Objective
12 |
13 | Your task is to simulate the duel between Rok and Papyra. Each warrior makes a series of moves, and each move has a specific outcome. To win the duel, a warrior must accumulate the highest score over a series of rounds.
14 |
15 | ### Specifications
16 |
17 | 1. **Moves and Points:**
18 | - Each warrior can make one of three moves: rock, paper, or scissors.
19 | - A rock win = 1 point
20 | - A paper win = 2 points
21 | - A scissors win = 3 points
22 |
23 | 1. **Duel Dynamics:**
24 | - When both warriors choose the same move, it's a draw, and no points are awarded.
25 | - Rock crushes scissors, paper covers rock, and scissors cut paper.
26 | - Points are awarded based on the winning move.
27 |
28 | 1. **Gameplay:**
29 | - The duel consists of 5 rounds.
30 | - The goal is to accumulate the highest score over these rounds to win the duel.
31 |
32 | 1. **Player Moves:**
33 |
34 | **Moves for Rok (Player 1)**
35 |
36 | | Round 1 | Round 2 | Round 3 | Round 4 | Round 5 |
37 | |---------|---------|---------|---------|---------|
38 | | scissors | paper | scissors| rock | rock |
39 |
40 | **Moves for Paprya (Player 2)**
41 |
42 | | Round 1 | Round 2 | Round 3 | Round 4 | Round 5 |
43 | |---------|---------|---------|---------|---------|
44 | | rock | rock | paper | scissors| paper |
45 |
46 |
47 | 1. **Advanced Features (if time permits):**
48 | - Implement a hint system that suggests a move to the player.
49 | - Players can select their move for each round rather than it being automated.
50 |
51 | ### Constraints
52 |
53 | - Write the simulation using GitHub Copilot and any language you choose. Try learning a new language if you're up for the challenge!
54 | - Ensure efficient algorithms to handle the duel dynamics. Ask GitHub Copilot/Chat, "How can I make this code more readable and maintainable?".
55 | - Providing a graphical user interface for the simulation is optional.
56 |
57 | ### Summary of High-Level Tasks to Perform
58 |
59 | 1. Use a console application to render the output.
60 | 1. Initialize scores for both warriors.
61 | 1. Each warrior selects a move for each round.
62 | 1. Determine the winner of each round and award the points.
63 | 1. Tally the scores after 5 rounds.
64 | 1. Declare the overall winner of the duel.
65 |
66 | ### Tips to Get Started
67 |
68 | 1. If you're using a GitHub Codespace, you're ready to go!
69 | 1. If running locally, ensure that you have your target language/framework installed.
70 | - [Node.js](https://nodejs.org)
71 | - [Python](https://www.python.org/downloads/)
72 | - [.NET](https://dot.net)
73 | 1. Create a folder for your code.
74 | - JavaScript: Create a folder called `stonevale` and add a file named `app.js`.
75 | - Python: Create a folder called `stonevale` and add a file named `app.py`.
76 | - C#: Create a folder called `stonevale` and run `dotnet new console`.
77 |
78 | ### GitHub Copilot Tips
79 |
80 |
81 |
82 |
83 |
84 | #### Use Copilot to improve efficiency
85 |
86 | See if you can use Copilot to find out the complexity (BigO notation) of the code.
87 |
88 | 1. Open [GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) in the sidebar if it's not already open. Make sure your solution file is still open as well.
89 |
90 | 1. Ask GitHub Copilot what the complexity of the code is.
91 |
92 | 1. Ask GitHub Copilot to make the code more efficient.
93 |
94 | 1. Ask for the complexity again - is it better?
95 |
96 | #### Use Copilot to generate code comments
97 |
98 | 1. Highlight all of the code with Ctrl/Cmd+A.
99 |
100 | 1. Press Ctrl/Cmd+I to open the inline chat.
101 |
102 | 1. Type "/doc"
103 |
104 | 1. Ask GitHub Copilot to document the function.
105 |
106 | #### Use Copilot to simplify your code
107 |
108 | 1. Open GitHub Copilot in the sidebar.
109 |
110 | 1. Type "/simplify" and press Enter. You can also add any text you want after the "/simplify" to give Copilot more instructions.
111 |
112 | 1. What did GitHub Copilot suggest you do to make it simpler?
113 |
114 | #### Got Errors?
115 |
116 | GitHub Copilot can help with that too! Just copy the error message and paste it into the chat. Often that's all Copilot needs to resolve your issue.
--------------------------------------------------------------------------------
/Adventures/Ask/2-Intermediate/The-Scrolls-of-Eldoria-Ask.md:
--------------------------------------------------------------------------------
1 | ## The Scrolls of Eldoria: Ask Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | ### Background
8 |
9 | In the enchanted land of Eldoria, ancient scrolls contain the secrets of the universe. These scrolls, however, were scattered and protected by the Elders using powerful spells. These spells concealed the secrets within the scrolls, adding layers of misleading information to deter prying eyes. Over time, these scrolls were digitized and stored in the Great Eldorian Library, accessible only through the Eldorian Web of Knowledge.
10 |
11 | ### Objective
12 |
13 | You, a young sorcerer's apprentice, have been given the task to retrieve and decipher one such scroll. The scroll is stored as a file on the Eldorian Web of Knowledge. You have to make an HTTP call to fetch the scroll's content. However, the Elders' misleading information must be filtered out using the ancient method of Regular Expressions to reveal the true secrets within.
14 |
15 | ### Specifications
16 |
17 | 1. **Data Retrieval:**
18 | - Use the magical HTTP call to fetch the scroll's content. You'll find the scroll in the Great Eldorian Library's `https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt` location.
19 | - The content will be in text format.
20 |
21 | 2. **Deciphering the Scroll:**
22 | - The scroll contains both the Elders' secrets and misleading information.
23 | - The true secrets have a specific pattern: they are always surrounded by the symbols `{*` and `*}`.
24 | - Extract all the true secrets from the scroll.
25 |
26 | 3. **Output:**
27 | - Display the extracted secrets in a structured manner.
28 | - Ensure that no misleading information is displayed.
29 |
30 | ### Constraints
31 |
32 | - Write the simulation using GitHub Copilot and any language you choose. Try learning a new language if you're up for the challenge!
33 | - Ensure efficient algorithms to handle text retrieval and extraction. Ask GitHub Copilot/Chat, "How can I make this code more readable and maintainable?".
34 |
35 | ### Summary of High-Level Tasks to Perform
36 |
37 | 1. Use a console application to render the output.
38 | 1. Make an HTTP call to retrieve the content of the scroll.
39 | 1. Use a regular expression to filter out the misleading information and extract the true secrets.
40 | 1. Display the extracted secrets.
41 |
42 | ### Tips to Get Started
43 |
44 | 1. If you're using a GitHub Codespace, you're ready to go!
45 | 1. If running locally, ensure that you have your target language/framework installed.
46 | - [Node.js](https://nodejs.org)
47 | - [Python](https://www.python.org/downloads/)
48 | - [.NET](https://dot.net)
49 | 1. Create a folder for your code.
50 | - JavaScript: Create a folder called `eldoria` and add a file named `app.js`.
51 | - Python: Create a folder called `eldoria` and add a file named `app.py`.
52 | - C#: Create a folder called `eldoria` and run `dotnet new console`.
53 |
54 | ### GitHub Copilot Tips
55 |
56 |
57 |
58 |
59 |
60 | #### Use Copilot to improve efficiency
61 |
62 | See if you can use Copilot to find out the complexity (BigO notation) of the code.
63 |
64 | 1. Open [GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) in the sidebar if it's not already open. Make sure your solution file is still open as well.
65 |
66 | 1. Ask GitHub Copilot what the complexity of the code is.
67 |
68 | 1. Ask GitHub Copilot to make the code more efficient.
69 |
70 | 1. Ask for the complexity again - is it better?
71 |
72 | #### Use Copilot to generate code comments
73 |
74 | 1. Highlight all of the code with Ctrl/Cmd+A.
75 |
76 | 1. Press Ctrl/Cmd+I to open the inline chat.
77 |
78 | 1. Type "/doc"
79 |
80 | 1. Ask GitHub Copilot to document the function.
81 |
82 | #### Use Copilot to simplify your code
83 |
84 | 1. Open GitHub Copilot in the sidebar.
85 |
86 | 1. Type "/simplify" and press Enter. You can also add any text you want after the "/simplify" to give Copilot more instructions.
87 |
88 | 1. What did GitHub Copilot suggest you do to make it simpler?
89 |
90 | #### Got Errors?
91 |
92 | GitHub Copilot can help with that too! Just copy the error message and paste it into the chat. Often that's all Copilot needs to resolve your issue.
--------------------------------------------------------------------------------
/Adventures/Ask/2-Intermediate/it-IT/The-Celestial-Alignment-of-Lumoria-Ask.md:
--------------------------------------------------------------------------------
1 | ## L'Allineamento Celeste di Lumoria: Avventura Modalità Ask
2 |
3 |
4 |
5 |
6 |
7 | ### Contesto
8 |
9 | Nell'immensa distesa della Nebulosa Galaxia, sta per verificarsi un raro fenomeno nel sistema stellare di Lumoria. I pianeti, che ruotano attorno al Sole Lumoriano, si stanno allineando in una danza celeste che si verifica solo una volta ogni pochi millenni. Questo allineamento ha un effetto unico su come la luce del Sole Lumoriano raggiunge ogni pianeta.
10 |
11 | ### Obiettivo
12 |
13 | Il tuo compito è calcolare l'intensità della luce che ogni pianeta riceve durante questo allineamento. Dati le distanze dei pianeti dal Sole Lumoriano e le loro posizioni relative, determina quali pianeti potrebbero sperimentare una diminuzione dell'intensità della luce a causa delle ombre proiettate su di essi da altri pianeti.
14 |
15 | ### Specifiche
16 |
17 | 1. **Dati Planetari:**
18 |
19 |
20 | | Nome del Pianeta | Distanza (UA) | Dimensione (km) |
21 | | ------------------ | --------------- | ----------------- |
22 | | Mercuria | 0.4 | 4879 |
23 | | Earthia | 1 | 12742 |
24 | | Marsia | 1.5 | 6779 |
25 | | Venusia | 0.7 | 12104 |
26 |
27 | I pianeti non sono ordinati per la loro distanza dal Sole Lumoriano, quindi dovrai gestire questo.
28 |
29 | 2. **Dinamiche della Luce:**
30 |
31 | - Se un pianeta più piccolo si trova dietro a un pianeta più grande (rispetto al Sole Lumoriano), sarà in ombra e non riceverà luce (`Nessuna`).
32 | - Se un pianeta più grande si trova dietro a un pianeta più piccolo (rispetto al Sole Lumoriano), avrà luce `Parziale`.
33 | - Se un pianeta è in ombra di più pianeti, sarà contrassegnato come `Nessuna (Ombre Multiple)`.
34 | - Se due pianeti sono di dimensioni simili e si trovano vicini l'uno all'altro in allineamento, potrebbero eclissarsi parzialmente l'un l'altro, ma per semplicità, puoi considerare che entrambi ricevano luce piena.
35 |
36 | 3. **Output:**
37 | - Il tuo sistema dovrebbe produrre un elenco di pianeti e l'intensità della luce che ricevono: `Piena`, `Parziale`, `Nessuna`, o `Nessuna (Ombre Multiple)`.
38 |
39 | ### Vincoli
40 |
41 | - Usa GitHub Copilot e scrivi la simulazione in qualsiasi linguaggio tu preferisca.
42 | - Concentrati su un codice chiaro e conciso che gestisca i controlli dei pianeti in modo efficiente. Chiedi a GitHub Copilot/Chat, "Come posso rendere questo codice più leggibile e manutenibile?".
43 | - Creare una rappresentazione SVG visuale per i pianeti è opzionale ma incoraggiata se hai tempo.
44 |
45 | ### Riassunto delle Attività di Alto Livello da Eseguire
46 |
47 | 1. Usa un'applicazione console per visualizzare l'output.
48 | 2. Ordina l'elenco dei pianeti in base alla loro distanza dal Sole Lumoriano.
49 | 3. Attraversa l'elenco ordinato dei pianeti.
50 | 4. Per ogni pianeta, controlla i pianeti che sono più vicini al Sole Lumoriano per vedere se proiettano un'ombra su altri pianeti.
51 | 5. Mostra l'intensità della luce che ogni pianeta riceve.
52 |
53 | ### Suggerimenti per Iniziare
54 |
55 | 1. Se stai usando un GitHub Codespace, sei pronto per partire!
56 | 2. Se stai eseguendo localmente, assicurati di avere installato il tuo linguaggio/framework di destinazione.
57 | - [Node.js](https://nodejs.org)
58 | - [Python](https://www.python.org/downloads/)
59 | - [.NET](https://dot.net)
60 | 3. Crea una cartella per il tuo codice.
61 | - JavaScript: Crea una cartella chiamata `lumoria` e aggiungi un file chiamato `app.js`.
62 | - Python: Crea una cartella chiamata `lumoria` e aggiungi un file chiamato `app.py`.
63 | - C#: Crea una cartella chiamata `lumoria` e esegui `dotnet new console`.
64 |
65 | ### Suggerimenti di GitHub Copilot
66 |
67 |
68 |
69 |
70 |
71 | Prima di tutto, dovrai inserire i pianeti in una struttura dati con cui puoi lavorare.
72 |
73 | 1. Copia la tabella Markdown mostrata in precedenza.
74 | 2. Apri la [vista Chat di GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) e inserisci il seguente testo. Sostituisci il tuo linguaggio di scelta con "JavaScript".
75 |
76 | ```text
77 | trasforma questo elenco markdown in un array di oggetti JavaScript
78 | ```
79 | 3. Incolla la tabella Markdown sotto il tuo commento e premi INVIO
80 | 4. Inserisci l'array di pianeti generato nel tuo codice
81 |
82 | ```js
83 | // light intensity array
84 |
85 | // traverse the sorted array
86 |
87 | // create an object to track the count of Larger and Smaller planets that are closer to the sun than the current planet
88 |
89 | // for all the planets that come before this planet in the planets array, increment Larger if they are larger than the current planet or Smaller if they are smaller than the current planet
90 |
91 | // if count.larger === 0 and count.smaller === 0 push planet name and "Full" to lightIntensity
92 |
93 | // if count.smaller > 0 and count.larger === 0 push planet name and "Partial" to lightIntensity
94 |
95 | // if count.larger === 1 push planet name and "None" to lightIntensity
96 |
97 | // if count.larger > 1 push planet name and "None (Multiple Shadows)" to lightIntensity
98 |
99 | // print the lightIntensity array
100 | ```
101 |
102 | #### Usa Copilot per migliorare l'efficienza
103 |
104 | Vedi se puoi usare Copilot per scoprire la complessità (notazione BigO) del codice.
105 |
106 | 1. Apri la [vista Chat di GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) nella barra laterale se non è già aperta. Assicurati che il tuo file di soluzione sia ancora aperto.
107 | 2. Chiedi a GitHub Copilot qual è la complessità del codice.
108 | 3. Chiedi a GitHub Copilot di rendere il codice più efficiente.
109 | 4. Chiedi di nuovo la complessità - è migliorata?
110 |
111 | #### Usa Copilot per generare commenti al codice
112 |
113 | 1. Evidenzia tutto il codice con Ctrl/Cmd+A.
114 | 2. Premi Ctrl/Cmd+I per aprire la chat inline.
115 | 3. Digita "/doc"
116 | 4. Chiedi a GitHub Copilot di documentare la funzione.
117 |
118 | #### Usa Copilot per semplificare il tuo codice
119 |
120 | 1. Apri la Chat di GitHub Copilot nella barra laterale.
121 | 2. Digita "/simplify" e premi Enter. Puoi anche aggiungere qualsiasi testo desideri dopo "/simplify" per dare più istruzioni a Copilot.
122 | 3. Cosa ti ha suggerito GitHub Copilot per semplificarlo?
123 |
124 | #### Hai errori?
125 |
126 | Anche la Chat di Copilot può aiutarti! Basta copiare il messaggio di errore e incollarlo in Chat. Spesso è tutto ciò di cui Copilot ha bisogno per risolvere il tuo problema
127 |
--------------------------------------------------------------------------------
/Adventures/Ask/2-Intermediate/it-IT/The-Legendary-Duel-of-Stonevale-Ask.md:
--------------------------------------------------------------------------------
1 | ## Il Leggendario Duello di Stonevale: Avventura Modalità Ask
2 |
3 |
4 |
5 |
6 |
7 | ### Contesto
8 |
9 | Nel mistico regno di Stonevale, due guerrieri, Rok e Papyra, sono scelti per un duello che determina il destino delle loro tribù per il prossimo secolo. L'arena, conosciuta come Scissoria, è il luogo in cui ogni mossa ha peso e conseguenze.
10 |
11 | ### Obiettivo
12 |
13 | Il tuo compito è simulare il duello tra Rok e Papyra. Ogni guerriero fa una serie di mosse, e ogni mossa ha un esito specifico. Per vincere il duello, un guerriero deve accumulare il punteggio più alto in una serie di round.
14 |
15 | ### Specifiche
16 |
17 | 1. **Mosse e Punti:**
18 | - Ogni guerriero può fare una delle tre mosse: sasso, carta o forbici.
19 | - Una vittoria con il sasso = 1 punto
20 | - Una vittoria con la carta = 2 punti
21 | - Una vittoria con le forbici = 3 punti
22 |
23 | 1. **Dinamiche del Duello:**
24 | - Quando entrambi i guerrieri scelgono la stessa mossa, è un pareggio e non vengono assegnati punti.
25 | - Il sasso schiaccia le forbici, la carta copre il sasso, e le forbici tagliano la carta.
26 | - I punti vengono assegnati in base alla mossa vincente.
27 |
28 | 1. **Modalità di Gioco:**
29 | - Il duello consiste in 5 round.
30 | - L'obiettivo è accumulare il punteggio più alto in questi round per vincere il duello.
31 |
32 | 1. **Mosse dei Giocatori:**
33 |
34 | **Mosse per Rok (Giocatore 1)**
35 |
36 | | Round 1 | Round 2 | Round 3 | Round 4 | Round 5 |
37 | |---------|---------|---------|---------|---------|
38 | | forbici | carta | forbici| sasso | sasso |
39 |
40 | **Mosse per Papyra (Giocatore 2)**
41 |
42 | | Round 1 | Round 2 | Round 3 | Round 4 | Round 5 |
43 | |---------|---------|---------|---------|---------|
44 | | sasso | sasso | carta | forbici| carta |
45 |
46 |
47 | 1. **Funzionalità Avanzate (se il tempo lo permette):**
48 | - Implementa un sistema di suggerimenti che suggerisce una mossa al giocatore.
49 | - I giocatori possono selezionare la loro mossa per ogni round invece che essere automatizzata.
50 |
51 | ### Vincoli
52 |
53 | - Scrivi la simulazione usando GitHub Copilot e qualsiasi linguaggio tu scelga. Prova a imparare un nuovo linguaggio se sei pronto per la sfida!
54 | - Assicurati di utilizzare algoritmi efficienti per gestire le dinamiche del duello. Chiedi a GitHub Copilot/Chat, "Come posso rendere questo codice più leggibile e manutenibile?".
55 | - Fornire un'interfaccia grafica per la simulazione è opzionale.
56 |
57 | ### Riassunto delle Attività di Alto Livello da Eseguire
58 |
59 | 1. Usa un'applicazione console per visualizzare l'output.
60 | 1. Inizializza i punteggi per entrambi i guerrieri.
61 | 1. Ogni guerriero seleziona una mossa per ogni round.
62 | 1. Determina il vincitore di ogni round e assegna i punti.
63 | 1. Tally i punteggi dopo 5 round.
64 | 1. Dichiarare il vincitore generale del duello.
65 |
66 | ### Suggerimenti per Iniziare
67 |
68 | 1. Se stai usando un GitHub Codespace, sei pronto per andare!
69 | 1. Se stai eseguendo localmente, assicurati di avere installato il tuo linguaggio/framework di destinazione.
70 | - [Node.js](https://nodejs.org)
71 | - [Python](https://www.python.org/downloads/)
72 | - [.NET](https://dot.net)
73 | 1. Crea una cartella per il tuo codice.
74 | - JavaScript: Crea una cartella chiamata `stonevale` e aggiungi un file chiamato `app.js`.
75 | - Python: Crea una cartella chiamata `stonevale` e aggiungi un file chiamato `app.py`.
76 | - C#: Crea una cartella chiamata `stonevale` e esegui `dotnet new console`.
77 |
78 | ### Suggerimenti per GitHub Copilot
79 |
80 |
81 |
82 |
83 |
84 | #### Usa Copilot per migliorare l'efficienza
85 |
86 | Vedi se puoi usare Copilot per scoprire la complessità (notazione BigO) del codice.
87 |
88 | 1. Apri la [vista Chat di GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) nella barra laterale se non è già aperta. Assicurati che il tuo file di soluzione sia ancora aperto.
89 | 2. Chiedi a GitHub Copilot qual è la complessità del codice.
90 | 3. Chiedi a GitHub Copilot di rendere il codice più efficiente.
91 | 4. Chiedi di nuovo la complessità - è migliorata?
92 |
93 | #### Usa Copilot per generare commenti al codice
94 |
95 | 1. Evidenzia tutto il codice con Ctrl/Cmd+A.
96 | 2. Premi Ctrl/Cmd+I per aprire la chat inline.
97 | 3. Digita "/doc"
98 | 4. Chiedi a GitHub Copilot di documentare la funzione.
99 |
100 | #### Usa Copilot per semplificare il tuo codice
101 |
102 | 1. Apri la Chat di GitHub Copilot nella barra laterale.
103 | 2. Digita "/simplify" e premi Enter. Puoi anche aggiungere qualsiasi testo desideri dopo "/simplify" per dare più istruzioni a Copilot.
104 | 3. Cosa ti ha suggerito GitHub Copilot per semplificarlo?
105 |
106 | #### Hai errori?
107 |
108 | Anche la Chat di Copilot può aiutarti! Basta copiare il messaggio di errore e incollarlo in Chat. Spesso è tutto ciò di cui Copilot ha bisogno per risolvere il tuo problema.
--------------------------------------------------------------------------------
/Adventures/Ask/2-Intermediate/it-IT/The-Scrolls-of-Eldoria-Ask.md:
--------------------------------------------------------------------------------
1 | ## I Rotoli di Eldoria: Avventura Modalità Ask
2 |
3 |
4 |
5 |
6 |
7 | ### Contesto
8 |
9 | Nell'incantata terra di Eldoria, antichi rotoli contengono i segreti dell'universo. Questi rotoli, tuttavia, sono stati dispersi e protetti dagli Anziani usando potenti incantesimi. Questi incantesimi hanno nascosto i segreti nei rotoli, aggiungendo strati di informazioni fuorvianti per scoraggiare gli occhi indiscreti. Nel tempo, questi rotoli sono stati digitalizzati e conservati nella Grande Biblioteca di Eldoria, accessibile solo attraverso la Rete del Sapere di Eldoria.
10 |
11 | ### Obiettivo
12 |
13 | Tu, un giovane apprendista stregone, hai ricevuto il compito di recuperare e decifrare uno di questi rotoli. Il rotolo è conservato come file sulla Rete del Sapere di Eldoria. Devi fare una chiamata HTTP per recuperare il contenuto del rotolo. Tuttavia, le informazioni fuorvianti degli Anziani devono essere filtrate usando l'antico metodo delle Espressioni Regolari per rivelare i veri segreti contenuti.
14 |
15 | ### Specifiche
16 |
17 | 1. **Recupero dei Dati:**
18 | - Usa la magica chiamata HTTP per recuperare il contenuto del rotolo. Troverai il rotolo nella posizione `https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt` della Grande Biblioteca di Eldoria.
19 | - Il contenuto sarà in formato di testo.
20 |
21 | 2. **Decifrare il Rotolo:**
22 | - Il rotolo contiene sia i segreti degli Anziani che le informazioni fuorvianti.
23 | - I veri segreti hanno un modello specifico: sono sempre circondati dai simboli `{*` e `*}`.
24 | - Estrai tutti i veri segreti dal rotolo.
25 |
26 | 3. **Output:**
27 | - Visualizza i segreti estratti in modo strutturato.
28 | - Assicurati che non vengano visualizzate informazioni fuorvianti.
29 |
30 | ### Vincoli
31 |
32 | - Scrivi la simulazione usando GitHub Copilot e qualsiasi linguaggio tu scelga. Prova a imparare un nuovo linguaggio se sei pronto per la sfida!
33 | - Assicurati di utilizzare algoritmi efficienti per gestire il recupero del testo e l'estrazione. Chiedi a GitHub Copilot/Chat, "Come posso rendere questo codice più leggibile e manutenibile?".
34 |
35 | ### Riassunto delle Attività di Alto Livello da Eseguire
36 |
37 | 1. Usa un'applicazione console per visualizzare l'output.
38 | 1. Fai una chiamata HTTP per recuperare il contenuto del rotolo.
39 | 1. Usa un'espressione regolare per filtrare le informazioni fuorvianti ed estrarre i veri segreti.
40 | 1. Visualizza i segreti estratti.
41 |
42 | ### Suggerimenti per Iniziare
43 |
44 | 1. Se stai usando un GitHub Codespace, sei pronto per andare!
45 | 1. Se stai eseguendo localmente, assicurati di avere installato il tuo linguaggio/framework di destinazione.
46 | - [Node.js](https://nodejs.org)
47 | - [Python](https://www.python.org/downloads/)
48 | - [.NET](https://dot.net)
49 | 1. Crea una cartella per il tuo codice.
50 | - JavaScript: Crea una cartella chiamata `eldoria` e aggiungi un file chiamato `app.js`.
51 | - Python: Crea una cartella chiamata `eldoria` e aggiungi un file chiamato `app.py`.
52 | - C#: Crea una cartella chiamata `eldoria` e esegui `dotnet new console`.
53 |
54 | ### Suggerimenti per GitHub Copilot
55 |
56 |
57 |
58 |
59 |
60 | #### Usa Copilot per migliorare l'efficienza
61 |
62 | Vedi se puoi usare Copilot per scoprire la complessità (notazione BigO) del codice.
63 |
64 | 1. Apri la [vista Chat di GitHub Copilot](https://docs.github.com/en/copilot/github-copilot-chat/using-github-copilot-chat#asking-your-first-question) nella barra laterale se non è già aperta. Assicurati che il tuo file di soluzione sia ancora aperto.
65 | 2. Chiedi a GitHub Copilot qual è la complessità del codice.
66 | 3. Chiedi a GitHub Copilot di rendere il codice più efficiente.
67 | 4. Chiedi di nuovo la complessità - è migliorata?
68 |
69 | #### Usa Copilot per generare commenti al codice
70 |
71 | 1. Evidenzia tutto il codice con Ctrl/Cmd+A.
72 | 2. Premi Ctrl/Cmd+I per aprire la chat inline.
73 | 3. Digita "/doc"
74 | 4. Chiedi a GitHub Copilot di documentare la funzione.
75 |
76 | #### Usa Copilot per semplificare il tuo codice
77 |
78 | 1. Apri la Chat di GitHub Copilot nella barra laterale.
79 | 2. Digita "/simplify" e premi Enter. Puoi anche aggiungere qualsiasi testo desideri dopo "/simplify" per dare più istruzioni a Copilot.
80 | 3. Cosa ti ha suggerito GitHub Copilot per semplificarlo?
81 |
82 | #### Hai errori?
83 |
84 | Anche la Chat di Copilot può aiutarti! Basta copiare il messaggio di errore e incollarlo in Chat. Spesso è tutto ciò di cui Copilot ha bisogno per risolvere il tuo problema.
--------------------------------------------------------------------------------
/Adventures/Ask/Warmup-Adventure-Ask.it-IT.md:
--------------------------------------------------------------------------------
1 | ## Avventura di riscaldamento di GitHub Copilot: Avventura Modalità Ask
2 |
3 |
4 |
5 |
6 |
7 | GitHub Copilot è uno strumento basato sull' AI che ti aiuta a scrivere un codice migliore. In questa avventura di riscaldamento avrai l'opportunità di conoscere Copilot e provarlo da solo. Ecco alcune cose che puoi fare con GitHub Copilot:
8 |
9 | - Converti i commenti in codice. Hai bisogno di fare una chiamata HTTP, filtrare un array o eseguire un altro compito? Scrivi un commento e Copilot lo convertirà in codice per te.
10 | - Crea un'interfaccia utente. Usa HTML/CSS/JavaScript puro o una libreria/framework a tua scelta.
11 | - Crea query SQL.
12 | - Crea unit test.
13 | - Scrivi codice in un nuovo linguaggio.
14 | - Spiega il codice su cui stai lavorando.
15 | - E altro ancora!
16 |
17 | Se sei completamente nuovo a GitHub Copilot, guarda questo video per saperne di più sui vantaggi che può portare al tuo flusso di lavoro di sviluppo. Una volta che hai guardato il video, torna qui e scegli un'avventura per iniziare.
18 |
19 | [](https://www.youtube.com/watch?v=Dlt-DCLHnxM)
20 |
21 | ## Iniziare: Installazione dell'estensione GitHub Copilot
22 |
23 | Segui i passaggi seguenti per installare l'estensione GitHub Copilot in Visual Studio o Visual Studio Code.
24 |
25 | 1. Installa [Visual Studio](https://visualstudio.microsoft.com/) o [Visual Studio Code](https://code.visualstudio.com/) se non lo hai già.
26 |
27 | 1. Installa GitHub Copilot seguendo i passaggi su https://docs.github.com/en/copilot/getting-started-with-github-copilot.
28 |
29 | ## E se non ho una licenza GitHub Copilot?
30 |
31 | **Sei uno studente?** Scopri di più su come [configurare e accedere a GitHub Copilot qui](https://techcommunity.microsoft.com/t5/educator-developer-blog/step-by-step-setting-up-github-student-and-github-copilot-as-an/ba-p/3736279).
32 |
33 | Se attualmente non hai una licenza GitHub Copilot, puoi:
34 |
35 | - [Iscriviti per una prova gratuita](https://github.com/login?return_to=%2fgithub-copilot%2fsignup).
36 |
37 |
38 | ## La tua prima avventura: La Camera degli Echi
39 |
40 | Iniziamo con la tua prima avventura!
41 |
42 |
43 |
44 |
45 |
46 | ### Contesto:
47 |
48 | Sulla collina più alta, con vista sul regno, si erge il maestoso Castello Echo. All'interno delle sue mura di pietra si trova una camera conosciuta come la Stanza dell'Eco. Questa camera, a differenza di qualsiasi altra, ha il potere mistico di fare eco ai numeri a chiunque entri. Tuttavia, la Stanza dell'Eco non fa eco a qualsiasi numero; fa sempre eco al numero successivo in una sequenza.
49 |
50 | Le leggende raccontano di un mago che ha incantato questa camera per mettere alla prova l'intelletto dei visitatori. La stanza farebbe eco ai numeri in sequenza, e solo quelli che potevano prevedere il prossimo eco erano considerati degni dei tesori nascosti del castello.
51 |
52 | ### Obiettivo:
53 |
54 | Il tuo compito è entrare nella Stanza dell'Eco e ascoltare la sua sequenza, poi prevedere il prossimo numero che farà eco. Ti sono stati forniti una serie di numeri che la stanza ha fatto eco in passato. Usa questi numeri per determinare il prossimo nella sequenza.
55 |
56 | ### Specifiche:
57 |
58 | 1. **Input**:
59 | - Una lista di almeno tre numeri che formano una sequenza. Questa lista rappresenta i numeri che la stanza ha fatto eco in passato.
60 |
61 | 2. **Output**:
62 | - Un singolo numero che rappresenta il prossimo numero nella sequenza.
63 |
64 | 3. **Presupposti**:
65 | - La sequenza sarà sempre una progressione aritmetica (La differenza tra i numeri consecutivi è costante).
66 |
67 | ### Dati di esempio:
68 |
69 | Considera la sequenza: [3, 6, 9, 12]
70 |
71 | Il prossimo numero fatto eco dalla stanza dovrebbe essere: 15
72 |
73 | ### Vincoli:
74 |
75 | - La seguente soluzione utilizza JavaScript e Node.js, ma puoi usare Copilot per scrivere il codice in un altro linguaggio se preferisci.
76 |
77 | ### Riassunto delle attività ad alto livello da eseguire:
78 |
79 | 1. Usa un'applicazione console per visualizzare l'output.
80 | 1. Crea una costante per contenere la sequenza numerica fornita.
81 | 1. Determina la differenza comune tra i numeri consecutivi.
82 | 1. Prevedi il prossimo numero nella sequenza utilizzando il modello identificato.
83 |
84 | ### Passaggi di GitHub Copilot
85 |
86 | Questa soluzione utilizza JavaScript e [Node.js](https://nodejs.org). Sentiti libero di usare un altro linguaggio/framework se preferisci.
87 |
88 | 1. Crea un file chiamato `echo-chamber.js` in una cartella a tua scelta.
89 |
90 | 1. Aggiungi una `const` chiamata `echoes` per contenere la sequenza numerica nel file:
91 |
92 | ```js
93 | const echoes = [3, 6, 9, 12];
94 | ```
95 |
96 | 1. Digita il seguente codice dopo la costante `echoes`. Copilot dovrebbe suggerire il codice per aiutarti a determinare la differenza tra i numeri consecutivi nella sequenza.
97 |
98 | ```js
99 | function predictNext(echoes) {
100 | ```
101 |
102 | 1. Per accettare il suggerimento, premi Tab. Dovrebbe essere aggiunto il seguente corpo di funzione. Nota che potresti vedere un suggerimento di codice diverso.
103 |
104 | ```js
105 | function predictNext(echoes) {
106 | let difference = echoes[1] - echoes[0];
107 | let next = echoes[echoes.length - 1] + difference;
108 | return next;
109 | }
110 | ```
111 |
112 | 1. Inserisci una nuova riga dopo la funzione e Copilot dovrebbe suggerire un codice simile al seguente. Se non lo fa, inizia a digitare `console.log`. Per accettare il suggerimento, premi Tab.
113 |
114 | ```js
115 | console.log(predictNext(echoes));
116 | ```
117 |
118 | 1. Sposta il cursore sopra la funzione `predictNext` e seleziona CTRL + i (Windows) o CMD + i (Mac).
119 |
120 | 1. Inserisci `/doc` nella casella di testo che appare e premi Enter. Dovresti vedere un commento generato per la funzione.
121 |
122 | 
123 |
124 | 1. Seleziona `Accetta` per accettare il suggerimento.
125 |
126 | 1. Dovresti vedere che viene generato un commento per la funzione.
127 |
128 | **NOTA:** Oltre a generare la documentazione, puoi anche usare i commenti per generare il codice.
129 |
130 | 1. Ora supponiamo che tu voglia memorizzare i "ricordi" dei numeri precedenti fatti eco dalla stanza. Aggiungi il seguente codice dopo la variabile `echoes`.
131 |
132 | ```js
133 | const memories = [];
134 | ```
135 |
136 | 1. Aggiungi il seguente commento immediatamente **sopra** l'istruzione `return next` nella funzione `predictNext` e premi Enter. Accetta il suggerimento premendo Tab.
137 |
138 | ```js
139 | // Memorizza la sequenza completa compreso il numero previsto in memories
140 | ```
141 |
142 | 1. Dovresti vedere un codice simile al seguente generato:
143 |
144 | ```js
145 | memories.push(...echoes, next);
146 | ```
147 |
148 | 1. Salva `echo-chamber.js` e apri una finestra del terminale nella cartella in cui hai creato il file.
149 |
150 | 1. Esegui il seguente comando per eseguire il codice. Questo presuppone che tu abbia installato [Node.js](https://nodejs.org).
151 |
152 | ```bash
153 | node echo-chamber.js
154 | ```
155 |
156 | 1. Dovresti vedere `15` stampato sulla console che è il prossimo numero nella sequenza.
157 |
158 | 1. Vedi se riesci a far uscire Copilot i ricordi sulla console per te aggiungendo un commento.
159 |
160 | ## Il tesoro nascosto del Castello Echo è ora tuo!
161 |
162 |
163 |
164 |
165 |
166 | Hai completato la tua prima avventura di "riscaldamento" di GitHub Copilot! Dai un'occhiata alle altre avventure situate nella cartella [Adventures](../Adventures) per vedere altri modi in cui GitHub Copilot può essere utilizzato.
--------------------------------------------------------------------------------
/Adventures/Ask/Warmup-Adventure-Ask.md:
--------------------------------------------------------------------------------
1 | ## GitHub Copilot Warmup Adventure: Ask Mode Adventure
2 |
3 |
4 |
5 |
6 |
7 | GitHub Copilot is an AI pair programmer that helps you write better code. In this warm up adventure you'll get to know Copilot and try it out for yourself. Here are a few things you can do with GitHub Copilot:
8 |
9 | - Convert comments into code. Need to make an HTTP call, filter an array, or perform another task? Write a comment and Copilot will convert it into code for you.
10 | - Create a UI. Use pure HTML/CSS/JavaScript or a library/framework of your choosing.
11 | - Create SQL queries.
12 | - Create unit tests.
13 | - Write code in a new language.
14 | - Explain code you're working on.
15 | - And more!
16 |
17 | If you're brand new to GitHub Copilot check out this video to learn more about the benefits it can bring to your development workflow. Once you've watched the video, come back here and choose an adventure to get started.
18 |
19 | [](https://www.youtube.com/watch?v=Dlt-DCLHnxM)
20 |
21 | ## Getting Started: Installing the GitHub Copilot Extension
22 |
23 | Follow the steps below to install the GitHub Copilot extension in Visual Studio or Visual Studio Code.
24 |
25 | 1. Install [Visual Studio](https://visualstudio.microsoft.com/) or [Visual Studio Code](https://code.visualstudio.com/) if you don't have it already.
26 |
27 | 1. Install GitHub Copilot by following the steps at https://docs.github.com/en/copilot/getting-started-with-github-copilot.
28 |
29 | ## What If I Don't Have a GitHub Copilot License?
30 |
31 | **Are you a student?** Learn more about how to [setup and access GitHub Copilot here](https://techcommunity.microsoft.com/t5/educator-developer-blog/step-by-step-setting-up-github-student-and-github-copilot-as-an/ba-p/3736279).
32 |
33 | If you don't currently have a GitHub Copilot license, you can:
34 |
35 | - [Sign up for a free trial](https://github.com/login?return_to=%2fgithub-copilot%2fsignup).
36 |
37 |
38 | ## Your First Adventure: The Chamber of Echoes
39 |
40 | Let's get started with your first adventure!
41 |
42 |
43 |
44 |
45 |
46 | ### Background:
47 |
48 | Perched atop the highest hill, overlooking the kingdom, stands the majestic Echo Castle. Within its stone walls is a chamber known as the Echo Room. This chamber, unlike any other, has the mystic power to echo numbers to anyone who enters. However, the Echo Room doesn't just echo back any numbers; it always echoes the next number in a sequence.
49 |
50 | Legends tell of a wizard who enchanted this chamber to test the intellect of visitors. The room would echo numbers in sequence, and only those who could predict the next echo were deemed worthy of the castle's hidden treasures.
51 |
52 | ### Objective:
53 |
54 | Your task is to enter the Echo Room and listen to its sequence, then predict the next number it will echo. You have been provided with a series of numbers the room has echoed in the past. Use these numbers to determine the next one in the sequence.
55 |
56 | ### Specifications:
57 |
58 | 1. **Input**:
59 | - A list of at least three numbers that form a sequence. This list represents the numbers the room has echoed in the past.
60 |
61 | 2. **Output**:
62 | - A single number representing the next number in the sequence.
63 |
64 | 3. **Assumptions**:
65 | - The sequence will always be an arithmetic progression (The difference between consecutive numbers is constant).
66 |
67 | ### Sample Data:
68 |
69 | Consider the sequence: [3, 6, 9, 12]
70 |
71 | The next number echoed by the room should be: 15
72 |
73 | ### Constraints:
74 |
75 | - The following solution uses JavaScript and Node.js, but you can use Copilot to write the code in another language if you'd like.
76 |
77 | ### Summary of High-Level Tasks to Perform:
78 |
79 | 1. Use a console application to render the output.
80 | 1. Create a constant to hold the provided number sequence.
81 | 1. Determine the common difference between consecutive numbers.
82 | 1. Predict the next number in the sequence using the identified pattern.
83 |
84 |
85 | ### GitHub Copilot Steps
86 |
87 | This solution uses JavaScript and [Node.js](https://nodejs.org). Feel free to use another language/framework if you'd like.
88 |
89 | 1. Create a file named `echo-chamber.js` in a folder of your choosing.
90 |
91 | 1. Add a `const` named `echoes` to hold the numeric sequence into the file:
92 |
93 | ```js
94 | const echoes = [3, 6, 9, 12];
95 | ```
96 |
97 | 1. Type the following code after the `echoes` constant. Copilot should suggest code to help you determine the difference between consecutive numbers in the sequence.
98 |
99 | ```js
100 | function predictNext(echoes) {
101 | ```
102 |
103 | 1. To accept the suggestion, press Tab. The following function body should be added. Note that you may see a different code suggestion.
104 |
105 | ```js
106 | function predictNext(echoes) {
107 | let difference = echoes[1] - echoes[0];
108 | let next = echoes[echoes.length - 1] + difference;
109 | return next;
110 | }
111 | ```
112 |
113 | 1. Enter a new line after the function and Copilot should suggest code similar to the following. If it doesn't, begin typing `console.log`. To accept the suggestion, press Tab.
114 |
115 | ```js
116 | console.log(predictNext(echoes));
117 | ```
118 |
119 | 1. Move your cursor above the `predictNext` function and select CTRL + i (Windows) or CMD + i (Mac).
120 |
121 | 1. Enter `/doc` into the textbox that appears and press Enter. You should see a comment generated for the function.
122 |
123 | 
124 |
125 | 1. Select `Accept` to accept the suggestion.
126 |
127 | 1. You should see that a comment is generated for the function.
128 |
129 | **NOTE:** In addition to generating documentation, you can also use comments to generate code.
130 |
131 | 1. Now let's assume that you want to store the "memories" of the previous numbers echoed by the room. Add the following code after the `echoes` variable.
132 |
133 | ```js
134 | const memories = [];
135 | ```
136 |
137 | 1. Add the following comment immediately **above** the `return next` statement in the `predictNext` function and press Enter. Accept the suggestion by pressing Tab.
138 |
139 | ```js
140 | // Store the full sequence including the predicted number in memories
141 | ```
142 |
143 | 1. You should see code similar to the following generated:
144 |
145 | ```js
146 | memories.push(...echoes, next);
147 | ```
148 |
149 | 1. Save `echo-chamber.js` and open a terminal window in the folder where you created the file.
150 |
151 | 1. Run the following command to execute the code. This assumes you have [Node.js](https://nodejs.org) installed.
152 |
153 | ```bash
154 | node echo-chamber.js
155 | ```
156 |
157 | 1. You should see `15` printed to the console which is the next number in the sequence.
158 |
159 | 1. See if you can get Copilot to output the memories to the console for you by adding a comment.
160 |
161 | ## Echo Castle's Hidden Treasure is Now Yours!
162 |
163 |
164 |
165 |
166 |
167 | You've completed your first GitHub Copilot "warmup" adventure! Check out the other adventures located in the [Adventures](../Adventures) folder to see other ways GitHub Copilot can be used.
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Microsoft Open Source Code of Conduct
2 |
3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4 |
5 | Resources:
6 |
7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
10 |
--------------------------------------------------------------------------------
/Data/scrolls.txt:
--------------------------------------------------------------------------------
1 | Welcome to the Scrolls of Eldoria.
2 | Misleading information is everywhere.
3 | {*The first secret is the key to the first door.*}
4 | Beware of the Eldorian traps.
5 | {*The second secret lies beneath the Eldorian tree.*}
6 | End of scroll.
--------------------------------------------------------------------------------
/Images/Coupon/dashboard-message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/Coupon/dashboard-message.png
--------------------------------------------------------------------------------
/Images/Coupon/get-access.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/Coupon/get-access.png
--------------------------------------------------------------------------------
/Images/Coupon/redeem-coupon-form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/Coupon/redeem-coupon-form.png
--------------------------------------------------------------------------------
/Images/Coupon/redeem.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/Coupon/redeem.png
--------------------------------------------------------------------------------
/Images/Coupon/select-preferences.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/Coupon/select-preferences.png
--------------------------------------------------------------------------------
/Images/Coupon/success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/Coupon/success.png
--------------------------------------------------------------------------------
/Images/agent-mode-tips.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/agent-mode-tips.jpg
--------------------------------------------------------------------------------
/Images/algora-forest.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/algora-forest.jpg
--------------------------------------------------------------------------------
/Images/algora-forest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/algora-forest.png
--------------------------------------------------------------------------------
/Images/choose-own-adventure.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/choose-own-adventure.jpg
--------------------------------------------------------------------------------
/Images/choose-own-adventure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/choose-own-adventure.png
--------------------------------------------------------------------------------
/Images/code-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/code-button.png
--------------------------------------------------------------------------------
/Images/copilot-adventures-banner-castle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-adventures-banner-castle.png
--------------------------------------------------------------------------------
/Images/copilot-adventures-banner-dragon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-adventures-banner-dragon.png
--------------------------------------------------------------------------------
/Images/copilot-adventures-banner-robot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-adventures-banner-robot.png
--------------------------------------------------------------------------------
/Images/copilot-adventures.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-adventures.jpg
--------------------------------------------------------------------------------
/Images/copilot-adventures.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-adventures.png
--------------------------------------------------------------------------------
/Images/copilot-tips.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-tips.jpg
--------------------------------------------------------------------------------
/Images/copilot-tips.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-tips.png
--------------------------------------------------------------------------------
/Images/copilot-video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/copilot-video.png
--------------------------------------------------------------------------------
/Images/echo-castle-treasure.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/echo-castle-treasure.jpg
--------------------------------------------------------------------------------
/Images/echo-castle-treasure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/echo-castle-treasure.png
--------------------------------------------------------------------------------
/Images/echo-castle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/echo-castle.jpg
--------------------------------------------------------------------------------
/Images/echo-castle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/echo-castle.png
--------------------------------------------------------------------------------
/Images/eldoria.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/eldoria.jpg
--------------------------------------------------------------------------------
/Images/eldoria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/eldoria.png
--------------------------------------------------------------------------------
/Images/inline-chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/inline-chat.png
--------------------------------------------------------------------------------
/Images/knowledge-cartographer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/knowledge-cartographer.jpg
--------------------------------------------------------------------------------
/Images/learn-more.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/learn-more.jpg
--------------------------------------------------------------------------------
/Images/learn-more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/learn-more.png
--------------------------------------------------------------------------------
/Images/lumoria.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/lumoria.jpg
--------------------------------------------------------------------------------
/Images/lumoria.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/lumoria.png
--------------------------------------------------------------------------------
/Images/mythos-arena-full.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/mythos-arena-full.jpg
--------------------------------------------------------------------------------
/Images/mythos-arena-full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/mythos-arena-full.png
--------------------------------------------------------------------------------
/Images/mythos-arena.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/mythos-arena.png
--------------------------------------------------------------------------------
/Images/mythos-board-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/mythos-board-example.png
--------------------------------------------------------------------------------
/Images/robot-adventures.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/robot-adventures.jpg
--------------------------------------------------------------------------------
/Images/robot-adventures.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/robot-adventures.png
--------------------------------------------------------------------------------
/Images/starborn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/starborn.jpg
--------------------------------------------------------------------------------
/Images/starborn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/starborn.png
--------------------------------------------------------------------------------
/Images/stellaris.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/stellaris.jpg
--------------------------------------------------------------------------------
/Images/stonevale.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/stonevale.jpg
--------------------------------------------------------------------------------
/Images/stonevale.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/stonevale.png
--------------------------------------------------------------------------------
/Images/tempora-clocks.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/tempora-clocks.jpg
--------------------------------------------------------------------------------
/Images/tempora-clocks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/tempora-clocks.png
--------------------------------------------------------------------------------
/Images/warm-up.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/warm-up.jpg
--------------------------------------------------------------------------------
/Images/warm-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/CopilotAdventures/3a6fb13af1b2fa8879786d875fb6f63e904b3f5b/Images/warm-up.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Security
4 |
5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
6 |
7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
8 |
9 | ## Reporting Security Issues
10 |
11 | **Please do not report security vulnerabilities through public GitHub issues.**
12 |
13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
14 |
15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
16 |
17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18 |
19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20 |
21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22 | * Full paths of source file(s) related to the manifestation of the issue
23 | * The location of the affected source code (tag/branch/commit or direct URL)
24 | * Any special configuration required to reproduce the issue
25 | * Step-by-step instructions to reproduce the issue
26 | * Proof-of-concept or exploit code (if possible)
27 | * Impact of the issue, including how an attacker might exploit the issue
28 |
29 | This information will help us triage your report more quickly.
30 |
31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
32 |
33 | ## Preferred Languages
34 |
35 | We prefer all communications to be in English.
36 |
37 | ## Policy
38 |
39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
40 |
41 |
42 |
--------------------------------------------------------------------------------
/SUPPORT.md:
--------------------------------------------------------------------------------
1 | # TODO: The maintainer of this repo has not yet edited this file
2 |
3 | **REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?
4 |
5 | - **No CSS support:** Fill out this template with information about how to file issues and get help.
6 | - **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
7 | - **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.
8 |
9 | *Then remove this first heading from this SUPPORT.MD file before publishing your repo.*
10 |
11 | # Support
12 |
13 | ## How to file issues and get help
14 |
15 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing
16 | issues before filing new issues to avoid duplicates. For new issues, file your bug or
17 | feature request as a new Issue.
18 |
19 | For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
20 | FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
21 | CHANNEL. WHERE WILL YOU HELP PEOPLE?**.
22 |
23 | ## Microsoft Support Policy
24 |
25 | Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
26 |
--------------------------------------------------------------------------------
/Solutions/CSharp/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # NuGet Symbol Packages
188 | *.snupkg
189 | # The packages folder can be ignored because of Package Restore
190 | **/[Pp]ackages/*
191 | # except build/, which is used as an MSBuild target.
192 | !**/[Pp]ackages/build/
193 | # Uncomment if necessary however generally it will be regenerated when needed
194 | #!**/[Pp]ackages/repositories.config
195 | # NuGet v3's project.json files produces more ignorable files
196 | *.nuget.props
197 | *.nuget.targets
198 |
199 | # Microsoft Azure Build Output
200 | csx/
201 | *.build.csdef
202 |
203 | # Microsoft Azure Emulator
204 | ecf/
205 | rcf/
206 |
207 | # Windows Store app package directories and files
208 | AppPackages/
209 | BundleArtifacts/
210 | Package.StoreAssociation.xml
211 | _pkginfo.txt
212 | *.appx
213 | *.appxbundle
214 | *.appxupload
215 |
216 | # Visual Studio cache files
217 | # files ending in .cache can be ignored
218 | *.[Cc]ache
219 | # but keep track of directories ending in .cache
220 | !?*.[Cc]ache/
221 |
222 | # Others
223 | ClientBin/
224 | ~$*
225 | *~
226 | *.dbmdl
227 | *.dbproj.schemaview
228 | *.jfm
229 | *.pfx
230 | *.publishsettings
231 | orleans.codegen.cs
232 |
233 | # Including strong name files can present a security risk
234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
235 | #*.snk
236 |
237 | # Since there are multiple workflows, uncomment next line to ignore bower_components
238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
239 | #bower_components/
240 |
241 | # RIA/Silverlight projects
242 | Generated_Code/
243 |
244 | # Backup & report files from converting an old project file
245 | # to a newer Visual Studio version. Backup files are not needed,
246 | # because we have git ;-)
247 | _UpgradeReport_Files/
248 | Backup*/
249 | UpgradeLog*.XML
250 | UpgradeLog*.htm
251 | ServiceFabricBackup/
252 | *.rptproj.bak
253 |
254 | # SQL Server files
255 | *.mdf
256 | *.ldf
257 | *.ndf
258 |
259 | # Business Intelligence projects
260 | *.rdl.data
261 | *.bim.layout
262 | *.bim_*.settings
263 | *.rptproj.rsuser
264 | *- [Bb]ackup.rdl
265 | *- [Bb]ackup ([0-9]).rdl
266 | *- [Bb]ackup ([0-9][0-9]).rdl
267 |
268 | # Microsoft Fakes
269 | FakesAssemblies/
270 |
271 | # GhostDoc plugin setting file
272 | *.GhostDoc.xml
273 |
274 | # Node.js Tools for Visual Studio
275 | .ntvs_analysis.dat
276 | node_modules/
277 |
278 | # Visual Studio 6 build log
279 | *.plg
280 |
281 | # Visual Studio 6 workspace options file
282 | *.opt
283 |
284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285 | *.vbw
286 |
287 | # Visual Studio LightSwitch build output
288 | **/*.HTMLClient/GeneratedArtifacts
289 | **/*.DesktopClient/GeneratedArtifacts
290 | **/*.DesktopClient/ModelManifest.xml
291 | **/*.Server/GeneratedArtifacts
292 | **/*.Server/ModelManifest.xml
293 | _Pvt_Extensions
294 |
295 | # Paket dependency manager
296 | .paket/paket.exe
297 | paket-files/
298 |
299 | # FAKE - F# Make
300 | .fake/
301 |
302 | # CodeRush personal settings
303 | .cr/personal
304 |
305 | # Python Tools for Visual Studio (PTVS)
306 | __pycache__/
307 | *.pyc
308 |
309 | # Cake - Uncomment if you are using it
310 | # tools/**
311 | # !tools/packages.config
312 |
313 | # Tabs Studio
314 | *.tss
315 |
316 | # Telerik's JustMock configuration file
317 | *.jmconfig
318 |
319 | # BizTalk build output
320 | *.btp.cs
321 | *.btm.cs
322 | *.odx.cs
323 | *.xsd.cs
324 |
325 | # OpenCover UI analysis results
326 | OpenCover/
327 |
328 | # Azure Stream Analytics local run output
329 | ASALocalRun/
330 |
331 | # MSBuild Binary and Structured Log
332 | *.binlog
333 |
334 | # NVidia Nsight GPU debugger configuration file
335 | *.nvuser
336 |
337 | # MFractors (Xamarin productivity tool) working folder
338 | .mfractor/
339 |
340 | # Local History for Visual Studio
341 | .localhistory/
342 |
343 | # BeatPulse healthcheck temp database
344 | healthchecksdb
345 |
346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
347 | MigrationBackup/
348 |
349 | # Ionide (cross platform F# VS Code tools) working folder
350 | .ionide/
351 |
--------------------------------------------------------------------------------
/Solutions/CSharp/CopilotAdventures.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net9.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Solutions/CSharp/CopilotAdventures.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.002.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CopilotAdventures", "CopilotAdventures.csproj", "{64F88196-195C-4F1D-B950-824978B007D2}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{23E14831-7434-4626-9EDC-5CC529CA15E5}"
9 | ProjectSection(SolutionItems) = preProject
10 | README.md = README.md
11 | EndProjectSection
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Release|Any CPU = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {64F88196-195C-4F1D-B950-824978B007D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {64F88196-195C-4F1D-B950-824978B007D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {64F88196-195C-4F1D-B950-824978B007D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {64F88196-195C-4F1D-B950-824978B007D2}.Release|Any CPU.Build.0 = Release|Any CPU
23 | EndGlobalSection
24 | GlobalSection(SolutionProperties) = preSolution
25 | HideSolutionNode = FALSE
26 | EndGlobalSection
27 | GlobalSection(ExtensibilityGlobals) = postSolution
28 | SolutionGuid = {AEEF0605-3707-486B-8ABF-F7AB03CDE45E}
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/Solutions/CSharp/Program.cs:
--------------------------------------------------------------------------------
1 | public class Program
2 | {
3 | public static void Main(string[] args)
4 | {
5 |
6 | var adventure = args?.FirstOrDefault()?.ToLower();
7 | if (string.IsNullOrWhiteSpace(adventure))
8 | {
9 | Console.WriteLine("Please specify which logic to run: Sample names include: algora, chamberofechoes, elodoria, lumoria, mythos, mythos-test, stonevale, tempora.");
10 | adventure = Console.ReadLine();
11 | }
12 |
13 | switch (adventure)
14 | {
15 | case "algora":
16 | Algora.Run();
17 | break;
18 | case "chamberofechoes":
19 | ChamberOfEchoes.Run();
20 | break;
21 | case "eldoria":
22 | Eldoria.Run();
23 | break;
24 | case "lumoria":
25 | Lumoria.Run();
26 | break;
27 | case "mythos":
28 | Mythos.Run();
29 | break;
30 | case "mythos-test":
31 | GridlockTestRunner.Run();
32 | break;
33 | case "stonevale":
34 | StoneVale.Run();
35 | break;
36 | case "tempora":
37 | Tempora.Run();
38 | break;
39 | default:
40 | Console.WriteLine($"Unknown option: {adventure}");
41 | break;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Solutions/CSharp/README-Gridlock-Arena.md:
--------------------------------------------------------------------------------
1 | # The Gridlock Arena of Mythos - C# Solution
2 |
3 | This folder contains the complete C# solution for the Gridlock Arena of Mythos adventure, demonstrating modern C# patterns and comprehensive battle simulation.
4 |
5 | ## Files
6 |
7 | - **`The-Gridlock-Arena-of-Mythos.cs`** - Main battle simulation implementation
8 | - **`GridlockArenaTests.cs`** - Comprehensive test suite with 100% coverage
9 | - **`Program.cs`** - Console application entry point with test runner
10 |
11 | ## Features
12 |
13 | ✅ **Modern C#** - Records, enums, and proper class structure
14 | ✅ **Comprehensive Testing** - 40+ test cases covering all functionality
15 | ✅ **Battle Mechanics** - Multi-creature collision detection and resolution
16 | ✅ **Grid Visualization** - Unicode-based arena display
17 | ✅ **Error Handling** - Robust validation and error management
18 | ✅ **Object-Oriented Design** - Clean separation of concerns with proper encapsulation
19 |
20 | ## Running the Solution
21 |
22 | ```bash
23 | # Build the project
24 | dotnet build
25 |
26 | # Run the main battle simulation
27 | dotnet run mythos
28 |
29 | # Run the comprehensive test suite
30 | dotnet run mythos-test
31 |
32 | # Build and run directly
33 | dotnet run
34 | ```
35 |
36 | ## Expected Results
37 |
38 | - **Dragon**: 12 points (winner)
39 | - **Wizard**: 0 points (survives)
40 | - **All others**: 0 points (defeated)
41 |
42 | ## Test Coverage
43 |
44 | The test suite covers:
45 | - ✅ **Validation Tests** (1 test) - Creature validation logic
46 | - ✅ **Utility Functions** (18 tests) - Position validation and movement calculations
47 | - ✅ **Integration Tests** (8 tests) - Full battle simulations with various scenarios
48 | - ✅ **Edge Cases** (7 tests) - Boundary conditions and special scenarios
49 |
50 | ## Architecture
51 |
52 | - **`Position` record** - Immutable position with movement calculations
53 | - **`Creature` class** - Represents arena combatants with properties and behavior
54 | - **`Direction` enum** - Type-safe movement directions
55 | - **`BattleSimulator` class** - Core simulation engine with battle logic
56 | - **`Mythos` class** - Main program entry point and coordination
57 |
58 | This solution demonstrates modern C# development practices including records, pattern matching, and comprehensive testing methodologies for educational purposes.
--------------------------------------------------------------------------------
/Solutions/CSharp/README.md:
--------------------------------------------------------------------------------
1 | # Running the Samples
2 |
3 | To run these samples you can use:
4 |
5 | ```bash
6 | dotnet run [sample name]
7 | # Sample names include: lumoria, algora, stonevale, temporal, mythos
8 | ```
9 |
10 | For example, to run the Lumoria adventure sample you would use:
11 |
12 | ```bash
13 | dotnet run [ algora | chamberofechoes | eldoria | lumoria | mythos | stonevale | temporal ]
14 | ```
15 |
16 | If you are running Visual Studio 2022 you can run the project and enter the sample name in the console window.
17 |
18 | ## Prerequisites
19 |
20 | To run these samples you'll need the .NET 7 SDK installed or you can use the GitHub Codespace available with this repository (see the root readme for more details). You can download the SDK [here](https://dotnet.microsoft.com/en-us/download/dotnet).
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Celestial-Alignment-of-Lumoria.cs:
--------------------------------------------------------------------------------
1 | public class Planet
2 | {
3 | public string Name { get; set; } = string.Empty;
4 | public double Distance { get; set; }
5 | public double Size { get; set; }
6 | }
7 |
8 | public class Lumoria
9 | {
10 | public static int GetShadowCount(List planets, int currentIndex)
11 | {
12 | return planets.Take(currentIndex)
13 | .Count(planet => planet.Size > planets[currentIndex].Size);
14 | }
15 |
16 | public static string GetLightIntensity(int i, int shadowCount)
17 | {
18 | if (i == 0) return "Full";
19 | if (shadowCount == 1) return "None";
20 | if (shadowCount > 1) return "None (Multiple Shadows)";
21 | return "Partial";
22 | }
23 |
24 | public static List<(string Name, string Light)> CalculateLightIntensity(List planets)
25 | {
26 | return planets.Select((planet, i) =>
27 | {
28 | var shadowCount = GetShadowCount(planets, i);
29 | var lightIntensity = GetLightIntensity(i, shadowCount);
30 | return (Name: planet.Name, Light: lightIntensity);
31 | }).ToList();
32 | }
33 |
34 | public static void Run()
35 | {
36 | var lumoriaPlanets = new List
37 | {
38 | new Planet { Name = "Mercuria", Distance = 0.4, Size = 4879 },
39 | new Planet { Name = "Earthia", Distance = 1, Size = 12742 },
40 | new Planet { Name = "Venusia", Distance = 0.7, Size = 12104 },
41 | new Planet { Name = "Marsia", Distance = 1.5, Size = 6779 }
42 | };
43 |
44 | var sortedPlanets = lumoriaPlanets.OrderBy(p => p.Distance).ToList();
45 | var lightIntensities = CalculateLightIntensity(sortedPlanets);
46 |
47 | foreach (var item in lightIntensities)
48 | {
49 | Console.WriteLine($"Planet: {item.Name}, Light: {item.Light}");
50 | }
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Chamber-of-Echoes.cs:
--------------------------------------------------------------------------------
1 | public class ChamberOfEchoes
2 | {
3 | static List echoes = new List { 3, 6, 9, 12 };
4 | static List memories = new List();
5 |
6 | // Document what this code is doing
7 | // This code is predicting the next number in the sequence by finding the difference
8 | // between the first two numbers and adding that difference to the last number in the sequence.
9 | static int PredictNext(List echoes)
10 | {
11 | int difference = echoes[1] - echoes[0];
12 | int next = echoes[echoes.Count - 1] + difference;
13 | // Store the full sequence including the predicted number in memories
14 | memories.AddRange(echoes);
15 | memories.Add(next);
16 | return next;
17 | }
18 |
19 | public static void Run()
20 | {
21 | Console.WriteLine(PredictNext(echoes));
22 | }
23 | }
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Clockwork-Town-of-Tempora.cs:
--------------------------------------------------------------------------------
1 | public class Tempora
2 | {
3 | ///
4 | /// Parses a string representation of time into separate hour and minute integers.
5 | ///
6 | /// The time string to parse (in the format "HH:mm").
7 | /// A tuple containing the parsed hour and minute values.
8 | private static (int Hour, int Minute) ParseTime(string time)
9 | {
10 | var parts = time.Split(':').Select(int.Parse).ToArray();
11 | return (parts[0], parts[1]);
12 | }
13 |
14 | ///
15 | /// Calculates the time difference between two clock times.
16 | ///
17 | /// The clock time to calculate the difference from.
18 | /// The grand clock time to calculate the difference to.
19 | /// The time difference in minutes.
20 | public static int TimeDifference(string clockTime, string grandClockTime)
21 | {
22 | var (clockHour, clockMinute) = ParseTime(clockTime);
23 | var (grandClockHour, grandClockMinute) = ParseTime(grandClockTime);
24 |
25 | return (clockHour - grandClockHour) * 60 + (clockMinute - grandClockMinute);
26 | }
27 |
28 | ///
29 | /// Synchronizes a list of clock times to a grand clock time.
30 | ///
31 | /// The list of clock times to synchronize.
32 | /// The grand clock time to synchronize to.
33 | /// A list of time differences in minutes.
34 | public static List SynchronizeClocks(List clockTimes, string grandClockTime)
35 | {
36 | return clockTimes.Select(clockTime => TimeDifference(clockTime, grandClockTime)).ToList();
37 | }
38 |
39 | ///
40 | /// Runs the Tempora class and outputs the synchronized clock times.
41 | ///
42 | public static void Run()
43 | {
44 | var clockTimes = new List { "14:45", "15:05", "15:00", "14:40" };
45 | const string grandClockTime = "15:00";
46 | Console.WriteLine($"[{string.Join(", ", SynchronizeClocks(clockTimes, grandClockTime))}]"); // Outputs: [-15, 5, 0, -20]
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Gridlock-Arena-of-Mythos.cs:
--------------------------------------------------------------------------------
1 | record Position(int X, int Y)
2 | {
3 | public Position MoveBy(int dx, int dy, int gridSize)
4 | {
5 | return new Position(Math.Clamp(X + dx, 0, gridSize - 1), Math.Clamp(Y + dy, 0, gridSize - 1));
6 | }
7 | }
8 |
9 | class Creature
10 | {
11 | public string Name { get; }
12 | public Position Start { get; set; }
13 | public Direction[] Moves { get; }
14 | public int Power { get; set; }
15 | public string Icon { get; }
16 |
17 | public Creature(string name, Position start, Direction[] moves, int power, string icon)
18 | {
19 | Name = name;
20 | Start = start;
21 | Moves = moves;
22 | Power = power;
23 | Icon = icon;
24 | }
25 | }
26 |
27 | enum Direction
28 | {
29 | Up,
30 | Down,
31 | Left,
32 | Right
33 | }
34 |
35 | class BattleSimulator
36 | {
37 | private const int GridSize = 5;
38 | private const string OverlapIcon = "🤺";
39 | private const string EmptyCellIcon = "⬜";
40 | private const int InitialMove = -1;
41 |
42 | private static readonly Dictionary Directions = new()
43 | {
44 | [Direction.Up] = (-1, 0),
45 | [Direction.Down] = (1, 0),
46 | [Direction.Left] = (0, -1),
47 | [Direction.Right] = (0, 1)
48 | };
49 |
50 | private readonly List _creatures;
51 |
52 | public BattleSimulator(List creatures)
53 | {
54 | _creatures = creatures;
55 | }
56 |
57 | public Dictionary Battle()
58 | {
59 | var grid = new string?[GridSize, GridSize];
60 | var scores = _creatures.ToDictionary(creature => creature.Name, creature => 0);
61 | var activeCreatures = new List(_creatures); // Track active creatures
62 |
63 | foreach (var creature in _creatures)
64 | {
65 | grid[creature.Start.X, creature.Start.Y] = creature.Icon;
66 | }
67 |
68 | var maxMoves = _creatures.Max(creature => creature.Moves.Length);
69 |
70 | // Display initial board
71 | RenderGrid(InitialMove, grid, scores, _creatures);
72 |
73 | for (int move = 0; move < maxMoves; move++)
74 | {
75 | // Clear the grid for this move
76 | for (int i = 0; i < GridSize; i++)
77 | {
78 | for (int j = 0; j < GridSize; j++)
79 | {
80 | grid[i, j] = null;
81 | }
82 | }
83 |
84 | // First, calculate all new positions for active creatures only
85 | var newPositions = activeCreatures.Select(creature =>
86 | {
87 | var position = creature.Start;
88 | if (move < creature.Moves.Length)
89 | {
90 | var (dx, dy) = Directions[creature.Moves[move]];
91 | position = position.MoveBy(dx, dy, GridSize);
92 | }
93 | return new { Creature = creature, NewPosition = position };
94 | }).ToList();
95 |
96 | // Track creatures that will be defeated this round
97 | var defeated = new HashSet();
98 |
99 | // Group creatures by position to handle multi-creature collisions
100 | var positionGroups = newPositions.GroupBy(item => item.NewPosition).ToList();
101 |
102 | // Process collisions for each position
103 | foreach (var group in positionGroups)
104 | {
105 | var creaturesAtPosition = group.ToList();
106 | if (creaturesAtPosition.Count > 1)
107 | {
108 | // Multiple creatures at same position - battle!
109 | var position = creaturesAtPosition[0].NewPosition;
110 | grid[position.X, position.Y] = OverlapIcon; // Show battle
111 |
112 | // Find the strongest creature(s)
113 | var maxPower = creaturesAtPosition.Max(item => item.Creature.Power);
114 | var winners = creaturesAtPosition.Where(item => item.Creature.Power == maxPower).ToList();
115 | var losers = creaturesAtPosition.Where(item => item.Creature.Power < maxPower).ToList();
116 |
117 | if (winners.Count == 1)
118 | {
119 | // Single winner - gets points for all defeated creatures
120 | var winner = winners[0].Creature;
121 | foreach (var loser in losers)
122 | {
123 | scores[winner.Name] += loser.Creature.Power;
124 | defeated.Add(loser.Creature.Name);
125 | }
126 | }
127 | else
128 | {
129 | // Multiple creatures with same max power - all defeated
130 | foreach (var item in creaturesAtPosition)
131 | {
132 | defeated.Add(item.Creature.Name);
133 | }
134 | }
135 | }
136 | }
137 |
138 | // Update positions for surviving creatures and remove defeated ones
139 | activeCreatures = activeCreatures.Where(creature =>
140 | {
141 | if (defeated.Contains(creature.Name))
142 | {
143 | return false; // Remove defeated creature
144 | }
145 |
146 | // Update position for surviving creature
147 | var newPosItem = newPositions.FirstOrDefault(np => np.Creature.Name == creature.Name);
148 | if (newPosItem != null)
149 | {
150 | creature.Start = newPosItem.NewPosition;
151 | var position = creature.Start;
152 | if (grid[position.X, position.Y] != OverlapIcon) // Don't overwrite battle indicators
153 | {
154 | grid[position.X, position.Y] = creature.Icon;
155 | }
156 | }
157 | return true;
158 | }).ToList();
159 |
160 | // Render grid after movement and battles
161 | RenderGrid(move, grid, scores, _creatures);
162 | }
163 |
164 | return scores;
165 | }
166 |
167 | private static void RenderGrid(int move, string?[,] grid, Dictionary scores, List creatures)
168 | {
169 | var moveText = move == InitialMove ? "Initial Board" : $"Move {move + 1}";
170 | Console.WriteLine(moveText);
171 | for (int i = 0; i < GridSize; i++)
172 | {
173 | for (int j = 0; j < GridSize; j++)
174 | {
175 | Console.Write($"{grid[i, j] ?? EmptyCellIcon} ");
176 | }
177 | Console.WriteLine();
178 | }
179 |
180 | // Create scores with icons
181 | var scoresWithIcons = scores.ToDictionary(
182 | kvp => {
183 | var creature = creatures.FirstOrDefault(c => c.Name == kvp.Key);
184 | return creature != null ? $"{creature.Icon} {kvp.Key}" : kvp.Key;
185 | },
186 | kvp => kvp.Value
187 | );
188 |
189 | Console.WriteLine("Scores: {");
190 | var scoreItems = scoresWithIcons.ToArray();
191 | for (int i = 0; i < scoreItems.Length; i++)
192 | {
193 | var comma = i < scoreItems.Length - 1 ? "," : "";
194 | Console.WriteLine($" '{scoreItems[i].Key}': {scoreItems[i].Value}{comma}");
195 | }
196 | Console.WriteLine("}");
197 | Console.WriteLine("-----");
198 | }
199 | }
200 |
201 | public class Mythos
202 | {
203 | public static void Run()
204 | {
205 | Console.WriteLine("🏟️ Welcome to the Gridlock Arena of Mythos! 🏟️");
206 | Console.WriteLine("Preparing for an epic battle between legendary creatures...");
207 | Console.WriteLine();
208 |
209 | var creatures = new List
210 | {
211 | new Creature("Dragon", new Position(0, 0), new[] {Direction.Right, Direction.Down, Direction.Right}, 7, "🐉"),
212 | new Creature("Goblin", new Position(0, 2), new[] {Direction.Left, Direction.Down, Direction.Left}, 3, "👺"),
213 | new Creature("Ogre", new Position(2, 0), new[] {Direction.Up, Direction.Right, Direction.Down}, 5, "👹"),
214 | new Creature("Troll", new Position(2, 2), new[] {Direction.Up, Direction.Left, Direction.Up}, 4, "👿"),
215 | new Creature("Wizard", new Position(4, 1), new[] {Direction.Up, Direction.Up, Direction.Left}, 6, "🧙")
216 | };
217 |
218 | var simulator = new BattleSimulator(creatures);
219 | var scores = simulator.Battle();
220 |
221 | // Create final scores with icons
222 | var finalScoresWithIcons = scores.ToDictionary(
223 | kvp => {
224 | var creature = creatures.FirstOrDefault(c => c.Name == kvp.Key);
225 | return creature != null ? $"{creature.Icon} {kvp.Key}" : kvp.Key;
226 | },
227 | kvp => kvp.Value
228 | );
229 |
230 | Console.WriteLine("🏆 FINAL BATTLE RESULTS 🏆");
231 | Console.WriteLine("{");
232 | var scoreItems = finalScoresWithIcons.ToArray();
233 | for (int i = 0; i < scoreItems.Length; i++)
234 | {
235 | var comma = i < scoreItems.Length - 1 ? "," : "";
236 | Console.WriteLine($" '{scoreItems[i].Key}': {scoreItems[i].Value}{comma}");
237 | }
238 | Console.WriteLine("}");
239 | Console.WriteLine();
240 | Console.WriteLine("The battle has concluded! May the strongest creature be victorious!");
241 | }
242 | }
243 |
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Legendary-Duel-of-Stonevale.cs:
--------------------------------------------------------------------------------
1 | public class StoneVale
2 | {
3 | private static readonly Dictionary WinningMoves = new Dictionary
4 | {
5 | { "rock", "scissors" },
6 | { "scissors", "paper" },
7 | { "paper", "rock" }
8 | };
9 |
10 | private static readonly Dictionary Points = new Dictionary
11 | {
12 | { "rock", 1 },
13 | { "paper", 2 },
14 | { "scissors", 3 }
15 | };
16 |
17 | private static void PlayRounds(List player1Moves, List player2Moves, ref int player1Score, ref int player2Score)
18 | {
19 | int rounds = Math.Min(player1Moves.Count, player2Moves.Count);
20 | for (int i = 0; i < rounds; i++)
21 | {
22 | string move1 = player1Moves[i];
23 | string move2 = player2Moves[i];
24 |
25 | if (move1 == move2) continue;
26 |
27 | if (IsWinningMove(move1, move2))
28 | {
29 | player1Score += Points[move1];
30 | }
31 | else
32 | {
33 | player2Score += Points[move2];
34 | }
35 | }
36 | }
37 |
38 | private static bool IsWinningMove(string move1, string move2)
39 | {
40 | return WinningMoves[move1] == move2;
41 | }
42 |
43 | private static void DisplayResults(int player1Score, int player2Score)
44 | {
45 | Console.WriteLine($"Player 1 Score: {player1Score}");
46 | Console.WriteLine($"Player 2 Score: {player2Score}");
47 |
48 | string winnerMessage = DetermineWinner(player1Score, player2Score);
49 | Console.WriteLine(winnerMessage);
50 | }
51 |
52 | private static string DetermineWinner(int player1Score, int player2Score)
53 | {
54 | if (player1Score > player2Score) return "Player 1 wins!";
55 | if (player2Score > player1Score) return "Player 2 wins!";
56 | return "It's a draw!";
57 | }
58 |
59 | public static void Run()
60 | {
61 | List player1Moves = new List { "scissors", "paper", "scissors", "rock", "rock" };
62 | List player2Moves = new List { "rock", "rock", "paper", "scissors", "paper" };
63 |
64 | int player1Score = 0;
65 | int player2Score = 0;
66 |
67 | PlayRounds(player1Moves, player2Moves, ref player1Score, ref player2Score);
68 | DisplayResults(player1Score, player2Score);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Magical-Forest-of-Algora.cs:
--------------------------------------------------------------------------------
1 | public class Algora
2 | {
3 |
4 | static string danceEffect(string loxMove, string drakoMove, Dictionary effects)
5 | {
6 | return effects.TryGetValue($"{loxMove}{drakoMove}", out string? effect) ? effect : "A mysterious effect takes place.";
7 | }
8 |
9 | static IEnumerable simulateDance(string[] loxMoves, string[] drakoMoves, Dictionary effects)
10 | {
11 | return loxMoves.Select((move, index) => danceEffect(move, drakoMoves[index], effects));
12 | }
13 |
14 | public static void Run()
15 | {
16 | string[] loxMoves = new string[] { "Twirl", "Leap", "Spin", "Twirl", "Leap" };
17 | string[] drakoMoves = new string[] { "Spin", "Twirl", "Leap", "Leap", "Spin" };
18 |
19 | Dictionary effects = new Dictionary()
20 | {
21 | { "TwirlTwirl", "Fireflies light up the forest." },
22 | { "LeapLeap", "The forest grows taller." },
23 | { "SpinSpin", "The forest shrinks." },
24 | { "TwirlLeap", "The forest becomes more dense." },
25 | { "LeapSpin", "Gentle rain starts falling." },
26 | { "SpinLeap", "A rainbow appears in the sky." },
27 | { "TwirlSpin", "The forest becomes less dense." },
28 | { "LeapTwirl", "The forest becomes more vibrant." }
29 | };
30 |
31 | Console.WriteLine(string.Join(Environment.NewLine, simulateDance(loxMoves, drakoMoves, effects)));
32 | }
33 | }
--------------------------------------------------------------------------------
/Solutions/CSharp/The-Scrolls-Of-Eldoria.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http.Headers;
2 | using System.Text.RegularExpressions;
3 |
4 | public class Eldoria
5 | {
6 | private static async Task FetchAndDecipherScroll(string url)
7 | {
8 | Console.WriteLine($"Fetching scroll from {url}");
9 | try
10 | {
11 | using (var httpClient = new HttpClient())
12 | {
13 | string scrollContent = await httpClient.GetStringAsync(url);
14 |
15 | // Use regular expression to extract the secrets
16 | Regex secretsPattern = new Regex(@"\{\*(.*?)\*\}");
17 | MatchCollection matches = secretsPattern.Matches(scrollContent);
18 |
19 | // Display the extracted secrets
20 | foreach (Match match in matches)
21 | {
22 | Console.WriteLine(match.Groups[1].Value);
23 | }
24 | }
25 |
26 | }
27 | catch (Exception ex)
28 | {
29 | Console.WriteLine($"An error occurred: {ex.Message}");
30 | }
31 | }
32 |
33 | public static void Run()
34 | {
35 | string url = "https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt";
36 | FetchAndDecipherScroll(url).Wait();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Celestial-Alignment-of-Lumoria.js:
--------------------------------------------------------------------------------
1 | // Planet objects with their name, distance from Lumoria, and size
2 | const lumoriaPlanets = [
3 | { name: "Mercuria", distance: 0.4, size: 4879 },
4 | { name: "Earthia", distance: 1, size: 12742 },
5 | { name: "Venusia", distance: 0.7, size: 12104 },
6 | { name: "Marsia", distance: 1.5, size: 6779 }
7 | ];
8 |
9 |
10 |
11 | // Takes an array of planets and the current index for the planet being evaluated
12 | // and returns the number of planets that cast a shadow on the current planet
13 | function getShadowCount(planets, currentIndex) {
14 | // Slice the array up to the current index, filter the planets that are larger than the current planet, and return the length of the resulting array
15 | return planets.slice(0, currentIndex)
16 | .filter(planet => planet.size > planets[currentIndex].size)
17 | .length;
18 | }
19 |
20 | // Takes the current index and the number of shadows cast on the planet
21 | // and returns the light intensity of the planet
22 | function getLightIntensity(i, shadowCount) {
23 | /**
24 | * RULES
25 | * - If a smaller planet is behind a larger planet (relative to the Lumorian Sun), it will be in the shadow and will receive no light (`None`).
26 | * - If a larger planet is behind a smaller planet (relative to the Lumorian Sun), it will have `Partial` light.
27 | * - If a planet is in the shadow of multiple planets, it will be marked as `None (Multiple Shadows)`.
28 | * - If two planets are of similar size and are near each other in alignment, they might partially eclipse each other, but for simplicity, you can consider them both to receive full light.
29 | **/
30 | if (i === 0) return 'Full';
31 | if (shadowCount === 1) return 'None';
32 | if (shadowCount > 1) return 'None (Multiple Shadows)';
33 | return 'Partial';
34 | }
35 |
36 | // Calculates the light intensity of each planet by seeing how many shadows are cast on it from other planets
37 | function calculateLightIntensity(planets) {
38 | // Map over the array of planets, calculate the shadow count for each planet,
39 | // and return an object with the planet name and its light intensity
40 | return planets.map((planet, i) => {
41 | const shadowCount = getShadowCount(planets, i);
42 | let lightIntensity = getLightIntensity(i, shadowCount);
43 | return { name: planet.name, light: lightIntensity };
44 | });
45 | }
46 |
47 | // Sort the array of planets by distance
48 | const sortedPlanets = lumoriaPlanets.sort((a, b) => a.distance - b.distance);
49 |
50 | // Log the light intensity of each planet to the console
51 | console.log(calculateLightIntensity(sortedPlanets));
52 |
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Chamber-of-Echoes.js:
--------------------------------------------------------------------------------
1 | const echoes = [3, 6, 9, 12];
2 | const memories = [];
3 |
4 | // Document what this code is doing
5 | // This code is predicting the next number in the sequence by finding the difference
6 | // between the first two numbers and adding that difference to the last number in the sequence.
7 | /**
8 | * Predicts the next number in a sequence based on the difference between the first two numbers in the sequence.
9 | * @param {number[]} echoes - An array of numbers representing the sequence of echoes.
10 | * @returns {number} - The predicted next number in the sequence.
11 | */
12 | function predictNext(echoes) {
13 | let difference = echoes[1] - echoes[0];
14 | let next = echoes[echoes.length - 1] + difference;
15 | // Store the full sequence including the predicted number in memories
16 | memories.push(...echoes, next);
17 | return next;
18 | }
19 |
20 | console.log(predictNext(echoes));
21 |
22 |
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Clockwork-Town-of-Tempora.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Calculates the time difference between two clock times in minutes.
3 | * @param {string} clockTime - The first clock time in "HH:MM" format.
4 | * @param {string} grandClockTime - The second clock time in "HH:MM" format.
5 | * @returns {number} The time difference between the two clock times in minutes.
6 | */
7 | function timeDifference(clockTime, grandClockTime) {
8 | const [clockHour, clockMinute] = clockTime.split(":").map(Number);
9 | const [grandClockHour, grandClockMinute] = grandClockTime.split(":").map(Number);
10 |
11 | return (clockHour - grandClockHour) * 60 + (clockMinute - grandClockMinute);
12 | }
13 |
14 | /**
15 | * Synchronizes an array of clock times with a grand clock time by calculating the time difference between each clock time and the grand clock time.
16 | * @param {Array} clockTimes - An array of clock times in the format of "hh:mm:ss".
17 | * @param {string} grandClockTime - The grand clock time in the format of "hh:mm:ss".
18 | * @returns {Array} An array of time differences in seconds between each clock time and the grand clock time.
19 | */
20 | function synchronizeClocks(clockTimes, grandClockTime) {
21 | return clockTimes.map(clockTime => timeDifference(clockTime, grandClockTime));
22 | }
23 |
24 | const clockTimes = ["14:45", "15:05", "15:00", "14:40"];
25 | const grandClockTime = "15:00";
26 | console.log(synchronizeClocks(clockTimes, grandClockTime)); // [-15, 5, 0, -20]
27 |
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Gridlock-Arena-of-Mythos/README.md:
--------------------------------------------------------------------------------
1 | # The Gridlock Arena of Mythos - JavaScript Solution
2 |
3 | This folder contains the complete JavaScript solution for the Gridlock Arena of Mythos adventure, demonstrating modern ES module patterns and comprehensive battle simulation.
4 |
5 | ## Files
6 |
7 | - **`The-Gridlock-Arena-of-Mythos.js`** - Main battle simulation implementation
8 | - **`The-Gridlock-Arena-of-Mythos.test.js`** - Comprehensive test suite
9 | - **`demo-gridlock-arena.js`** - Additional demonstration scenarios
10 | - **`package.json`** - Modern ES6 module configuration with npm scripts
11 |
12 | ## Features
13 |
14 | ✅ **ES6 Modules** - Modern import/export syntax
15 | ✅ **Comprehensive Testing** - 61 test cases covering all functionality
16 | ✅ **Battle Mechanics** - Multi-creature collision detection and resolution
17 | ✅ **Grid Visualization** - Unicode-based arena display
18 | ✅ **Error Handling** - Robust validation and error management
19 |
20 | ## Running the Solution
21 |
22 | ```bash
23 | # Install dependencies (if any)
24 | npm install
25 |
26 | # Run the main battle simulation
27 | npm start
28 |
29 | # Run the comprehensive test suite
30 | npm test
31 |
32 | # Run the complete demo with multiple scenarios
33 | npm run demo
34 |
35 | # Or run files directly
36 | node The-Gridlock-Arena-of-Mythos.js
37 | node The-Gridlock-Arena-of-Mythos.test.js
38 | node demo-gridlock-arena.js
39 | ```
40 |
41 | ## Expected Results
42 |
43 | - **Dragon**: 12 points (winner)
44 | - **Wizard**: 0 points (survives)
45 | - **All others**: 0 points (defeated)
46 |
47 | This solution demonstrates the modern JavaScript development practices encouraged by the adventure, including ES6 modules, comprehensive testing, and clean code architecture.
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Gridlock-Arena-of-Mythos/demo-gridlock-arena.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * Demo Script for The Gridlock Arena of Mythos
5 | *
6 | * This script demonstrates the complete battle simulation system
7 | * with various scenarios and comprehensive testing.
8 | *
9 | */
10 |
11 | import { runBattleSimulation, creatures } from './The-Gridlock-Arena-of-Mythos.js';
12 | import { runAllTests } from './The-Gridlock-Arena-of-Mythos.test.js';
13 |
14 | console.log('🏟️ ===================================================================== 🏟️');
15 | console.log('🏟️ THE GRIDLOCK ARENA OF MYTHOS 🏟️');
16 | console.log('🏟️ Complete Battle Simulation System 🏟️');
17 | console.log('🏟️ ===================================================================== 🏟️');
18 |
19 | console.log('\n📋 SYSTEM OVERVIEW:');
20 | console.log('• 5x5 grid arena with simultaneous creature movement');
21 | console.log('• Battle mechanics with power-based victory conditions');
22 | console.log('• Multi-creature collision handling');
23 | console.log('• Comprehensive error handling and validation');
24 | console.log('• 100% test coverage with edge case validation');
25 |
26 | console.log('\n🧪 RUNNING COMPREHENSIVE TEST SUITE...');
27 | console.log('====================================================');
28 |
29 | try {
30 | runAllTests();
31 | console.log('\n✅ ALL TESTS PASSED - System validated and ready!');
32 | } catch (error) {
33 | console.error('\n❌ TEST FAILURE:', error.message);
34 | process.exit(1);
35 | }
36 |
37 | console.log('\n🎮 DEMONSTRATING BATTLE SCENARIOS...');
38 | console.log('====================================================');
39 |
40 | // Scenario 1: Default Epic Battle
41 | console.log('\n🏆 SCENARIO 1: The Epic Battle of Mythos');
42 | console.log('Five legendary creatures battle for supremacy...\n');
43 | runBattleSimulation();
44 |
45 | // Scenario 2: Custom Mini Battle
46 | console.log('\n\n⚔️ SCENARIO 2: Quick Duel');
47 | console.log('Two creatures in direct confrontation...\n');
48 | const duelCreatures = [
49 | { name: "Knight", start: [2, 1], moves: ["RIGHT", "RIGHT"], power: 8, icon: "⚔️" },
50 | { name: "Mage", start: [2, 3], moves: ["LEFT", "LEFT"], power: 6, icon: "🔮" }
51 | ];
52 | runBattleSimulation(duelCreatures);
53 |
54 | // Scenario 3: Three-Way Chaos
55 | console.log('\n\n💥 SCENARIO 3: Triple Threat');
56 | console.log('Three creatures converge on the same position...\n');
57 | const chaosCreatures = [
58 | { name: "Warrior", start: [1, 1], moves: ["DOWN"], power: 5, icon: "🛡️" },
59 | { name: "Archer", start: [3, 2], moves: ["UP"], power: 5, icon: "🏹" },
60 | { name: "Rogue", start: [2, 0], moves: ["RIGHT"], power: 5, icon: "🗡️" }
61 | ];
62 | runBattleSimulation(chaosCreatures);
63 |
64 | console.log('\n🎯 TECHNICAL ACHIEVEMENTS:');
65 | console.log('============================');
66 | console.log('✅ Proper separation of calculation and application phases');
67 | console.log('✅ Multi-creature battle resolution');
68 | console.log('✅ Boundary constraint enforcement');
69 | console.log('✅ Immutable input handling (no side effects)');
70 | console.log('✅ Comprehensive input validation');
71 | console.log('✅ Error handling for edge cases');
72 | console.log('✅ 100% test coverage achieved');
73 | console.log('✅ Clean, maintainable code structure');
74 |
75 | console.log('\n📊 EXPECTED RESULTS VALIDATION:');
76 | console.log('===============================');
77 | console.log('• Dragon wins Epic Battle with 12 points ✅');
78 | console.log('• Goblin, Ogre, Troll eliminated with 0 points ✅');
79 | console.log('• Wizard survives with 0 points ✅');
80 | console.log('• All battle mechanics working correctly ✅');
81 |
82 | console.log('\n🚀 SYSTEM READY FOR PRODUCTION!');
83 | console.log('================================');
84 | console.log('The Gridlock Arena battle simulation system is fully');
85 | console.log('implemented, tested, and validated. Ready for epic battles!');
86 | console.log('\n🏟️ ===================================================================== 🏟️');
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Gridlock-Arena-of-Mythos/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gridlock-arena-of-mythos",
3 | "version": "1.0.0",
4 | "description": "Epic battle simulation system for the mystical land of Mythos",
5 | "type": "module",
6 | "main": "The-Gridlock-Arena-of-Mythos.js",
7 | "scripts": {
8 | "start": "node The-Gridlock-Arena-of-Mythos.js",
9 | "test": "node The-Gridlock-Arena-of-Mythos.test.js",
10 | "demo": "node demo-gridlock-arena.js"
11 | },
12 | "keywords": ["adventure", "simulation", "game", "copilot"],
13 | "author": "CopilotAdventures",
14 | "license": "MIT"
15 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/README.md:
--------------------------------------------------------------------------------
1 | # The Knowledge Cartographer - Agent Mode + MCP Solution
2 |
3 | This JavaScript application demonstrates the **correct approach** for working with GitHub Copilot Agent Mode + MCP tools. It reads and analyzes knowledge data that was already created by MCP tools.
4 |
5 | ## What This Demonstrates
6 |
7 | This solution shows the **correct architecture** for MCP + Agent Mode applications:
8 |
9 | - **MCP Tools Do The Work**: FireCrawl scrapes web content, File System MCP organizes files
10 | - **Your Application Reads Results**: Focus on analyzing the data MCP tools already created
11 | - **Clean Separation**: MCP handles external operations, your app provides domain logic
12 | - **Proper Data Flow**: MCP → Files → Your Application (not MCP → Your Application)
13 |
14 | ## Features
15 |
16 | 🔍 **Knowledge Base Reader**
17 | - Reads structured data files created by MCP tools
18 | - Loads entities, relationships, and source information
19 | - Supports multiple knowledge domains/topics
20 |
21 | 🕸️ **Knowledge Graph Analysis**
22 | - Analyzes relationships between entities
23 | - Identifies connection patterns and strengths
24 | - Explores concept clusters and associations
25 |
26 | 📚 **Archive Management**
27 | - Detects existing knowledge archives
28 | - Lists available topics and domains
29 | - Loads specific knowledge areas on demand
30 |
31 | 🎮 **Interactive Exploration CLI**
32 | - Browse knowledge domains interactively
33 | - Find entity connections and relationships
34 | - Explore source materials and metadata
35 |
36 | ## Usage
37 |
38 | ### Explore Existing Knowledge Archives
39 | ```bash
40 | # Load and explore a specific knowledge domain
41 | node The-Knowledge-Cartographer-Agent-MCP.js "quantum computing"
42 | node The-Knowledge-Cartographer-Agent-MCP.js "artificial intelligence"
43 | ```
44 |
45 | ### Interactive Archive Exploration
46 | ```bash
47 | # Enter interactive exploration mode
48 | node The-Knowledge-Cartographer-Agent-MCP.js --interactive
49 | ```
50 |
51 | ### Interactive Commands
52 | ```
53 | > list # Show all available knowledge domains
54 | > load quantum computing # Load a specific knowledge domain
55 | > overview # Show current topic overview
56 | > find "quantum bit" # Find connections for an entity
57 | > relationships # Explore knowledge graph relationships
58 | > sources # Show original source materials
59 | > entities # List all entities in current topic
60 | > help # Show available commands
61 | > exit # Exit the system
62 | ```
63 |
64 | ## File Structure Expected
65 |
66 | The application expects to find knowledge archives created by MCP tools:
67 |
68 | ```
69 | akashic-archives-demo/ # Created by File System MCP
70 | ├── topics/
71 | │ └── quantum-computing/
72 | │ ├── entities.json # Entities extracted by FireCrawl MCP
73 | │ ├── relationships.json # Relationships identified by Agent Mode
74 | │ └── sources.json # Original sources scraped by FireCrawl MCP
75 | └── indexes/
76 | └── quantum-computing-index.json # Topic metadata organized by File System MCP
77 | ```
78 |
79 | **In Real Usage:** GitHub Copilot Agent Mode would have already used MCP tools to create these files before your application runs.
80 |
81 | ## How This Relates to MCP + Agent Mode
82 |
83 | This implementation demonstrates the **correct architecture** for MCP + Agent Mode integration:
84 |
85 | ### Real Usage Flow:
86 | 1. **GitHub Copilot Agent Mode** → Uses **FireCrawl MCP Server** → Scrapes real web content
87 | 2. **Agent Mode** → Passes scraped data to **Your Application** → Processes knowledge
88 | 3. **Your Application** → Requests file operations via **Agent Mode** → **File System MCP** saves files
89 | 4. **Your Application** → Focuses purely on business logic (graphs, analysis, CLI)
90 |
91 | ### What Each Component Does:
92 | - **FireCrawl MCP**: Web scraping, JavaScript rendering, batch processing
93 | - **File System MCP**: File/directory operations, structured storage
94 | - **Agent Mode**: Orchestrates MCP tools and coordinates with your application
95 | - **Your Application**: Knowledge extraction, graph construction, user interface
96 |
97 | ## Key Learning Points
98 |
99 | 🔧 **Correct MCP Architecture**
100 | - **Separation of Concerns**: MCP tools handle external operations, your app handles business logic
101 | - **Data Flow**: MCP → Agent Mode → Your Application (not MCP → Your Application)
102 | - **Agent Mode Orchestration**: Agent Mode coordinates between multiple MCP tools and your application
103 |
104 | 🧠 **Application Responsibilities**
105 | - Process data provided by MCP tools (don't duplicate MCP functionality)
106 | - Focus on domain-specific logic (knowledge graphs, entity extraction, analysis)
107 | - Provide user interfaces and interaction patterns
108 |
109 | 📊 **MCP Tool Responsibilities**
110 | - **FireCrawl MCP**: Web scraping, content extraction, JavaScript rendering
111 | - **File System MCP**: File operations, directory management, data persistence
112 | - **Agent Mode**: Tool coordination, data passing, error handling
113 |
114 | ## Sample Output
115 |
116 | ```
117 | 🗺️ Welcome to the Knowledge Cartographer! 🗺️
118 |
119 | 🔗 Initializing MCP connections...
120 | ✅ FireCrawl MCP Server: Connected (simulated)
121 | ✅ File System MCP Server: Connected (simulated)
122 |
123 | 🔮 Initiating knowledge discovery for: "quantum computing"
124 | 📡 This application processes data provided by MCP tools
125 | 🤖 GitHub Copilot Agent Mode would call FireCrawl MCP to scrape web content
126 |
127 | 🔍 Phase 1: Processing Web Content (provided by FireCrawl MCP)
128 | 📚 Analyzing 3 sources scraped by MCP tools
129 | 📄 Processing: "Introduction to Quantum Computing" from https://example.com/quantum-computing-basics
130 | Content size: 2.4KB
131 |
132 | 🧠 Phase 2: Knowledge Extraction
133 | 📄 Processing: "Introduction to Quantum Computing"
134 | Entities: [quantum bit, superposition, entanglement, quantum gate]
135 | Concepts: [quantum mechanics, computation theory, algorithmic complexity]
136 |
137 | 🗂️ Phase 3: Knowledge Organization (using File System MCP)
138 | 📁 Requesting MCP to create knowledge base structure...
139 | ✅ MCP successfully organized knowledge files
140 |
141 | 🕸️ Phase 4: Graph Construction
142 | 📊 Building knowledge graph...
143 | • Nodes: 19 entities and concepts
144 | • Edges: 42 relationships
145 | • Clusters: 3 concept groups
146 |
147 | ✨ Knowledge discovery complete!
148 | ```
149 |
150 | ## Technical Implementation
151 |
152 | - **Node.js**: Core runtime for the application
153 | - **File System Operations**: Organized storage with proper directory structure
154 | - **Graph Algorithms**: Relationship mapping and cluster identification
155 | - **Interactive CLI**: Readline interface for user exploration
156 | - **Export Formats**: JSON, DOT (Graphviz), and Markdown output
157 |
158 | This solution demonstrates the power of GitHub Copilot Agent Mode to create sophisticated applications that integrate external tools through MCP while maintaining clean, maintainable code structure.
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/indexes/artificial-intelligence-index.json:
--------------------------------------------------------------------------------
1 | {
2 | "totalEntities": 5,
3 | "totalRelationships": 4,
4 | "totalSources": 3,
5 | "created": "2025-07-16T01:44:19.685Z"
6 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/indexes/quantum-computing-index.json:
--------------------------------------------------------------------------------
1 | {
2 | "totalEntities": 5,
3 | "totalRelationships": 4,
4 | "totalSources": 3,
5 | "created": "2025-07-16T01:44:19.684Z"
6 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/topics/artificial-intelligence/entities.json:
--------------------------------------------------------------------------------
1 | {
2 | "neural networks": {
3 | "frequency": 4,
4 | "sources": [
5 | "ai-intro",
6 | "deep-learning"
7 | ],
8 | "concepts": [
9 | "machine learning",
10 | "pattern recognition"
11 | ]
12 | },
13 | "deep learning": {
14 | "frequency": 3,
15 | "sources": [
16 | "ai-intro",
17 | "deep-learning"
18 | ],
19 | "concepts": [
20 | "machine learning"
21 | ]
22 | },
23 | "gradient descent": {
24 | "frequency": 2,
25 | "sources": [
26 | "optimization"
27 | ],
28 | "concepts": [
29 | "optimization",
30 | "algorithms"
31 | ]
32 | },
33 | "transformer architecture": {
34 | "frequency": 2,
35 | "sources": [
36 | "nlp-paper"
37 | ],
38 | "concepts": [
39 | "attention",
40 | "language models"
41 | ]
42 | },
43 | "ethical AI": {
44 | "frequency": 1,
45 | "sources": [
46 | "ethics-guide"
47 | ],
48 | "concepts": [
49 | "ethics",
50 | "governance"
51 | ]
52 | }
53 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/topics/artificial-intelligence/relationships.json:
--------------------------------------------------------------------------------
1 | {
2 | "neural networks <-> deep learning": {
3 | "strength": 4,
4 | "type": "subset"
5 | },
6 | "deep learning <-> gradient descent": {
7 | "strength": 3,
8 | "type": "uses"
9 | },
10 | "transformer architecture <-> attention": {
11 | "strength": 3,
12 | "type": "implements"
13 | },
14 | "AI <-> ethical AI": {
15 | "strength": 2,
16 | "type": "requires"
17 | }
18 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/topics/artificial-intelligence/sources.json:
--------------------------------------------------------------------------------
1 | {
2 | "ai-intro": {
3 | "url": "https://ai-course.stanford.edu",
4 | "title": "Introduction to AI",
5 | "size": "6.4KB"
6 | },
7 | "deep-learning": {
8 | "url": "https://deeplearning.ai/fundamentals",
9 | "title": "Deep Learning Fundamentals",
10 | "size": "8.2KB"
11 | },
12 | "nlp-paper": {
13 | "url": "https://arxiv.org/transformer-paper",
14 | "title": "Attention Is All You Need",
15 | "size": "12.1KB"
16 | }
17 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/topics/quantum-computing/entities.json:
--------------------------------------------------------------------------------
1 | {
2 | "quantum bit": {
3 | "frequency": 3,
4 | "sources": [
5 | "mit-intro",
6 | "quantum-basics"
7 | ],
8 | "concepts": [
9 | "quantum mechanics",
10 | "computation"
11 | ]
12 | },
13 | "superposition": {
14 | "frequency": 2,
15 | "sources": [
16 | "mit-intro"
17 | ],
18 | "concepts": [
19 | "quantum mechanics"
20 | ]
21 | },
22 | "entanglement": {
23 | "frequency": 2,
24 | "sources": [
25 | "mit-intro",
26 | "quantum-theory"
27 | ],
28 | "concepts": [
29 | "quantum mechanics"
30 | ]
31 | },
32 | "quantum gate": {
33 | "frequency": 1,
34 | "sources": [
35 | "quantum-circuits"
36 | ],
37 | "concepts": [
38 | "computation",
39 | "quantum mechanics"
40 | ]
41 | },
42 | "Shor's algorithm": {
43 | "frequency": 2,
44 | "sources": [
45 | "cryptography-paper"
46 | ],
47 | "concepts": [
48 | "cryptography",
49 | "algorithms"
50 | ]
51 | }
52 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/topics/quantum-computing/relationships.json:
--------------------------------------------------------------------------------
1 | {
2 | "quantum bit <-> superposition": {
3 | "strength": 3,
4 | "type": "enables"
5 | },
6 | "quantum bit <-> entanglement": {
7 | "strength": 2,
8 | "type": "enables"
9 | },
10 | "superposition <-> quantum gate": {
11 | "strength": 2,
12 | "type": "implements"
13 | },
14 | "quantum computing <-> Shor's algorithm": {
15 | "strength": 3,
16 | "type": "includes"
17 | }
18 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Knowledge-Cartographer-Agent-MCP/akashic-archives/topics/quantum-computing/sources.json:
--------------------------------------------------------------------------------
1 | {
2 | "mit-intro": {
3 | "url": "https://mit.edu/quantum-intro",
4 | "title": "MIT Quantum Computing Introduction",
5 | "size": "4.2KB"
6 | },
7 | "quantum-basics": {
8 | "url": "https://quantum-basics.org",
9 | "title": "Quantum Computing Fundamentals",
10 | "size": "3.1KB"
11 | },
12 | "cryptography-paper": {
13 | "url": "https://crypto-journal.com/shor",
14 | "title": "Shor's Algorithm in Practice",
15 | "size": "5.8KB"
16 | }
17 | }
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Legendary-Duel-of-Stonevale.js:
--------------------------------------------------------------------------------
1 | // Lookup tables
2 | const WINNING_MOVES = {
3 | 'rock': 'scissors',
4 | 'scissors': 'paper',
5 | 'paper': 'rock'
6 | };
7 |
8 | const POINTS = {
9 | 'rock': 1,
10 | 'paper': 2,
11 | 'scissors': 3
12 | };
13 |
14 | // Sample moves
15 | const player1Moves = ['scissors', 'paper', 'scissors', 'rock', 'rock'];
16 | const player2Moves = ['rock', 'rock', 'paper', 'scissors', 'paper'];
17 |
18 | // Initialize scores
19 | let player1Score = 0;
20 | let player2Score = 0;
21 |
22 | // Play the game based on the number of rounds present in the moves
23 | const rounds = Math.min(player1Moves.length, player2Moves.length);
24 | for (let i = 0; i < rounds; i++) {
25 | const move1 = player1Moves[i];
26 | const move2 = player2Moves[i];
27 |
28 | if (move1 === move2) continue;
29 | else if (WINNING_MOVES[move1] === move2) {
30 | player1Score += POINTS[move1];
31 | } else {
32 | player2Score += POINTS[move2];
33 | }
34 | }
35 |
36 | // Display the final scores and winner
37 | console.log(`Player 1 Score: ${player1Score}`);
38 | console.log(`Player 2 Score: ${player2Score}`);
39 |
40 | const winnerMessage = player1Score > player2Score ? 'Player 1 wins!' :
41 | player2Score > player1Score ? 'Player 2 wins!' : 'It\'s a draw!';
42 | console.log(winnerMessage);
43 |
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Magical-Forest-of-Algora.js:
--------------------------------------------------------------------------------
1 | const loxMoves = ["Twirl", "Leap", "Spin", "Twirl", "Leap"];
2 | const faelisMoves = ["Spin", "Twirl", "Leap", "Leap", "Spin"];
3 |
4 | const effects = {
5 | "TwirlTwirl": "Fireflies light up the forest",
6 | "LeapLeap": "The forest grows taller",
7 | "SpinSpin": "The forest shrinks",
8 | "TwirlLeap": "The forest becomes more dense",
9 | "LeapSpin": "Gentle rain starts falling",
10 | "SpinLeap": "A rainbow appears in the sky",
11 | "TwirlSpin": "The forest becomes less dense",
12 | "LeapTwirl": "The forest becomes more vibrant",
13 | };
14 |
15 | function danceEffect(loxMove, faelisMove) {
16 | return effects[`${loxMove}${faelisMove}`] || "A mysterious effect takes place.";
17 | }
18 |
19 | function simulateDance(loxMoves, faelisMoves) {
20 | return loxMoves.map((move, index) => danceEffect(move, faelisMoves[index]));
21 | }
22 |
23 | console.log(simulateDance(loxMoves, faelisMoves));
24 |
--------------------------------------------------------------------------------
/Solutions/JavaScript/The-Scrolls-of-Eldoria.js:
--------------------------------------------------------------------------------
1 | // Node.js 17.5 or higher has fetch built-in. Otherise, run `npm install node-fetch` first.
2 |
3 | async function fetchAndDecipherScroll(url) {
4 | try {
5 | const response = await fetch(url);
6 |
7 | if (!response.ok) {
8 | throw new Error(`HTTP error! Status: ${response.status}`);
9 | }
10 |
11 | const scrollContent = await response.text();
12 |
13 | // Use regular expression to extract the secrets
14 | const secretsPattern = /\{\*(.*?)\*\}/g;
15 | const secrets = [];
16 | let match;
17 |
18 | while ((match = secretsPattern.exec(scrollContent)) !== null) {
19 | secrets.push(match[1]);
20 | }
21 |
22 | // Display the extracted secrets
23 | secrets.forEach(secret => {
24 | console.log(secret);
25 | });
26 |
27 | } catch (error) {
28 | console.error("An error occurred:", error);
29 | }
30 | }
31 |
32 | // URL to the Eldorian Web of Knowledge (Replace with actual URL)
33 | const url = 'https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt';
34 | fetchAndDecipherScroll(url);
35 |
--------------------------------------------------------------------------------
/Solutions/Python/README-Gridlock-Arena.md:
--------------------------------------------------------------------------------
1 | # The Gridlock Arena of Mythos - Python Solution
2 |
3 | This folder contains the complete Python solution for the Gridlock Arena of Mythos adventure, demonstrating modern Python patterns and comprehensive battle simulation.
4 |
5 | ## Files
6 |
7 | - **`The-Gridlock-Arena-of-Mythos.py`** - Main battle simulation script
8 | - **`gridlock_arena_module.py`** - Core simulation functions and logic
9 | - **`test_gridlock_arena.py`** - Comprehensive test suite with 100% coverage
10 |
11 | ## Features
12 |
13 | ✅ **Modern Python** - Clean function definitions and data structures
14 | ✅ **Comprehensive Testing** - 45+ test cases covering all functionality
15 | ✅ **Battle Mechanics** - Multi-creature collision detection and resolution
16 | ✅ **Grid Visualization** - Unicode-based arena display
17 | ✅ **Error Handling** - Robust validation and error management
18 | ✅ **Modular Design** - Separated functions for testing and reusability
19 |
20 | ## Running the Solution
21 |
22 | ```bash
23 | # Run the main battle simulation
24 | python3 The-Gridlock-Arena-of-Mythos.py
25 |
26 | # Run the comprehensive test suite
27 | python3 test_gridlock_arena.py
28 |
29 | # Test individual functions (after importing gridlock_arena_module)
30 | python3 -c "from gridlock_arena_module import *; print('Functions imported successfully')"
31 | ```
32 |
33 | ## Expected Results
34 |
35 | - **Dragon**: 12 points (winner)
36 | - **Wizard**: 0 points (survives)
37 | - **All others**: 0 points (defeated)
38 |
39 | ## Test Coverage
40 |
41 | The test suite covers:
42 | - ✅ **Validation Tests** (17 tests) - Input validation and error handling
43 | - ✅ **Utility Functions** (9 tests) - Position and movement calculations
44 | - ✅ **Integration Tests** (7 tests) - Full battle simulations
45 | - ✅ **Edge Cases** (7 tests) - Boundary conditions and special scenarios
46 |
47 | This solution demonstrates modern Python development practices and comprehensive testing methodologies for educational purposes.
--------------------------------------------------------------------------------
/Solutions/Python/The-Celestial-Alignment-of-Lumoria.py:
--------------------------------------------------------------------------------
1 | # Planet objects with their name, distance from Lumoria, and size
2 | lumoria_planets = [
3 | { "name": "Mercuria", "distance": 0.4, "size": 4879 },
4 | { "name": "Earthia", "distance": 1, "size": 12742 },
5 | { "name": "Venusia", "distance": 0.7, "size": 12104 },
6 | { "name": "Marsia", "distance": 1.5, "size": 6779 }
7 | ]
8 |
9 | # Takes an array of planets and the current index for the planet being evaluated
10 | # and returns the number of planets that cast a shadow on the current planet
11 | def get_shadow_count(planets, current_index):
12 | # Slice the array up to the current index, filter the planets that are larger than the current planet, and return the length of the resulting array
13 | return len([planet for planet in planets[:current_index] if planet["size"] > planets[current_index]["size"]])
14 |
15 | # Takes the current index and the number of shadows cast on the planet
16 | # and returns the light intensity of the planet
17 | def get_light_intensity(i, shadow_count):
18 | if i == 0: return 'Full'
19 | if shadow_count == 1: return 'None'
20 | if shadow_count > 1: return 'None (Multiple Shadows)'
21 | return 'Partial'
22 |
23 | # Calculates the light intensity of each planet by seeing how many shadows are cast on it from other planets
24 | def calculate_light_intensity(planets):
25 | # Map over the array of planets, calculate the shadow count for each planet,
26 | # and return an object with the planet name and its light intensity
27 | return [{"name": planet["name"], "light": get_light_intensity(i, get_shadow_count(planets, i))} for i, planet in enumerate(planets)]
28 |
29 | # Sort the array of planets by distance
30 | sorted_planets = sorted(lumoria_planets, key=lambda planet: planet["distance"])
31 |
32 | # Print the light intensity of each planet
33 | print(calculate_light_intensity(sorted_planets))
--------------------------------------------------------------------------------
/Solutions/Python/The-Chamber-Of-Echos.py:
--------------------------------------------------------------------------------
1 | echoes = [3, 6, 9, 12]
2 | memories = []
3 |
4 | # This function is predicting the next number in the sequence by finding the difference
5 | # between the first two numbers and adding that difference to the last number in the sequence.
6 | def predict_next(echoes):
7 | difference = echoes[1] - echoes[0]
8 | next_value = echoes[-1] + difference
9 | # Store the full sequence including the predicted number in memories
10 | memories.extend(echoes + [next_value])
11 | return next_value
12 |
13 | print(predict_next(echoes))
--------------------------------------------------------------------------------
/Solutions/Python/The-Clockwork-Town-of-Tempora.py:
--------------------------------------------------------------------------------
1 | def time_difference(clock_time, grand_clock_time):
2 | """
3 | Calculates the time difference between two clock times in minutes.
4 |
5 | Parameters:
6 | clock_time (str): The first clock time in the format "HH:MM".
7 | grand_clock_time (str): The second clock time in the format "HH:MM".
8 |
9 | Returns:
10 | int: The time difference between the two clock times in minutes.
11 | """
12 | clock_hour, clock_minute = map(int, clock_time.split(":"))
13 | grand_clock_hour, grand_clock_minute = map(int, grand_clock_time.split(":"))
14 |
15 | return (clock_hour - grand_clock_hour) * 60 + (clock_minute - grand_clock_minute)
16 |
17 | def synchronize_clocks(clock_times, grand_clock_time):
18 | """
19 | Synchronizes the given clock times with the grand clock time by calculating the time difference between each clock time and the grand clock time.
20 |
21 | Parameters:
22 | clock_times (list): A list of clock times in the format of 'hh:mm'.
23 | grand_clock_time (str): The grand clock time in the format of 'hh:mm'.
24 |
25 | Returns:
26 | list: A list of time differences between each clock time and the grand clock time.
27 | """
28 | return [time_difference(clock_time, grand_clock_time) for clock_time in clock_times]
29 |
30 | clock_times = ["14:45", "15:05", "15:00", "14:40"]
31 | grand_clock_time = "15:00"
32 | print(synchronize_clocks(clock_times, grand_clock_time)) # [-15, 5, 0, -20]
--------------------------------------------------------------------------------
/Solutions/Python/The-Gridlock-Arena-of-Mythos.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | """
3 | The Gridlock Arena of Mythos - Main Battle Simulation
4 |
5 | Epic battle simulation system for the mystical land of Mythos.
6 | """
7 |
8 | from gridlock_arena_module import run_battle_simulation
9 |
10 | if __name__ == '__main__':
11 | run_battle_simulation()
--------------------------------------------------------------------------------
/Solutions/Python/The-Legendary-Duel-of-Stonevale.py:
--------------------------------------------------------------------------------
1 | # Lookup tables
2 | WINNING_MOVES = {
3 | 'rock': 'scissors',
4 | 'scissors': 'paper',
5 | 'paper': 'rock'
6 | }
7 |
8 | POINTS = {
9 | 'rock': 1,
10 | 'paper': 2,
11 | 'scissors': 3
12 | }
13 |
14 | # Sample moves
15 | player1_moves = ['scissors', 'paper', 'scissors', 'rock', 'rock']
16 | player2_moves = ['rock', 'rock', 'paper', 'scissors', 'paper']
17 |
18 | # Initialize scores
19 | player1_score = 0
20 | player2_score = 0
21 |
22 | # Play the game based on the number of rounds present in the moves
23 | rounds = min(len(player1_moves), len(player2_moves))
24 | for i in range(rounds):
25 | move1 = player1_moves[i]
26 | move2 = player2_moves[i]
27 |
28 | if move1 == move2:
29 | continue
30 | elif WINNING_MOVES[move1] == move2:
31 | player1_score += POINTS[move1]
32 | else:
33 | player2_score += POINTS[move2]
34 |
35 | # Display the final scores and winner
36 | print(f"Player 1 Score: {player1_score}")
37 | print(f"Player 2 Score: {player2_score}")
38 |
39 | if player1_score > player2_score:
40 | winner_message = 'Player 1 wins!'
41 | elif player2_score > player1_score:
42 | winner_message = 'Player 2 wins!'
43 | else:
44 | winner_message = "It's a draw!"
45 | print(winner_message)
--------------------------------------------------------------------------------
/Solutions/Python/The-Magical-Forest-of-Algora.py:
--------------------------------------------------------------------------------
1 | lox_moves = ["Twirl", "Leap", "Spin", "Twirl", "Leap"]
2 | drako_moves = ["Spin", "Twirl", "Leap", "Leap", "Spin"]
3 |
4 | effects = {
5 | "TwirlTwirl": "Fireflies light up the forest.",
6 | "LeapLeap": "The forest grows taller.",
7 | "SpinSpin": "The forest shrinks.",
8 | "TwirlLeap": "The forest becomes more dense.",
9 | "LeapSpin": "Gentle rain starts falling.",
10 | "SpinLeap": "A rainbow appears in the sky.",
11 | "TwirlSpin": "The forest becomes less dense.",
12 | "LeapTwirl": "The forest becomes more vibrant."
13 | }
14 |
15 | def dance_effect(lox_move, drako_move):
16 | return effects.get(f"{lox_move}{drako_move}", "A mysterious effect takes place.")
17 |
18 | def simulate_dance(lox_moves, drako_moves):
19 | return [dance_effect(lox_move, drako_move) for lox_move, drako_move in zip(lox_moves, drako_moves)]
20 |
21 | print(simulate_dance(lox_moves, drako_moves))
--------------------------------------------------------------------------------
/Solutions/Python/The-Scrolls-Of-Eldoria.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import re
3 |
4 | def fetch_and_decipher_scroll(url):
5 | try:
6 | response = requests.get(url)
7 | response.raise_for_status()
8 |
9 | scroll_content = response.text
10 |
11 | # Use regular expression to extract the secrets
12 | secrets_pattern = re.compile(r'\{\*(.*?)\*\}')
13 | secrets = secrets_pattern.findall(scroll_content)
14 |
15 | # Display the extracted secrets
16 | for secret in secrets:
17 | print(secret)
18 |
19 | except requests.HTTPError as http_err:
20 | print(f'HTTP error occurred: {http_err}')
21 | except Exception as err:
22 | print(f'An error occurred: {err}')
23 |
24 | # URL to the Eldorian Web of Knowledge (Replace with actual URL)
25 | url = 'https://raw.githubusercontent.com/microsoft/CopilotAdventures/main/Data/scrolls.txt'
26 | fetch_and_decipher_scroll(url)
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | # remote_theme: pages-themes/midnight@v0.2.0
2 | # plugins:
3 | # - jekyll-remote-theme
--------------------------------------------------------------------------------