Giter Site home page Giter Site logo

aoc22's Introduction

aoc22

My solutions in java for advent of code 2022

You might be interested in the b.java class which is the base class for all my daily solution classes. These solution classes have to respect the day<x> naming convention and the b class will automatically fetch the input from the server for you. In the main method you can select which part gets executed and where the input data is taken from (local input.txt file or from server) Note that for the remote http fetching of input data, you first need to retrieve the session cookie corresponding to your account and replace it in the b class session variable accordingly.

Your derived solution class has to implement one method for each problem part.There are 2 flavours you can use to achieve that:

If you want to factorize input reading between the part 1 and part 2:

public class day1 extends b{    
    public static void main(String[] a) {
        day1 d=new day1();
        try {
            // part 1 with local text input
            //d.p1_t();
            // part 1 with remote http input
            //d.p1_h();
            //part 2 with local text input
            //d.p2_t();
            //part 2 with remote http input
            d.p2_h();
        } catch(Exception e) {e.printStackTrace();}

    }

    @Override
    void readInput(Stream<String> in) {
        in.forEach(str -> {
            // process each line here
        });
    }

    @Override
    void P1() {
        //solve part 1 here
    }

    @Override
    void P2() {
        //solve part 2 here
    }
}

If you want to directly process the input in each part function:

public class day1 extends b{    
    public static void main(String[] a) {
        day1 d=new day1();
        try {
            //d.pt1();
            //d.ph1();
            //d.pt2();
            d.ph2();
        } catch(Exception e) {e.printStackTrace();}

    }

  
    @Override
    void processP1(Stream<String> in) {
        //solve part 1 here
    }

    @Override
    void processP2(Stream<String> in) {
        //solve part 2 here
    }
}

aoc22's People

Contributors

ehubin 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.