Giter Club home page Giter Club logo

hashcode_template's Introduction

hashcode_template

The simple template to excel on Google Hashcode Competition

Why?

If you ever competed in the Google Hashcode Coding Competition, you already know the answer.

You have a few hours to solve the problem and nothing sucks more than starting late because your environment isn't set off. ๐Ÿ˜ญ

This repository is here for you. ๐Ÿ˜ผ

You can create the:

  • file reader/writer,
  • scorer,
  • data model

in minutes, using the remaining time only to find the top class algorithm that will make you excel in the competition! ๐Ÿ†

Installing

... is as simple as

npm install

How to use

  1. Define your input data model populating the Input type on src/parser.ts:
    export type Input = {}
  2. Write the input parser on src/parser.ts
    const parse = (file : string) : Input => {
      const data = fs.readFileSync(file, 'ascii')
      //TODO: transform 'data' to the input dataset according to the problem specs
      return {}
    }
  3. Define your output data model populating the Solution type on src/solver.ts:
    export type Solution = {}
  4. Write the output serializer on src/writer.ts
    const write = (solution : Solution, file : string) => {
      const data : string = "test+"
      //TODO: map the solution to the output file according to the specs of the problem
      fs.writeFileSync(file, data)
    }
  5. Write your solution on src/solver.ts
    const solve = (dataset : Input) : Solution => {
        //TODO: provide the best fucking solution in order to beat the competition
        return {}
    }
  6. Write the scorer for a solution on src/scorer.ts
    const score = (input : Input, solution : Solution) => {
        //TODO: compute the score for the solution according to the problem specs
        return 1
    }
  7. Put your test cases as .in files on inputs folder
  8. Run your program with:
    npm run start
  9. That's it! You will find:
    • on outputs/: the output files as .out files;
    • on scores/ the scores of the solutions as .score files.

NB: The script saves, for every input file, the solution only if the computed score is greater or equal than the saved on for that file.

Contributing

  1. Clone this repo
  2. Create a branch: git checkout -b your-feature
  3. Make some changes
  4. Push your branch and open a Pull Request

License

This code is open source software licensed under the Apache 2.0 License.

Maintainer

Luigi Donadel - @luigidonadel - [email protected]

Project Link: https://github.com/donadev/hashcode_starter

hashcode_template's People

Contributors

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