CopilotAdventures

The Clockwork Town of Tempora

Background

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.

Objective

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.

Specifications

  1. Clock Data:
    • The clock times are provided in a 24-hour format.
    • The Grand Clock Tower is at 15:00.
    • Clock times around town:
      • Clock 1: 14:45
      • Clock 2: 15:05
      • Clock 3: 15:00
      • Clock 4: 14:40
  2. Time Analysis and Output:
    • You need to determine how many minutes each clock is ahead or behind the Grand Clock Tower.
    • 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.

Constraints

Summary of High-Level Tasks to Perform

  1. Use a console application to render the output.
  2. Parse the time data for each clock and the Grand Clock Tower.
  3. Calculate the difference in minutes between each clock and the Grand Clock Tower.
  4. Output the list of time differences.

Tips to Get Started

  1. If you’re using a GitHub Codespace, you’re ready to go!
  2. If running locally, ensure that you have your target language/framework installed.
  3. Create a folder for your code.
    • JavaScript: Create a folder called tempora and add a file named app.js.
    • Python: Create a folder called tempora and add a file named app.py.
    • C#: Create a folder called tempora and run dotnet new console.

GitHub Copilot Tips

Use Copilot to improve efficiency

See if you can use Copilot to find out the complexity (BigO notation) of the code.

  1. Open the GitHub Copilot Chat view in the sidebar if it’s not already open. Make sure your solution file is still open as well.

  2. Ask Copilot Chat what the complexity of the code is.

  3. Ask Copilot Chat to make the code more efficient.

  4. Ask for the complexity again - is it better?

Use Copilot to generate code comments

  1. Highlight all of the code with Ctrl/Cmd+A.

  2. Press Ctrl/Cmd+I to open the inline chat.

  3. Type “/doc”

  4. Ask Copilot Chat to document the function.

Use Copilot to simplify your code

  1. Open GitHub Copilot Chat in the sidebar.

  2. Type “/simplify” and press Enter. You can also add any text you want after the “/simplify” to give Copilot more instructions.

  3. What did Copilot Chat suggest you do to make it simpler?

Got Errors?

Copilot Chat can help with that too! Just copy the error message and paste it into Chat. Often that’s all Copilot needs to resolve your issue.