Code Monkey home page Code Monkey logo

aoc-gpt's Introduction

Advent of Code, by GPT-3

This solves Advent of Code puzzles by having GPT-3 write code in response to the puzzle's input.

I placed 1st on Day 4 Part 1 (2022) with this code, and 2nd on Day 3 Part 1 (2022) with a previous version.

Table of Contents

How it works

The code is written in Python, and uses the OpenAI API to call GPT-3. It also uses the aoc-cli library to download the puzzle input and submit the answer.

How to use

python3 openai.py --day=2

All flags:

  • --day (required) - The day of the puzzle.
  • --year - The year of the puzzle. Defaults to the current year.
  • --part - The part of the puzzle.
  • --n-workers - The number of workers to use. Defaults to 1
  • --runs - The number of runs to make. Defaults to 200
  • --stop-when-submitted - Stop when the answer is submitted. Defaults to False

Example:

python3 openai.py --day=2 --year=2019 --runs=10

Installation

Install aoc-cli

All instructions can be found in the aoc-cli repo

Install the aoc-cli library:

cargo install aoc-cli
# or
brew install scarvalhojr/tap/aoc-cli
# or, for Windows
winget install aoc-cli

And add the AOC session cookie.

Install OpenAI API

Install the openai library:

pip install openai

Add an OpenAI API key to the OPENAI_API_KEY environment variable.

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.