Coder Social home page Coder Social logo

2021-advent-of-code's Introduction

2021-advent-of-BASIC

Join Advent of Code, complete a puzzle every day in the language of your choice.

I'll be doing it in BBC BASIC - a coding language from a computer called the BBC Micro first released in 1981. Just like me.

Solution code is provided per day, and you can explore each at bbcmic.ro - just copy it in to the editor, and press run.

Notes

Day 3 was the first where the data was too large to operate on in an array. (Well, I could store the data but I couldn't then copy it into an array for random access. I was forced to use it sequentially only.) The workaround: iterating over the input data to build a matching prefix that eventually became the solution.

Day 4 also bumped against several limits of the poor little machine. I had a lot of data, and not enough room to track all the highlighted numbers after each call. I had to get creative, and ended up modifying the cards to remove numbers as they were highlighted.

  • Silly mistake: As the scoring works by summing all non-highlighted numbers, I figured I could just zero highlighted numbers - which makes it possible to spot a complete row or column, and very easy to calculate the score of a card. However, 0 is a legitimate number for a board. I had to switch to using -1. (There's no NULL in BBC BASIC.)
  • Silly mistake: I was waiting for a board to have a row AND a column. Should have been OR.
  • Silly mistake: Bingo cards can only win once!

2021-advent-of-code's People

Contributors

instantiator avatar

Stargazers

Alex Wilson avatar

Watchers

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