Code Monkey home page Code Monkey logo

advent-of-swift's Introduction

Advent of Swift

Hey! It's good to see you. I've started this repository to implement Advent of Code challenges in Swift. I'm not trying to be competitive so don't expect any groundbreaking solutions.

If you want to use Advent of Code as a motivation to learn Swift, feel free to fork this repository an get going.

Have fun!

What is in here?

At its heart this project is a very simple Swift executable using ArgumentParser to provide you with a easy-to-use command-line interface.

I'm currently adding all solutions to the AdventOfSwift.swift file.

There is also a Utils.swift file. It currently contains a small helper function to get the input of a specific day. As this input is specific to each participant you'll need to provide a token.

How do I get a token?

How do I run stuff?

Make sure you've Swift installed. Open the package folder in your favorite terminal emulator and run swift run aoswift. You should get a list of all available commands. Each day has it's own command, e.g. 01.12 is swift run aoswift first.

How do I add stuff?

Open AdventOfSwift.swift and create a a new AsyncParsableCommand.

struct Second: AsyncParsableCommand {
    
    func run() async throws {
        
    }
}

Inside run() you can start implementing your solution. Before you can run this command make sure to add it to the CommandConfiguration inside the AdventOfSwift struct to the array of the subcommands parameter.

static var configuration = CommandConfiguration(
    abstract: "Solutions for AoC problems",
    subcommands: [
        First.self,
        Second.self
    ]
)

Now you can run swift run aoswift second to test your implementation.

How does the leaderboard work?

Set the environment variable AOC_LEADERBOARD to a private leaderboard token.

Current Standings

swift run aoswift leaderboard

By default this will print the current Top 10 by their local score on the specified leaderboard.

You can customize this behavior by providing a number of results.

// Get results for the first 5 members
swift run aoswift leaderboard --number-of-results 5

// Get results for all members
swift run aoswift leaderboard --number-of-results all

Todo

[X] Leaderboard support
[] Linux Support

advent-of-swift's People

Contributors

technocidal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.